help-gplusplus
[Top][All Lists]
Advanced

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

Help with vector iterator


From: Garrett Kajmowicz
Subject: Help with vector iterator
Date: Sun, 02 Jan 2005 19:30:06 -0500
User-agent: Pan/0.14.2.91 (As She Crawled Across the Table)

I'm implementing the C++ standard library + stl for embedded systems
(ucxx.uclibc.org).  I have an implementation of std::vector which works
quite well up until you try and do vector<int>.  Any other data type is
find.

There are many problems which I have encountered, but this is the most
obvious (and I am hoping will lead me to the rest of the solution).

There are two insert functions I must provide:

void insert(iterator position, size_type n, const T& x );
template <class InputIterator> void insert(iterator position,
InputIterator first, InputIterator last)

For some reason, when I am using a data type of int, it will treat an
integer as an iterator which really screws things up.  Try dereferencing
and integer some time and enjoy the compiler errors.  In short, it always
calls the second function, even when I want it to call the first.

What should I do to avoid this horrible mess?

-       Garrett Kajmowicz


reply via email to

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