This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC FAIL WITH BASIC STL EXAMPLE


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;
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]