Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::type_info_wrapper Class Reference

A simple std::type_info wrapper that implements value semantic for type information objects. More...

#include <type_info_wrapper.hpp>

Public Member Functions

 type_info_wrapper () BOOST_NOEXCEPT
 Default constructor. More...
 
 type_info_wrapper (type_info_wrapper const &that) BOOST_NOEXCEPT
 Copy constructor. More...
 
 type_info_wrapper (std::type_info const &that) BOOST_NOEXCEPT
 Conversion constructor. More...
 
std::type_info const & get () const BOOST_NOEXCEPT
 Stored type info getter. More...
 
void swap (type_info_wrapper &that) BOOST_NOEXCEPT
 Swaps two instances of the wrapper. More...
 
std::string pretty_name () const
 The method returns the contained type name string in a possibly more readable format than get().name() More...
 
bool operator! () const BOOST_NOEXCEPT
 
bool operator== (type_info_wrapper const &that) const BOOST_NOEXCEPT
 Equality comparison. More...
 
bool operator< (type_info_wrapper const &that) const BOOST_NOEXCEPT
 Ordering operator. More...
 

Detailed Description

A simple std::type_info wrapper that implements value semantic for type information objects.

The type info wrapper is very useful for storing type information objects in containers, as a key or value. It also provides a number of useful features, such as default construction and assignment support, an empty state and extended support for human-friendly type names.

Constructor & Destructor Documentation

boost::type_info_wrapper::type_info_wrapper ( )
inline

Default constructor.

Postcondition
!*this == true
boost::type_info_wrapper::type_info_wrapper ( type_info_wrapper const &  that)
inline

Copy constructor.

Postcondition
*this == that
Parameters
thatSource type info wrapper to copy from
boost::type_info_wrapper::type_info_wrapper ( std::type_info const &  that)
inline

Conversion constructor.

Postcondition
*this == that && !!*this
Parameters
thatType info object to be wrapped

Member Function Documentation

std::type_info const& boost::type_info_wrapper::get ( ) const
inline

Stored type info getter.

Returns
true if the type info wrapper was initialized with a particular type, false if the wrapper was default-constructed and not yet initialized
Precondition
!!*this
Returns
Constant reference to the wrapped type info object
bool boost::type_info_wrapper::operator! ( ) const
inline
Returns
false if the type info wrapper was initialized with a particular type, true if the wrapper was default-constructed and not yet initialized
bool boost::type_info_wrapper::operator< ( type_info_wrapper const &  that) const
inline

Ordering operator.

Precondition
!!*this && !!that
Parameters
thatComparand
Returns
true if this object wraps type info object that is ordered before the type info object in the comparand, false otherwise
Note
The results of this operator are only consistent within a single run of application. The result may change for the same types after rebuilding or even restarting the application.
bool boost::type_info_wrapper::operator== ( type_info_wrapper const &  that) const
inline

Equality comparison.

Parameters
thatComparand
Returns
If either this object or comparand is in empty state and the other is not, the result is false. If both arguments are empty, the result is true. If both arguments are not empty, the result is true if this object wraps the same type as the comparand and false otherwise.
std::string boost::type_info_wrapper::pretty_name ( ) const
inline

The method returns the contained type name string in a possibly more readable format than get().name()

Precondition
!!*this
Returns
Type name string

References boost::core::demangle().

Referenced by boost::to_string().

void boost::type_info_wrapper::swap ( type_info_wrapper that)
inline

Swaps two instances of the wrapper.


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