Utils/Console: generic ArgumentTraits::str() quoting
[senf.git] / senf / Utils / type_traits.hh
index 8f58122..910b4e4 100644 (file)
@@ -243,6 +243,15 @@ namespace senf
         : public boost::remove_cv< typename boost::remove_reference<T>::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<void (Class::*)(int)>::value == 1 ));
+        \endcode
+     */
     template < class T >
     struct function_arity
         : public boost::integral_constant<
@@ -251,6 +260,28 @@ namespace senf
                   typename senf::remove_any_pointer<T>::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<int,void*> >::value ));
+        BOOST_STATIC_ASSERT(( ! senf::is_pair< void () >::value ));
+        \endcode
+     */
+    template <class Pair>
+    struct is_pair
+        : public boost::false_type
+    {};
+
+#ifndef DOXYGEN
+    template <class First, class Second>
+    struct is_pair< std::pair<First,Second> >
+        : public boost::true_type
+    {};
+#endif
+
   ///}
 
 #ifndef DOXYGEN
@@ -269,8 +300,8 @@ namespace senf
 //#include "type_traits.ct"
 //#include "type_traits.cti"
 #endif
-\f
 
+\f
 // Local Variables:
 // mode: c++
 // fill-column: 100