ChessPlusPlus  WIP
cplusplus.com Community Project
chesspp::util_ops Namespace Reference

Functions

template<typename T , typename U >
auto operator!= (T const &t, U const &u) noexcept(noexcept(!(t==u))) -> typename std::enable_if< std::is_base_of< T, U >::value||std::is_base_of< U, T >::value, decltype(!(t==u)) >::type
 
template<typename T >
bool operator== (std::unique_ptr< T > const &up, T const *p) noexcept(noexcept(up.get()==p))
 
template<typename T >
bool operator== (T const *p, std::unique_ptr< T > const &up) noexcept(noexcept(p==up.get()))
 

Function Documentation

template<typename T , typename U >
auto chesspp::util_ops::operator!= ( T const &  t,
U const &  u 
) -> typename std::enable_if < std::is_base_of<T, U>::value || std::is_base_of<U, T>::value, decltype(!(t == u)) >::type
noexcept

Alternative global operator!=. Smarter template than the one in ::std::rel_ops, supports inheritance and non-bool return type.

Template Parameters
Tthe left-hand type.
Uthe right-hand type.
Parameters
tthe left-hand value.
uthe right-hand value.
Returns
!(t == u)
template<typename T >
bool chesspp::util_ops::operator== ( std::unique_ptr< T > const &  up,
T const *  p 
)
noexcept

Allows comparison of std::unique_ptr and pointer.

Template Parameters
Tthe type that std::unique_ptr wraps
Parameters
upthe std::unique_ptr
pthe pointer
template<typename T >
bool chesspp::util_ops::operator== ( T const *  p,
std::unique_ptr< T > const &  up 
)
noexcept

Allows comparison of std::unique_ptr and pointer.

Template Parameters
Tthe type that std::unique_ptr wraps
Parameters
pthe pointer
upthe std::unique_ptr