Skip to content

Commit

Permalink
Yet another null check
Browse files Browse the repository at this point in the history
  • Loading branch information
rollbear committed Dec 13, 2019
1 parent 9993001 commit 78b7e8b
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions include/trompeloeil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,8 +1054,18 @@ template <typename T>
};

struct indirect_null {
template <typename T, typename R = decltype(nullptr == std::declval<T const&>())>
R operator==(T const&) const;
template <typename T, typename C, typename ... As>
using memfunptr = T (C::*)(As...);
template <typename T>
operator T*() const;
template <typename T>
operator T**() const;
template <typename T, typename C>
operator T C::*() const;
template <typename T, typename C, typename ... As>
operator memfunptr<T,C,As...> () const;

operator std::nullptr_t() const;
};

template <typename T, typename U>
Expand Down Expand Up @@ -1246,6 +1256,15 @@ template <typename T>
}
}

inline
void
print(
std::ostream& os,
std::nullptr_t)
{
os << "nullptr";
}

inline
constexpr
auto
Expand Down

0 comments on commit 78b7e8b

Please sign in to comment.