This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: GCC FAIL WITH BASIC STL EXAMPLE
- From: "Jonathan Wakely" <jwakely dot gcc at gmail dot com>
- To: trincheira <trincheira at hotmail dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Tue, 2 May 2006 17:50:27 +0100
- Subject: Re: GCC FAIL WITH BASIC STL EXAMPLE
- References: <4182440.post@talk.nabble.com>
On 02/05/06, trincheira <trincheira@hotmail.com> wrote:
Hello Guys,
This simple test code was extracted from the SGI-STL website, but oddly
enough it doesn't compile:
The example code is invalid, see below. When the example was written
very few compilers diagnosed the problem, so it worked on most (maybe
all) compilers available at the time.
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
template <class InputIterator>
std::iterator_traits<InputIterator>::value_type
need typename at start of line above
last_value(InputIterator first, InputIterator last) {
std::iterator_traits<InputIterator>::value_type result = *first;
need typename at start of line above
for (++first; first != last; ++first)
result = *first;
return result;
}