Re: [C++] Vector - guaranteed to be contiguous?
From: Jerry Coffin (jcoffin_at_taeus.com)
Date: 01/18/04
- Next message: Jerry Coffin: "Re: Returning an unknown number of types/values"
- Previous message: Jumbo: "Re: working with addresses"
- In reply to: David White: "Re: [C++] Vector - guaranteed to be contiguous?"
- Next in thread: André Pönitz: "Re: [C++] Vector - guaranteed to be contiguous?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 18 Jan 2004 05:49:31 GMT
In article <tAjOb.7357$xm.351468@nasal.pacific.net.au>,
no@email.provided says...
[ ... ]
> I'm trying to figure out how you haven't contradicted yourself. Earlier I
> asked, "Suppose I have a built-in float array and I want to use
> std::vector<float>::insert(iterator it, const_iterator first, const_iterator
> last) to insert it into a vector, by passing a const float * for the second
> and third parameters. Is this possible if an iterator is not a pointer?"
> Your reply was "Yes." So, can I or can't I?
An algorithm will use certain operations on an iterator. If the data is
such that those operations on a pointer will access the data correctly,
you can use pointers as iterators into that data.
Mostly that means you can use pointers to items in an array as random
access iterators into that array. Other than that, most bets are off --
for most other data structures, iterators will need to overload
operators to do the right things.
--
Later,
Jerry.
The universe is a figment of its own imagination.
- Next message: Jerry Coffin: "Re: Returning an unknown number of types/values"
- Previous message: Jumbo: "Re: working with addresses"
- In reply to: David White: "Re: [C++] Vector - guaranteed to be contiguous?"
- Next in thread: André Pönitz: "Re: [C++] Vector - guaranteed to be contiguous?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|