Thread: STL functions to resize containers

  1. #16
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    You know that `std::vector<???>::erase(???)` calls a destructor, yet you claim that to resize is to reallocate and the distinction isn't useful?

    An array is indeed some number of elements whether stored on the heap or not, but you seem to be either missing or ignoring the fact that memory allocated for elements isn't the same thing as the elements existing.
    Yeah, I was ignoring it. I thought I was being helpful by not diving into gory details that I don't think get to the point of the question.

    I needed a lecture on placement new just to prove how apparently wrong I am.

    std::fstream * s(new std::fstream[8]);
    8 objects exist.

    (s + 7)->~fstream();How many elements of `std::fstream` exist?
    7 objects exist.

    new(s + 7) fstream();
    8 objects exist.

    You, at one point, have an array of only seven elements despite allocating memory for eight elements.
    Right, now please tell me if sean contab will care or understand.

    The distinction is useful for the STL containers in particular because of how each implies validity of iterators after the relevant operation.
    Guess what we weren't talking about until Galik showed up.

    But whatever... the gory details are out, please continue. I'm dumb, just like everybody apparently wanted. Thank you ........ you bye.

  2. #17
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    I thought I was being helpful by not diving into gory details that I don't think get to the point of the question.
    O_o

    You chose to make misleading statements without simply stating "I'm glossing over the gory details, but..." or similar?

    Right, now please tell me if sean contab will care or understand.
    Okay. If sean contab wants to avoid the misunderstanding of object lifetimes that still plague MutantJohn, they will certainly care and make an effort to understand.

    Now, please tell me if sean contab will be the only person to ever read the thread.

    For example, do you think Galik will read the thread?

    I only ask because the comments I took issue with was a response to Galik, not sean contab, who seems rather interested.

    Guess what we weren't talking about until Galik showed up.
    o_O

    Really?

    *shrug*

    Well guess what, Galik apparently thought that further discussing the semantics of resizing arrays was appropriate.

    You want to ding Galik for the necropost? Fine, but when did you become afraid of discussing semantically related issues?

    If Galik had started a new thread, what would you have done?

    I'm dumb, just like everybody apparently wanted.
    Strangely, I don't want anyone to be dumb... which is why I posted regarding arguably misleading statements.

    Thank you ........ you bye.
    You're welcome. Bye.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  3. #18
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    You chose to make misleading statements without simply stating "I'm glossing over the gory details, but..." or similar?
    Apparently.


    Hopefully you don't think too badly of me for it. I doubt I'll live it down now.


    Now, please tell me if sean contab will be the only person to ever read the thread.


    For example, do you think Galik will read the thread?


    I only ask because the comments I took issue with was a response to Galik, not sean contab, who seems rather interested
    If you really want to know the truth as I see it, I think the thread will die and sink to the depths only a word-for-word google query will find after we all shut up. Like the day you decide to link to the thread just to jog everyone's memory of that time we delved into pedantry. I don't think Galik will read the thread again since he brought up the topic I was "misleading" people about.


    Well guess what, Galik apparently thought that further discussing the semantics of resizing arrays was appropriate.


    You want to ding Galik for the necropost? Fine, but when did you become afraid of discussing semantically related issues?


    If Galik had started a new thread, what would you have done?
    You know things would have gone a lot better if you didn't teach people like you were ........ting on them off such a high cliff. How long are you going to berate me for an oversight which you heroically correc--wait, Galik did, that was Galik. The lecture is over professor, let me go home and do my homework, now, please.

  4. #19
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Sorry, man, all I meant was that if you were just looking at destructors getting called, it might mean that a delete call happened. It's the whole duck-typing thing. If it quacks like a duck and sounds like a duck then it might just be. I assumed whiteflags was conflating destructors being called with a delete + new combo.

  5. #20
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    You know things would have gone a lot better if you didn't teach people like you were ........ting on them off such a high cliff.
    O_o

    I don't, and I'm not going to apologize for how you choose to interpret my post.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Containers
    By Ghostrider in forum C++ Programming
    Replies: 29
    Last Post: 10-18-2015, 10:33 PM
  2. Map containers
    By Know_Your_Role in forum C++ Programming
    Replies: 17
    Last Post: 06-15-2009, 07:48 AM
  3. Covariance with virtual functions and stl containers
    By cunnus88 in forum C++ Programming
    Replies: 4
    Last Post: 04-01-2009, 07:26 AM
  4. bind on member functions of stl containers
    By synss in forum C++ Programming
    Replies: 3
    Last Post: 07-03-2008, 04:38 AM
  5. Question about containers use
    By Mortissus in forum C++ Programming
    Replies: 6
    Last Post: 02-15-2005, 02:25 PM

Tags for this Thread