Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Class type_info_wrapper

boost::log::type_info_wrapper — A simple std::type_info wrapper that implements value semantic for type information objects.

Synopsis

// 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;
};

Description

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/destruct

  1. type_info_wrapper() noexcept;

    Default constructor

    Postconditions:

    !*this == true

  2. type_info_wrapper(type_info_wrapper const & that) noexcept;

    Copy constructor

    Parameters:

    that

    Source type info wrapper to copy from

    Postconditions:

    *this == that

  3. type_info_wrapper(std::type_info const & that) noexcept;

    Conversion constructor

    Parameters:

    that

    Type info object to be wrapped

    Postconditions:

    *this == that && !!*this

type_info_wrapper public member functions

  1. explicit operator bool() const noexcept;

    Returns:

    true if the type info wrapper was initialized with a particular type, false if the wrapper was default-constructed and not yet initialized

  2. std::type_info const & get() const noexcept;

    Stored type info getter

    Requires:

    !!*this

    Returns:

    Constant reference to the wrapped type info object

  3. void swap(type_info_wrapper & that) noexcept;

    Swaps two instances of the wrapper

  4. std::string pretty_name() const;

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

    Requires:

    !!*this

    Returns:

    Type name string

  5. bool operator!() const noexcept;

    Returns:

    false if the type info wrapper was initialized with a particular type, true if the wrapper was default-constructed and not yet initialized

  6. bool operator==(type_info_wrapper const & that) const noexcept;

    Equality comparison

    Parameters:

    that

    Comparand

    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.

  7. bool operator<(type_info_wrapper const & that) const noexcept;

    Ordering operator

    [Note] 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:

    that

    Comparand

    Requires:

    !!*this && !!that

    Returns:

    true if this object wraps type info object that is ordered before the type info object in the comparand, false otherwise


PrevUpHomeNext