Andrew's Garage

Shrunk Expand

Primary Navigation

tip for auto_ptr with C++

1. how to test whether auto_pointer is null?

if (!myPointer.get()) {
    // do not dereference here
}

2. how to pass auto_pointer ?

std::auto_ptr<class>  ptr_class = std::auto_ptr( new class );

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related


Posted on 2015-06-10 8:09 PM by andrew Comment
📂This entry was posted in C/C++

Related Posts

  • 2014-07-09 andrew

    std::map example

    // std::map example // opposite words #include <iostream> #include <map> #include <st...
  • 2014-07-26 andrew

    [MFC] CListCtrl 을 사용한 내용 삽입

    Report 형식의 CListCtrl 에 자료 넣기 1. 컬럼을 추가한다. 2. Item을 추가한다. 3. SubItem을 추가한다. 컬럼을 추가해야, 컬럼에 텍스트를 설정해 넣을...
« how to make debug build on cmake CMAKE compile options and etc options »

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

( optional )


©2025 boots Entries RSS and Comments RSS Child theme Boots of Raindrops Theme