X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2Ftype_traits.hh;h=910b4e4c94771ec7ded41c6cc3562115554907f6;hb=0e83cd2ee1ebc409cf73d8774b01bf01f3df22f4;hp=19b234521ed1fa64c18674ad5b516dc658d554de;hpb=3fe2ed38b800bcb57afff676698462e763724245;p=senf.git diff --git a/senf/Utils/type_traits.hh b/senf/Utils/type_traits.hh index 19b2345..910b4e4 100644 --- a/senf/Utils/type_traits.hh +++ b/senf/Utils/type_traits.hh @@ -243,6 +243,15 @@ namespace senf : public boost::remove_cv< typename boost::remove_reference::type > {}; + /** \brief Get arity of function T + + \a T may be any function like type: function, pointer to function or (pointer to) + member-function. + + \code + BOOST_STATIC_ASSERT(( senf::function_arity::value == 1 )); + \endcode + */ template < class T > struct function_arity : public boost::integral_constant< @@ -251,6 +260,28 @@ namespace senf typename senf::remove_any_pointer::type>::arity> {}; + /** Test object if it is any \c std::pair type + + if \a Pair is any \c std::pair type, this trait will inherit from \c boost::true_type, + otherwise it will inherit from \c boost::false_type. + + \code + BOOST_STATIC_ASSERT(( senf::is_pair< std::pair >::value )); + BOOST_STATIC_ASSERT(( ! senf::is_pair< void () >::value )); + \endcode + */ + template + struct is_pair + : public boost::false_type + {}; + +#ifndef DOXYGEN + template + struct is_pair< std::pair > + : public boost::true_type + {}; +#endif + ///} #ifndef DOXYGEN