|
I understand princips of programming, but i don't understand usage of syntax well, i have read a book, but still it's not enaught to uderstand and get into programming for 100% i need to learn much and most of veterans are stil learning, so suite your self.
|
|
|
|
|
toxcct wrote: check your mails and read the thread. you already got all the answers to your questions
Send him to the SoapBox and I will take care of him
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
i give up. he is yours !!
|
|
|
|
|
and what??
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Programm3r wrote: and what??
That's exacly what I wanted to know. You replied to me with, "I was using revvy's code ... for a simple example ... thats all" which made no sense whatsoever.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hello,
I just wanted to know what happens if a vector is stored with objects of different sizes.
Will some ambiguous memory problems arise ?
Should I take care while assigning values to vectors that the objects should have constant menory sizes?
Prithaa
|
|
|
|
|
prithaa wrote: Will some ambiguous memory problems arise ?
not that i am aware of...
i used to use vectors of my own classes, containing different variable sizes members, and i didn't notice any memory problems anyway
a good example to test that is by creating a std::vector<std::string> . strings can have different sizes, but the vector still works, doesn't it ?
|
|
|
|
|
Hello,
Thanks.
I was particularly concerned about CStrings.
Now that you say it works then I will go ahead.
Prithaa
|
|
|
|
|
prithaa wrote: Now that you say it works then I will go ahead.
i didn't
I just said that i wasn't aware of it :->
but the best you can do is testing it to be sure... it's the only way to really know
|
|
|
|
|
toxcct wrote: i used to use vectors of my own classes, containing different variable sizes members...
But the classes themselves were the same size. I think what he was referring to was something like:
vector v;
int n;
float f;
char c;
v.push_back(n);
v.push_back(f);
v.push_back(c); I would never think of doing something like this so I don't know of the ramifications.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: I think what he was referring to was something like...
prithaa wrote: I was particularly concerned about CStrings.
it doesn't look like
|
|
|
|
|
toxcct wrote: a good example to test that is by creating a std::vector <std::string>.
Really good example
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Yes it works.. If you're using it as a dynamic vector, it's probably a little harder for STL to allocate the right amount of memery as the vector grows. The won't cause any problems, but of you have any idea how much space you're going to use, you can always use the reserve() function to allocate upfront.
|
|
|
|
|
i usually do it like that, and never made use of reserve(), so i think your statement is false
|
|
|
|
|
webHamlet wrote: ...you can always use the reserve() function to allocate upfront.
What does using reserve() have to do with the subject? Using reserve() is performance-related.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
toxcct wrote: a good example to test that is by creating a std::vector<std::string>. strings can have different sizes, but the vector still works, doesn't it ?
Actually a std::string is always the same size. It's the memory it manages that can vary in size. For example, it may use new to allocate a memory block and store a pointer to it in the std::string : the pointer is always the same size.
Steve
|
|
|
|
|
No problem really. But it looks a little weird to push CStrings into a vector. Did you consider using a std::string instead? or if you are so concerned about using MFC, did you have a look at CStringArray?, my personal option would be vector-std::string though.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
prithaa wrote: I just wanted to know what happens if a vector is stored with objects of different sizes.
i have used vector of vector in many of my application.. i havn't faced any problem doing so!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi all.
I have project and I need installator, sow I use Setup Wizard and add it to my project, but I dont know what hapend, it installs somting else not my project, it installs dialog window API without any control.
there isnot controls thet I add to this dialog [buttons, Icon, Editbox ,Listbox . . . ].
if you can help me.
|
|
|
|
|
david bagaturia wrote: if you can help me.
*Silently walks away*
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Mind if I tag along?
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Mark Salsbery wrote: Mind if I tag along?
Sure you can. You intend to help someone and end up reading some post like that. Pain.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Yes. Sometimes it's best to walk away
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|