Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 20 results for
stdvector
- Page 1
Vector Question
Programming
Software Development
17 Years Ago
by Jennifer84
… would look like this: [code]std::vector<string>
StdVector
;
StdVector
[0] = "comboBox1->SelectedItem->ToString()"; [/code] My…;comboBox1->SelectedItem->ToString()"[/COLOR] out ? [code] Box1 =
StdVector
[0]; [/code]
Undefined behaviour accessing uninitialised data?
Programming
Software Development
11 Years Ago
by triumphost
…**`. My results were: http://stackoverflow.com/questions/20863478/class-using-
stdvector
-allocation-slower-than-pointer-allocation-by-a-lot Now I…
Re: vector operations
Programming
Software Development
14 Years Ago
by jonsca
You can use an iterator for what you are trying to describe (see the second post of [url]http://stackoverflow.com/questions/3221812/sum-of-elements-in-a-
stdvector
[/url]). Or you could use std::accumulate ([url]http://www.cplusplus.com/reference/std/numeric/accumulate/[/url] or the above link)
Re: Dynamic Array Question
Programming
Software Development
12 Years Ago
by vijayan121
…/stl/article.php/c4027/C-Tutorial-A-Beginners-Guide-to-
stdvector
-Part-1.htm > I am using Dev-CPP 4…
Re: Custom Allocator for shared memory.
Programming
Software Development
12 Years Ago
by mike_2000_17
… thread](http://stackoverflow.com/questions/5958572/how-can-i-avoid-
stdvector
-to-initialize-all-its-elements/). Scott Meyers talks about allocators…
Re: "unresolved identifier 'array'" using array class
Programming
Software Development
12 Years Ago
by yxBen
…://stackoverflow.com/questions/11400090/c-why-initializer-list-behavior-for-
stdvector
-and-stdarray-are-different?rq=1) [C++ Standard Core Language…
Re: How can i edit this code to accept more than one account
Programming
Software Development
10 Years Ago
by ddanbe
If I would implement more than 3 accounts I would use a vector of Account. Here's a good [tutorial](http://www.codeguru.com/cpp/cpp/cpp_mfc/stl/article.php/c4027/C-Tutorial-A-Beginners-Guide-to-
stdvector
-Part-1.htm) about vector.
Re: Vector Question
Programming
Software Development
17 Years Ago
by vijayan121
it would be easier (and also more efficient) if you use a cliext::vector<> instead of a std::vector<> note: requires VC++ 9 (2008) [CODE]#include <cliext/vector> using namespace cliext ; // ... { // ... vector< String^ >^ vec = gcnew vector< String^ > ; vec->push_back( comboBox1->SelectedItem->…
Re: Vector Question
Programming
Software Development
17 Years Ago
by Jennifer84
Thank you. I do have Visual 9.0 2008 so this works though. I will give 2 examples of what I am doing. The first one works but what I want is to replace it with the second. Both examples compiles but the second example with the Array terminates the program when I am running it. I keep wonder why and what the differences are ? As seen I am doing…
Re: Vector Question
Programming
Software Development
17 Years Ago
by vijayan121
[CODE]#include <cliext/vector> using namespace cliext ; // ... // create an [COLOR="Red"]empty[/COLOR] vector cliext::vector< String^ >^ Box1 = gcnew cliext::vector< String^ >; // this will not work; [COLOR="Red"]there is no space in the vector[/COLOR] // [COLOR="Red"]Box1[0][/COLOR] = comboBox1->…
Re: Vector Question
Programming
Software Development
17 Years Ago
by Jennifer84
Thanks, vijayan121. That did work fine ! I forgot about the space that you mentioned also.
Re: Vector Question
Programming
Software Development
17 Years Ago
by Jennifer84
I have a wondering here. Is it correct to do pushback like this: [code] Box1->push_back( comboBox1->SelectedItem->ToString() ) ; Box1->push_back( comboBox2->SelectedItem->ToString() ) ; [/code] Do comboBox1 get place Box1[0] and do comboBox2 get place Box1[1] in this case when writing them under eachother like this ?…
Re: Vector Question
Programming
Software Development
17 Years Ago
by mitrmkar
Could it be that comboBox2->SelectedItem is a NULL reference? Calling Box1->push_back() like you do is OK.
Re: Vector Question
Programming
Software Development
17 Years Ago
by Jennifer84
Yes it was depending on that. The selected Item was a NULL reference. I changed SelectedTiem to this instead and then it is ok if it is a "NULL reference" [code] Box1->push_back( comboBox2->Text->ToString() ) ; [/code] [QUOTE=mitrmkar;547201]Could it be that comboBox2->SelectedItem is a NULL reference? Calling Box1…
Re: Undefined behaviour accessing uninitialised data?
Programming
Software Development
11 Years Ago
by Moschops
What do you mean by "access" in this context?
Re: Undefined behaviour accessing uninitialised data?
Programming
Software Development
11 Years Ago
by mike_2000_17
> Why is accessing data in an uninitialised array undefined behaviour? It's not really clear whether this is undefined behavior or not. If you **read** uninitialized data, you will read a garbage value, i.e., whatever arbitrary combination of bits that happens to be in that memory location at the time of the allocation. That's what's going to …
Re: Undefined behaviour accessing uninitialised data?
Programming
Software Development
11 Years Ago
by deceptikon
> Why is accessing data in an uninitialised array undefined behaviour? It really depends on where the array is defined. If it's a local array then it's undefined behavior just as accessing an uninitialized variable is undefined behavior. The contents of the array are indeterminate, which is the "official" reason for the undefined …
Re: Undefined behaviour accessing uninitialised data?
Programming
Software Development
11 Years Ago
by triumphost
I was just using the array as a matrix. I don't mind indeterminate values at all if I access an array with no initial value. I just don't want my program crashing or me doing something unsafe because of some undefined behaviour that I don't understand. I don't know why accessing an uninitialised array would be undefined. I understand indeterminate…
Re: Undefined behaviour accessing uninitialised data?
Programming
Software Development
11 Years Ago
by deceptikon
> I don't mind indeterminate values at all if I access an array with no initial value. I just don't want my program crashing because of some undefined behaviour that I don't understand. Those two sentences are contradictory. > I don't understand traps by just looking at it either. Imagine calling `abort`, but without the happy result for a…
Re: Undefined behaviour accessing uninitialised data?
Programming
Software Development
11 Years Ago
by mike_2000_17
> The contents of the array are indeterminate, which is the "official" reason for the undefined behavior. There is obviously a gray zone between indeterminate values and undefined behavior. If it wasn't for trap representations (which I doubt still exist on any hardware at all), there would really be no reason why reading a variable …
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
Backlink Auditor
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC