pingus-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More (Windows) Errors


From: David Philippi
Subject: Re: More (Windows) Errors
Date: Fri, 18 Oct 2002 23:50:01 +0200
User-agent: KMail/1.4.1

On Wednesday 16 October 2002 15:25, Neil Hotmail wrote:
> vec.insert(vec.end(), p.vec.rbegin(), p.vec.rend());
> D:\Pingus\CVS\Games\Pingus\src\worldmap\path.hxx(77) : error C2664: 'void
> __thiscall std::vector<class Vector,class std::allocator<class Vector>
> >::insert(class Vector *,unsigned int,const class Vector &)' : cannot
> convert parameter 2 from 'class st
> d::reverse_iterator<class Vector *,class Vector,class Vector &,class
> Vector *,int>' to 'unsigned int'
>         No user-defined-conversion operator available that can perform
> this conversion, or the operator cannot be called
>
> I think windows wants insert(at where, from where, length of where (not
> iterator to where as you pass)
> Not sure if this is STL problems with windows, or STL issues with GCC, or
> GCC missing this error, no idea! Also isn't there either an append or
> push_back method available which takes a iterator range, rather than
> calling insert with vec.end?

The method insert as called by Ingo in this code exists and the syntax is 
correct. GCC 3.2 is more standard conform by far then VC++ 6.
The error message indicates the VC++ is trying to use the wrong insert method 
here - there are two:

1. void insert (iterator i, size_type num, const T& val)
2. template <class InIter> void insert(iterator i, InIter start, InIter end)

Seems like VC++ doesn't know about the second one. If the second one isn't 
supported at all for vector (it works with list) we'll have to resort to a 
loop of push_back or better enlarge the vector with resize by the required 
number and insert the elements with operator []. That way it's very unlikely 
that the internal data has to be resized twice.

Bye David





reply via email to

[Prev in Thread] Current Thread [Next in Thread]