...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::log::type_info_wrapper — A simple std::type_info
wrapper that implements value semantic for type information objects.
// In header: <boost/log/utility/type_info_wrapper.hpp> class type_info_wrapper { public: // construct/copy/destruct type_info_wrapper() noexcept; type_info_wrapper(type_info_wrapper const &) noexcept; type_info_wrapper(std::type_info const &) noexcept; // public member functions explicit operator bool() const noexcept; std::type_info const & get() const noexcept; void swap(type_info_wrapper &) noexcept; std::string pretty_name() const; bool operator!() const noexcept; bool operator==(type_info_wrapper const &) const noexcept; bool operator<(type_info_wrapper const &) const noexcept; };
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.
type_info_wrapper
public
construct/copy/destructtype_info_wrapper() noexcept;
Default constructor
Postconditions: |
|
type_info_wrapper(type_info_wrapper const & that) noexcept;
Copy constructor
Parameters: |
|
||
Postconditions: |
|
type_info_wrapper(std::type_info const & that) noexcept;
Conversion constructor
Parameters: |
|
||
Postconditions: |
|
type_info_wrapper
public member functionsexplicit operator bool() const noexcept;
Returns: |
|
std::type_info const & get() const noexcept;
Stored type info getter
Requires: |
|
Returns: |
Constant reference to the wrapped type info object |
void swap(type_info_wrapper & that) noexcept;
Swaps two instances of the wrapper
std::string pretty_name() const;
The method returns the contained type name string in a possibly more readable format than get().name()
Requires: |
|
Returns: |
Type name string |
bool operator!() const noexcept;
Returns: |
|
bool operator==(type_info_wrapper const & that) const noexcept;
Equality comparison
Parameters: |
|
||
Returns: |
If either this object or comparand is in empty state and the other is not, the result is |
bool operator<(type_info_wrapper const & that) const noexcept;
Ordering operator
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. |
Parameters: |
|
||
Requires: |
|
||
Returns: |
|