E D R , A S I H C RSS

Full text search for "TreeNode"

Tree Node


Search BackLinks only
Display context of search results
Case-sensitive searching
  • MoreEffectiveC++/Techniques1of3 . . . . 18 matches
         auto_ptr<TreeNode> ptn1(new TreeNode);
         auto_ptr<TreeNode> ptn2 = ptn1; // 복사 생성자를 호출했다. 어떤 일이 일어날까?
         auto_ptr<TreeNode> ptn3;
         void printTreeNode(ostream& s, auto_ptr<TreeNode> p)
          auto_ptr<TreeNode> ptn(new TreeNode);
          printTreeNode(cout, ptn); // 값에 의한 전달(pass auto_ptr by value)
         printTreeNode에게 auto_ptr<TreeNode> 형인 ptn이 값에 의한 전달(by-value)로 전달 되므로, printTreeNode가 수행되기전에 임시 객체가 생성되고 거기에 ptn이 복제 된다. 이때 불리는 복사 생성자(copy constructor)는 가지고 있는 더미(dumb) 포인터를 넘기는 소유권(ownership) 이양 작업을 하게되고, printerTreeNode가 마친뒤에 해당 객체는 삭제되고, ptn은 0(null)로 초기화 되어 진다. auto_ptr을 잃어 버린 것이다.
         // 직관적인 예제이다. auto_ptr<TreeNode>를 상수 참조 전달(Pass-by-reference-to-const)하였다.
         void printTreeNode(ostream& s, const auto_ptr<TreeNode>& p)
         SmartPtr<TreeNode> ptn;
         SmartPtr<TreeNode> ptn;
Found 1 matching page out of 7540 total pages (5000 pages are searched)

You can also click here to search title.

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
Processing time 0.2869 sec