My Project
nullptr_emulation.h
1 /*-----------------------------------------------------------------------
2 From Scott Meyers C++ book
3 -----------------------------------------------------------------------*/
4 
5 #pragma once
6 
7 #if __cplusplus < 201103L
8 
9 const // It is a const object...
10 class nullptr_t
11 {
12  public:
13  template<class T>
14  inline operator T*() const // convertible to any type of null non-member pointer...
15  { return 0; }
16 
17  template<class C, class T>
18  inline operator T C::*() const // or any type of null member pointer...
19  { return 0; }
20 
21  private:
22  void operator&() const; // Can't take address of nullptr
23 
24 } nullptr = {};
25 
26 #endif
Definition: nullptr_emulation.h:10