Programming

(C++) shared_ptr

steloflute 2012. 7. 10. 17:33

 

#include <tr1/memory>
#include <cstdio>
using namespace std;
using namespace std::tr1;

 

int main() {
  shared_ptr<int> a(new int(3));
  shared_ptr<int> b;

 

  printf("%d %d\n", *a, a.use_count());
  //printf("%d\n", *b); // seg fault
}

 

'Programming' 카테고리의 다른 글

(C) How do I share variables between different .c files?  (0) 2012.07.14
enum Types in C++  (0) 2012.07.13
Online syntax highlighting  (0) 2012.07.10
C++ reference type  (0) 2012.07.10
Classic Nintendo Games are (NP-)Hard  (0) 2012.07.09