CppCMS
operator_bool.h
1 // This header intentionally has no include guards.
2 //
3 // Copyright (c) 2001-2009 Peter Dimov
4 //
5 // Distributed under the Boost Software License, Version 1.0.
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
8 
9 
10  typedef T * this_type::*unspecified_bool_type;
11 
12  operator unspecified_bool_type() const // never throws
13  {
14  return px == 0? 0: &this_type::px;
15  }
16 
17  // operator! is redundant, but some compilers need it
18  bool operator! () const // never throws
19  {
20  return px == 0;
21  }