473,569 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1511
* 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
3900
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
4198
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 including <map>. By linking my application and the lib, following errors occur: error LNK2005: "public: __thiscall std::basic_string<char,struct...
2
3604
by: Sims | last post by:
Hi, I have a structure as follow struct sIntStructure { int m_nNumber; // // A few more variables //
5
1506
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 supposed to search for some characters (2 or 1) and replace them with their equivalent Arabic characters from an array vector<string>. I have been...
2
1825
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(), ostream_iterator<T>(o, " "); return o << ">"; }
1
2128
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 stdafx.h, I found that to compile i had to change <fstream.h> to <fstream> to get it to compile.
3
2228
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 namespace std; ...... vector <Vector> vectorlist;
0
2502
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: vector_plus is a subclass of the vector class. vector_plus has no new fields. Define: void erase_item(const T& item); Here is an example of my header...
1
2094
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
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8132
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.