GCC FAIL WITH BASIC STL EXAMPLE
Theodore Papadopoulo
Theodore.Papadopoulo@sophia.inria.fr
Tue May 2 15:46:00 GMT 2006
On Tue, 2006-05-02 at 08:26 -0700, trincheira wrote:
> Hello Guys,
>
> I am developing some applications that extensively uses STL. I plan to use
> the
> traits -> iterator_traits to get information about which type do I need to
> return.
> Unfortunately, I've been experienced some problems to use such
> functionality.
>
> This simple test code was extracted from the SGI-STL website, but oddly
> enough it doesn't compile:
> #include
> #include
> #include
> #include
>
> template
> std::iterator_traits::value_type
> last_value(InputIterator first, InputIterator last) {
> std::iterator_traits::value_type result = *first;
> for (++first; first != last; ++first)
> result = *first;
> return result;
> }
>
> using namespace std;
>
> int main()
> {
> std::vector teste(10);
> fill_n(teste.begin(),10,1.2);
> double result = last_value(teste.begin(),teste.end());
> return 0;
> }
I looks like one of your copy paste did not work correctly. There are
bunch of <> that are missing from your program. If it is just in the
email that those parts are missing try inserting a typename before
std::iterator_traits::value_type each time this construction appears...
More information about the Gcc
mailing list