One concept that is often useful in many types is a contextual conversion to bool. The following expressions should be valid with the concept:
if (o) {}
if (!o) {}
template <typename O>
bool test(O&& o) { return o; }
Add a predefined concept that catches these requirement. A possible implementation:
namespace boost { namespace type_erasure {
template<class T>
struct testable
{
static bool apply(const T& arg)
{ return bool(arg); }
};
template<class T, class Base>
struct concept_interface<testable<T>, Base, T> : Base
{
explicit operator bool () const
{ return call(testable<T>(), *this); }
};
}}
One concept that is often useful in many types is a contextual conversion to bool. The following expressions should be valid with the concept:
Add a predefined concept that catches these requirement. A possible implementation: