Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Sepples Magic

Name: Anonymous 2011-02-23 21:22


#include <string>
#include <vector>
#include <iostream>

std::vector<std::string> names;

void addNames()
{
    names.push_back(std::string("Foo"));
    names.push_back(std::string("Bar"));
}

int main(int argc, char **argv)
{
    addNames();
   
    for (int i = 0, size = names.size(); i < size; ++i)
    {
        std::cout << names[i] << std::endl;
    }

    return 0;
}


Output:

Foo
Bar


Okay so what I'm trying to understand is since I'm pushing anonymous stack string objects onto the vector, I'm assuming that the strings will also have their destructors called (because local variables). This should also destroy the internal char sequence.

Yet the strings remain intact when printing the vector (so somehow its being copied?). So /prog/ please show me your sepples mastery and explain the magic here.

Name: Anonymous 2011-02-24 6:39

>>
"There are so many steps involved in tweaking the last uumph out of your linux system- and it really is a work of art to pull it off- I have used many different kernels and all sorts of optimization combinations-yesterday I finally used -noatime and -notail for my reiserfs file system: The single biggest performance boost I have yet to see-now I can have gnome2.2 running using gnome-terminal to compile the latest j2sdk from source (nice -n 19)while browsing with mozilla while running e17 in a seperate login with two eterms and run Unreal Tournament at full speed (this with an apache webserver running for my dyndns pseudo-domain and a mysql for my answering-machine software for my isdn card-which keeps track of all incomming phonecalls and manages my telephone book app and ntfsd/sshd/dhcp server/squid)..."
VROOM!! VROOOM!!!!

Name: Anonymous 2011-02-24 8:13

>>11
DUBZ JUST KICKED IN YO
VROOOOOOOOOMVROOOOOOOOM

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List