473,624 Members | 2,252 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 1283
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<intSomeT ype;
typedef vector<SomeType SomeName;
typedef vector<SomeName SomeOtherName;

Ali
Jun 27 '08 #3
kathy <yq*****@yahoo. comwrote in news:aa8083cf-1554-40fc-b13f-
32**********@z2 4g2000prf.googl egroups.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**********@z2 4g2000prf.googl egroups.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**********@z2 4g2000prf.googl egroups.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.d udewrote in
news:1r******** *********@nlpi0 68.nbdc.sbc.com :
Joe Greer wrote:
>kathy <yq*****@yahoo. comwrote in news:aa8083cf-1554-40fc-b13f-
32**********@z2 4g2000prf.googl egroups.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...@com Acast.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 objektorientier ter Datenverarbeitu ng
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
1929
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 4.8 browser doesn't deal well with the <iframe> so I wrapped the code that generates the <iframe> in <ilayer> tags. NN now recognizes the contents. However within each of the 'content' files I have another javascript routine that basically...
2
2207
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 access the database layer. However, the code works in a pretty cumbersome and ungeneric way. Basically every query, update, and insert has its own function. So you see a lot of functions like webService.InsertCustomer(name, age, phone); or...
8
1892
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 ddl opens up a separate connection to the DB, pulls out its data, and closes its own connection before the next ddl repeats the process. The code to handle each DDL's connection to the DB is packaged in an object (presentation-layer code...
3
6389
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 that layer further down uppon showing this layer. When a person closes that layer the content underneath the layer moves up again and closes the empty space. How is this possible? I am playing around with some code I am posting with this thread....
2
2351
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 Layer. 1. With a broker layer, does this layer sit at the same level as the Business Layer? So to speak, the presentation layer has knowledge of
1
1611
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 validation logic
16
9017
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
1921
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 have a refeence to my business layer from my presentation layer. Now the weird thing is, I can create a form, and I can add a using
6
14145
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 resources to complete this. i am trying very hard. Do you have any idea about website or any links where i can find some examples based on this concept.can you plz provide me , its urgent i want this solution with an example, if u have plz provide me. ...
0
8177
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8681
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8341
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4084
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4183
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2611
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
1793
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.