473,503 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how many layer the vector can be?

I try to use:

std::vector <std::vector <std::vector <int>>>;

But it seems not work.

how many layer the vector can be?

for example:

std::vector <std::vector <std::vector <int>>v1;
std::vector <std::vector <int>v2;

v1.resize(2);
v1[0].resize(2);
v1[0][0].resize(2);
v1[0][0][0] = 1;//wrong

v2.resize(2);
v2[0].resize(2);
v2[0][0] = 1;//OK

Jun 27 '08 #1
8 1268
kathy wrote:
I try to use:

std::vector <std::vector <std::vector <int>>>;

But it seems not work.
FAQ 5.8.
how many layer the vector can be?
Many. The limitation should be documented in your compiler
manual.
>
for example:

std::vector <std::vector <std::vector <int>>v1;
std::vector <std::vector <int>v2;

v1.resize(2);
v1[0].resize(2);
v1[0][0].resize(2);
v1[0][0][0] = 1;//wrong
"Wrong"?
>
v2.resize(2);
v2[0].resize(2);
v2[0][0] = 1;//OK
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #2
On Apr 15, 10:31 am, kathy <yqin...@yahoo.comwrote:
I try to use:

std::vector <std::vector <std::vector <int>>>;
You need to put spaces between characters. Otherwise the compiler
parser will take two of them together to be the right shift operator:
>>
Better yet, use typedefs to make this code more readable:

typedef vector<intSomeType;
typedef vector<SomeTypeSomeName;
typedef vector<SomeNameSomeOtherName;

Ali
Jun 27 '08 #3
kathy <yq*****@yahoo.comwrote in news:aa8083cf-1554-40fc-b13f-
32**********@z24g2000prf.googlegroups.com:
I try to use:

std::vector <std::vector <std::vector <int>>>;

But it seems not work.

how many layer the vector can be?
I am sure there is some compiler limit, but mostly it will depend upon how
many you enter in your declaration.
>
for example:

std::vector <std::vector <std::vector <int>>v1;
std::vector <std::vector <int>v2;

v1.resize(2);
v1[0].resize(2);
v1[0][0].resize(2);
v1[0][0][0] = 1;//wrong
v1 is a vector of vectors of vectors of int
v1[0] is a vector of vectors of int
v1[0][0] is a vector of int
v1[0][0][0] is not valid.

hope that helps,
joe
Jun 27 '08 #4
Joe Greer wrote:
kathy <yq*****@yahoo.comwrote in news:aa8083cf-1554-40fc-b13f-
32**********@z24g2000prf.googlegroups.com:
>I try to use:

std::vector <std::vector <std::vector <int>>>;

But it seems not work.

how many layer the vector can be?

I am sure there is some compiler limit, but mostly it will depend upon how
many you enter in your declaration.
>for example:

std::vector <std::vector <std::vector <int>>v1;

>std::vector <std::vector <int>v2;

v1.resize(2);
v1[0].resize(2);
v1[0][0].resize(2);
v1[0][0][0] = 1;//wrong

v1 is a vector of vectors of vectors of int
v1[0] is a vector of vectors of int
v1[0][0] is a vector of int
v1[0][0][0] is not valid.
v1[0][0][0] is a reference to an int.
Jun 27 '08 #5
Joe Greer wrote:
kathy <yq*****@yahoo.comwrote in news:aa8083cf-1554-40fc-b13f-
32**********@z24g2000prf.googlegroups.com:
>I try to use:

std::vector <std::vector <std::vector <int>>>;

But it seems not work.

how many layer the vector can be?

I am sure there is some compiler limit, but mostly it will depend
upon how many you enter in your declaration.
>>
for example:

std::vector <std::vector <std::vector <int>>v1;

>std::vector <std::vector <int>v2;

v1.resize(2);
v1[0].resize(2);
v1[0][0].resize(2);
v1[0][0][0] = 1;//wrong

v1 is a vector of vectors of vectors of int
v1[0] is a vector of vectors of int
v1[0][0] is a vector of int
v1[0][0][0] is not valid.
Why? If 'v1[0][0]' is a vector of int, then 'v1[0][0][0]' is an int.
hope that helps,
joe
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #6
v1 is a vector of vectors of vectors of int
v1[0] is a vector of vectors of int
v1[0][0] is a vector of int
v1[0][0][0] is not valid.

hope that helps,
joe
I believe the v1[0][0][0] IS valid. It is integer.

Jun 27 '08 #7
red floyd <no*****@here.dudewrote in
news:1r*****************@nlpi068.nbdc.sbc.com:
Joe Greer wrote:
>kathy <yq*****@yahoo.comwrote in news:aa8083cf-1554-40fc-b13f-
32**********@z24g2000prf.googlegroups.com:
>>I try to use:

std::vector <std::vector <std::vector <int>>>;

But it seems not work.

how many layer the vector can be?

I am sure there is some compiler limit, but mostly it will depend
upon how many you enter in your declaration.
>>for example:

std::vector <std::vector <std::vector <int>>v1;

>>std::vector <std::vector <int>v2;

v1.resize(2);
v1[0].resize(2);
v1[0][0].resize(2);
v1[0][0][0] = 1;//wrong

v1 is a vector of vectors of vectors of int
v1[0] is a vector of vectors of int
v1[0][0] is a vector of int
v1[0][0][0] is not valid.

v1[0][0][0] is a reference to an int.
True, my bad. sigh.

joe
Jun 27 '08 #8
On 15 avr, 19:40, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
kathy wrote:
[...]
how many layer the vector can be?
Many. The limitation should be documented in your compiler
manual.
From a quality of implementation point of view, probably, but
I'm not sure that the standard requires that the implementation
limits be documented. In practice, the most I think you'll find
is how deep templates can be nested. And since you don't know
how deep the implementation of std::vector nests them already,
that doesn't advance you much.

If the error is due to template nesting, some compilers have
options to increase it. (Early implementations of templates
often made it artificially low, since the typical case was
unintentional recursion, without a specialization to stop it. I
think that these restrictions are being raised, because the only
way to implement a loop in template metaprogramming is via such
recursion.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jun 27 '08 #9

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

Similar topics

1
1924
by: PAD | last post by:
I have written a javascript routine that populates a parent document with a series of <iframe>s. Each <iframe> receives its contents from a series of separate smaller HTML files. Of course my NN...
2
2196
by: headware | last post by:
I'm relatively new to ASP.NET and ADO.NET, but I have a basic design question regarding the use of web services and APS.NET applications. Right now we have an application that uses web services to...
8
1882
by: Jon Maz | last post by:
Hi, I'm facing a code-optimisation issue on an asp.net/vb.net/SQL Server 2000 project. A web page containing not much more than 3 DropDownLists is taking nigh on 6 seconds to load, because each...
3
6368
by: Merlin | last post by:
Hi there, I am trying to create a form with an dynamic field that can be shown or hidden. As I saw for example on google it is possible with JS to show a layer and move the content underneath...
2
2343
by: dkode | last post by:
Hello, I am laying out the architecture for a very large website that will scale to a very large degree. I have a couple of questions before I attempt to go and implement a Broker/Persistence...
1
1600
by: rbg | last post by:
Hi, I am trying to understand the layering concept with the ASP.NET 2.0 apps. I have a ASP.NET 2.0 Web app which has 3 layers Presentation layer which contains UI elements and Input...
16
8998
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
2
1911
by: Ily | last post by:
Hi all I am using Visual studio 2005. Im my project I have a presentation layer, a business layer and a data access layer. From my business layer i have a reference to my data layer. I also...
6
14126
by: Dhananjay | last post by:
hello everyone i have got a problem i want to design business layer, data access layer , presentation layer for asp.net using C#.net , can anyone help me to solve this problem. i want some...
0
7192
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7064
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...
0
7261
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,...
0
7315
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...
0
4665
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...
0
3158
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...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1492
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 ...
1
721
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.