pingus-devel
[Top][All Lists]
Advanced

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

Re: More (Windows) Errors


From: Ingo Ruhnke
Subject: Re: More (Windows) Errors
Date: 19 Oct 2002 02:13:53 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

David Philippi <address@hidden> writes:

> 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.

The second insert uses member templates, which MSVC6 doesn't support,
in some case it provides non-member-template functions which provide
the same functionality. Not sure what would be the best in this case,
but something like:

#ifdef WIN32
    vec.insert(vec.end(), p.vec.rbegin(), p.vec.rend()); 
#else
    Vec::iterator i = vec.end();
    vec.resize(vec.size + p.vec.size ());
    std::copy(p.vec.rbegin(), p.vec.rend(), i);
#endif

might work.

-- 
WWW:      http://pingus.seul.org/~grumbel/ 
Games:    http://pingus.seul.org/~grumbel/gamedesigns/
JabberID: address@hidden 
ICQ:      59461927




reply via email to

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