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

    Using a Context Menu on a Control

    Introduction One of the primary characteristics of a control is to make its role appear obvious to t...
  • 2014-07-16 andrew

    MFC Dialog프레임 바꾸기

    윈도우의 프레임은 윈도우의 경계를 나타내면서 동시에 손쉽게 윈도우의 크기를 변경할 때도 쓰인다. 이 프레임을 제거하면, 윈도우 경계지점에 마우스 포인터를 위치하고 드래그하며 윈도우...
« 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