Jonathon-
Jonathan Mcdougall wrote:
[snip]
FYI, I've been here since the start and I answered your questions.
I know you did. I acknowledged that. My thanks were genuine. I just
don't think my question was that broad to get painted with the RTFM
brush. You proved that by answering it with like maybe 20 lines of code.
Yes, I need to do some reading to use this further. But Jeez, lighten up
on people.
Look on Google, it archives all posts, maybe you missed one. Note
that it may take up to 8h for a post to appear there.
I didn't miss any posts, I can see the whole thread here in my news
reader. I DID miss a few smiley's of yours and probably wouldn't have
given YOU any sass if I'd seen them.
This kind of statement ("as this group isn't about helping people.")
is useless and only makes everybody angry. Please, try to
stay polite and think about what you write.
Is calling me a jackass, polite? (Not you - Brian Rodenborn aka
Default_User).
That statement was made as a sarcastic comment on Atilla's behaviour as
newsgroup nazi. I just don't like being shit upon, especially by a herd.
[snip]
But never, _never_ ask a question implying that
you don't have the time to do something so you're asking others.
This is obviosly a terrible crime. Possibly a felony. Please add this
very important requirement to the FAQ so I or others like me who
actually have to do things in life won't make this terrible mistake
again.
It is.
http://www.parashift.com/c++-faq-lite/how-to-post.html
I looked but I'm not sure I see that in the faq.
[snip]
That was to be taken with a smile. I think irony does not travel well
by internet.
You're right. It doesn't. I missed the smiley, missed 2 of 'em I think.
Most seemed to have missed my ironies.
Since I've managed to insult 2 fully qualified C++ experts on this
[snip]
That was a joke, noticed the smiley?
Missed it. Sorry.
Well go for it and stop saying these things!! This discussion is *useless*,
people are here to help other people, not to talk like that. So please,
and this applies to *everyone* including me, shut the **** up, let's
forget that thread, and let's start a new one about std::vectors, ok ?
I'm getting tired of that shit.
<snipped>
Jonathan
OK, I'll bite (that's how I got into several people's kill files to
begin with)
it seems to me that using this std::vector class to instantiate an array
of class objects isn't too efficient. In C you declare (and allocate
memory for) an array in one shot, then use very efficient direct
addressing (subscript notation, not ptr) to access the array members.
Unfortunately, the array is not dynamically resizeable, so limited in
usage (from my perspective) - I prefer linked lists, usually when I use
an array it's strictly for efficiency. In VB of course, arrays are
resizeable (redim). The MFC CArray class creates an empty array that is
then settable to a number of elements using CArray::SetSize(). So in a
possible implementation for me I could instantiate an array, set it to
some reasonable size, then fetch data into it and if the reasonable size
is exceeded I could use CArray::SetAtGrow() or CArray::Add() to grow the
array record by record. Microsoft claims that using CArray::GetAt() &
CArray::SetAt() to access the array members (each in this case a class)
is just as efficient as the direct addressing of C language.
Now, I DID RTFM as far as the a.pop_back() that you had included in your
snippet, I'm not sure I understand why, but id does solve the problem I
immediately saw of an empty element at .last. I still see (under a
debugger) an empty at .end - not sure if this is a problem. Here's where
a RTFM comment is warranted. What I'm curious about now is I don't see
any way to batch allocate an array (vector) of a certain size - it's
certainly clear that using your method will work, but it grows the array
a record at a time - that seems inefficient compared to the MFC
implementation and certainly compared to raw C arrays. Am I missing
something? Or id this just a tradeoff situation?
Mike