Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::typeindex::type_index_facade< Derived, TypeInfo > Class Template Reference

This class takes care about the comparison operators, hash functions and ostream operators. More...

#include <type_index_facade.hpp>

Inheritance diagram for boost::typeindex::type_index_facade< Derived, TypeInfo >:

Public Types

typedef TypeInfo type_info_t
 

Public Member Functions

const char * name () const BOOST_NOEXCEPT
 Override: This function may be redefined in Derived class. More...
 
std::string pretty_name () const
 Override: This function may be redefined in Derived class. More...
 
bool equal (const Derived &rhs) const BOOST_NOEXCEPT
 Override: This function may be redefined in Derived class. More...
 
bool before (const Derived &rhs) const BOOST_NOEXCEPT
 Override: This function may be redefined in Derived class. More...
 
std::size_t hash_code () const BOOST_NOEXCEPT
 Override: This function may be redefined in Derived class. More...
 

Detailed Description

template<class Derived, class TypeInfo>
class boost::typeindex::type_index_facade< Derived, TypeInfo >

This class takes care about the comparison operators, hash functions and ostream operators.

Use this class as a public base class for defining new type_info-conforming classes.

Example:

class stl_type_index: public type_index_facade<stl_type_index, std::type_info>
{
public:
private:
const type_info_t* data_;
public:
stl_type_index(const type_info_t& data) noexcept
: data_(&data)
{}
// ...
};
Template Parameters
DerivedClass derived from type_index_facade.
TypeInfoClass that will be used as a base type_info class.
Note
Take a look at the protected methods. They are not defined in type_index_facade. Protected member functions raw_name() must be defined in Derived class. All the other methods are mandatory.
See also
'Making a custom type_index' section for more information about creating your own type_index using type_index_facade.

Member Typedef Documentation

template<class Derived, class TypeInfo>
typedef TypeInfo boost::typeindex::type_index_facade< Derived, TypeInfo >::type_info_t

Member Function Documentation

template<class Derived, class TypeInfo>
bool boost::typeindex::type_index_facade< Derived, TypeInfo >::before ( const Derived &  rhs) const
inline

Override: This function may be redefined in Derived class.

Overrides must not throw.

Returns
True if rhs is greater than this. By default compares types by raw_name().
template<class Derived, class TypeInfo>
bool boost::typeindex::type_index_facade< Derived, TypeInfo >::equal ( const Derived &  rhs) const
inline

Override: This function may be redefined in Derived class.

Overrides must not throw.

Returns
True if two types are equal. By default compares types by raw_name().
template<class Derived, class TypeInfo>
std::size_t boost::typeindex::type_index_facade< Derived, TypeInfo >::hash_code ( ) const
inline

Override: This function may be redefined in Derived class.

Overrides must not throw.

Returns
Hash code of a type. By default hashes types by raw_name().
Note
<boost/functional/hash.hpp> has to be included if this function is used.
template<class Derived, class TypeInfo>
const char* boost::typeindex::type_index_facade< Derived, TypeInfo >::name ( ) const
inline

Override: This function may be redefined in Derived class.

Overrides must not throw.

Returns
Name of a type. By default returns Derived::raw_name().

Referenced by boost::typeindex::type_index_facade< ctti_type_index, detail::ctti_data >::hash_code().

template<class Derived, class TypeInfo>
std::string boost::typeindex::type_index_facade< Derived, TypeInfo >::pretty_name ( ) const
inline

Override: This function may be redefined in Derived class.

Overrides may throw.

Returns
Human readable type name. By default returns Derived::name().

The documentation for this class was generated from the following file: