libsigc++  2.4.1
Classes | Static Public Attributes | List of all members
sigc::is_base_and_derived< T_base, T_derived > Struct Template Reference

Compile-time determination of base-class relationship in C++ (adapted to match the syntax of boost's type_traits library). More...

#include <sigc++/type_traits.h>

Static Public Attributes

static const bool value
 

Detailed Description

template<class T_base, class T_derived>
struct sigc::is_base_and_derived< T_base, T_derived >

Compile-time determination of base-class relationship in C++ (adapted to match the syntax of boost's type_traits library).

Use this to provide a template specialization for a set of types. For instance,

template < class T_thing, bool Tval_derives_from_something = sigc::is_base_and_derived<Something, T_thing>::value >
class TheTemplate
{
//Standard implementation.
}
//Specialization for T_things that derive from Something (Tval_derives_from_something is true)
template <class T_thing>
class TheTemplate<T_thing, true>
{
T_thing thing;
thing.method_that_is_in_something();
}

sigc::is_base_and_derived<> is used internally in libsigc++. If you need such a template class elsewhere, and you have a C++11 compiler, std::is_base_of<> is recommended.

Member Data Documentation

template <class T_base , class T_derived >
const bool sigc::is_base_and_derived< T_base, T_derived >::value
static