473,320 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Contiguous storage for <vector>

Where is it specified that data storage for <vector> must be contiguous? i.e.,

Assuming v is a vector of some size,

&v[1] == &v[0] + 1;

-dr
Oct 25 '05 #1
3 1501
* Dave Rahardja:

Where is it specified that data storage for <vector> must be contiguous? i.e.,

Assuming v is a vector of some size,

&v[1] == &v[0] + 1;


§23.2.4/1 in C++2003, "The elements of a vector are stored contigously, ...".

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Oct 25 '05 #2
On Tue, 25 Oct 2005 13:41:23 GMT, al***@start.no (Alf P. Steinbach) wrote:
* Dave Rahardja:

Where is it specified that data storage for <vector> must be contiguous? i.e.,

Assuming v is a vector of some size,

&v[1] == &v[0] + 1;


§23.2.4/1 in C++2003, "The elements of a vector are stored contigously, ...".


What is this C++2003 you speak of?

-dr
Oct 26 '05 #3
On Wed, 26 Oct 2005 02:33:16 GMT, Dave Rahardja <as*@me.com> wrote:
On Tue, 25 Oct 2005 13:41:23 GMT, al***@start.no (Alf P. Steinbach) wrote:
* Dave Rahardja:

Where is it specified that data storage for <vector> must be contiguous? i.e.,

Assuming v is a vector of some size,

&v[1] == &v[0] + 1;


§23.2.4/1 in C++2003, "The elements of a vector are stored contigously, ...".


What is this C++2003 you speak of?


Never mind! My copy of the Standard is obsolete. Duly updated.

-dr
Oct 26 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sean Dettrick | last post by:
Hi, I have several <vector>'s of the same length, with entries as follows: I= A= B= I want to use STL to make (I == 0) a mask to operate on the elements of A and B, i.e. I want to do this:
1
by: Florian Liefers | last post by:
"Hello World\n", i have the following problem: One of my headerfiles for a lib is including <vector>. When i compile the lib, everything is done well. In my application another file is...
2
by: Sims | last post by:
Hi, I have a structure as follow struct sIntStructure { int m_nNumber; // // A few more variables //
5
by: Ahmad | last post by:
Hi all, I have written a simple c++ app, as I'm still learning c++. The thing works flawlessly on VC++6, but just doesn't work on g++. The transliterate function which causes the problem is...
2
by: Russ Ford | last post by:
I'm trying to overload the << operator to output vectors, as follows: template <class T> ostream& operator << (ostream& o, const vector<T>& v) { o << "< "; copy (v.begin(), v.end(),...
1
by: Macca | last post by:
Hi, I have been using <fstream.h> in stdafx.h,(i'm using MFC) to output to text files. I have now started to use vectors and when i added #include <vector> using namespace std; to...
3
by: kuiyuli | last post by:
I'm using VC++ .Net to do a simlple program. I tried to use <vector> <list> in the program, and I simply put the folowing lines " #include <list> #include <vector> #include <string> using...
0
by: cagenix | last post by:
I was running through a data structures book and I was curious if anyone could inform me of how to inherit the vector class to do a simple search and erase function. The example states: ...
1
by: Birthe Gebhardt | last post by:
Dear all, I could not find the way to handle 'not normal' list objects, for example using remove_if, find etc. Example : class Todo { public : .. int getNumber(){ return num_;}
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.