[ create a new paste ] login | about

Link: http://codepad.org/j9G52Abp    [ raw code | output | fork ]

C++, pasted on Jan 8:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <string>

std::string foo()
{
   std::string s("rvo!");
   std::cout << "address: " << (void *)(&s) << std::endl;
   return s;
}

int main()
{
   const std::string s = foo();
   std::cout << "address: " << (void *)(&s) << std::endl;
   std::cout << s << std::endl;
   return 0;
}


Output:
1
2
3
address: 0xbf7fda64
address: 0xbf7fda98
rvo!


Create a new paste based on this one


Comments: