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 to view this page for the latest version.
PrevUpHomeNext

Struct relaxed

boost::type_erasure::relaxed

Synopsis

// In header: <boost/type_erasure/relaxed.hpp>


struct relaxed : public boost::mpl::vector0<> {
};

Description

This special concept enables various useful default behavior that makes any act like an ordinary object. By default any forwards all operations to the underlying type, and provides only the operations that are specified in its Concept.

In detail, relaxed enables the following:

  • A raw value can be assigned to an any. This will replace the value stored by the any. (But note that if assignable is present, it takes priority.)

  • assignment of any uses the constructor if it can't use assignable (either because assignable is missing, or because the stored types do not match).

  • default construction of any is allowed and creates a null any.

  • equality_comparable: If the types do not match, it will return false.

  • less_than_comparable: If the types do not match, the ordering will be according to std::type_info::before.

  • if the arguments to any other function do not match, it will throw a bad_function_call exception instead of having undefined behavior.


PrevUpHomeNext