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-16 andrew

    [MFC] 자신의 IP정보 가져오기(Local, gateway 등) – GetAdaptersInfo

    ARP 모듈에서 스푸핑 기능사용 시 Local IP와 gateway IP를 수동으로 적자니 귀찮아서 자동 입력으로 수정함. 이에 따라 추가 코드가 발생했는데....   자...
  • 2014-12-26 andrew

    [펌] __cdecl, __pascal, __stdcall 의 차이에 관한 정리

    함수호출 방식이 __cdecl, __pascal, __stdcall로 여러 가지가 있는 이유는 윈도우즈의 역사성에 있다. 우선 win16에서는 실행파일의 크기가 줄어들고 속도가 빠...
« 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