#ifndef KUODO_TYPES_ASSERT_HPP
#define KUODO_TYPES_ASSERT_HPP
namespace kuodo { namespace types {
///
/// has enum member assert only if if_ is true
/// - used by types::assert
/// - useful for types::type_assert
template<bool if_> struct
assertion
{ enum { assert }; };
template<> struct
assertion<false>
{};
// assert
/////////////////////////////////////////////////////////////////////
/// compiler error if if_ is false.
/// \code
///
/// typedef types::assert<sizeof(some_type) != 4> myassert;
///
/// // compiler error like:
/// // file.hpp:123: error: 'assert' is not a member of 'kuodo::types::assertion<false>'
///
/// \endcode
///
/// see
/// - types::assertion
/// - types::type_assert
template<int if_, int assert_ = assertion<if_ != 0>::assert> struct
assert {};
// type_assert
/////////////////////////////////////////////////////////////////////
/// compiler error if if_ does not have compile-time int member assert.
/// \code
///
/// template<typename type_> struct
/// void_is_wrong
/// { enum { assert }; };
/// template<> struct
/// void_is_wrong<void>
/// {};
///
/// typedef types::type_assert<void_is_wrong<some_type> > myassert;
///
/// // compiler error like:
/// // file.hpp:123: error: 'assert' is not a member of 'void_is_wrong<void>'
///
/// \endcode
///
/// see
/// - types::assertion (useful as base-class to if_)
/// - types::assert
template<typename if_, int assert_ = if_::assert> struct
type_assert {};
} } //namespace kuodo::types
#endif //KUODO_TYPES_ASSERT_HPP