From cad2977e4eeb9f2d0752a09bc286e56c4bbd74c8 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 21 Oct 2018 20:21:28 +0200 Subject: [PATCH] Add Traits::HasOperatorBool --- misc/traits.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/misc/traits.h b/misc/traits.h index 20a630c..f1aac92 100644 --- a/misc/traits.h +++ b/misc/traits.h @@ -131,6 +131,9 @@ CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK(IsReservable, std::declval().reserve /// \brief Evaluates to Bool if the specified type can has a resize() method; otherwise evaluates to Bool. CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK(IsResizable, std::declval().resize(0u)); +/// \brief Evaluates to Bool if the specified type has operator bool(); otherwise evaluates to Bool. +CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK(HasOperatorBool, std::declval() ? true : false); + /// \brief Evaluates to Bool if the specified type is iteratable (can be used in for-each loop); otherwise evaluates to Bool. CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK(IsIteratable, // begin/end and operator !=