| Home | Libraries | People | FAQ | More

## Class template any<Concept, T &&>

boost::type_erasure::any<Concept, T &&>

## Synopsis

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

    template<typename Concept, typename T>
    class any<Concept, T &&> {
    public:
      // construct/copy/destruct
      template<typename U> any(U &&);
      template<typename U, typename Map> any(U &&, const static_binding< Map > &);
      any(any< Concept, T > &&);
      template<typename Concept2, typename Tag2> any(any< Concept2, Tag2 && > &&);
      template<typename Concept2, typename Tag2> any(any< Concept2, Tag2 > &&);
      template<typename Concept2, typename Tag2, typename Map>
        any(const any< Concept2, Tag2 && > &, const static_binding< Map > &);
      template<typename Concept2, typename Tag2, typename Map>
        any(any< Concept2, Tag2 > &&, const static_binding< Map > &);
      template<typename Concept2, typename Tag2>
        any(const any< Concept2, Tag2 && > &, const binding< Concept > &);
      template<typename Concept2, typename Tag2>
        any(any< Concept2, Tag2 > &&, const binding< Concept > &);
      template<typename U> any & operator=(U &&);
    };

## Description

### `any` public construct/copy/destruct

1.     template<typename U> any(U && arg);

   Constructs an `any` from a reference.

   Parameters:

   `arg` | The object to bind the reference to.

   Requires: | `U` is a model of `Concept`.
   Requires: | `Concept` must not refer to any non-deduced placeholder besides `T`.
   Throws: | Nothing.

2.     template<typename U, typename Map>
         any(U && arg, const static_binding< Map > & binding);

   Constructs an `any` from a reference.

   Parameters:

   `arg` | The object to bind the reference to.
   `binding` | Specifies the actual types that all the placeholders should bind to.

   Requires: | `U` is a model of `Concept`.
   Requires: | `Map` is an MPL map with an entry for every non-deduced placeholder referred to by `Concept`.
   Throws: | Nothing.

3.     any(any< Concept, T > && other);

   Constructs an `any` from another rvalue reference.

   Parameters:

   `other` | The reference to copy. The object to bind the reference to.

   Throws: | Nothing.Constructs an any from another any. Nothing.

4.     template<typename Concept2, typename Tag2>
         any(any< Concept2, Tag2 && > && other);

   Constructs an `any` from another rvalue reference.

   Parameters:

   `other` | The reference to copy.

   Requires: | `Concept` must not refer to any non-deduced placeholder besides `T`.
   Requires: | After substituting `T` for `Tag2`, the requirements of `Concept2` must be a superset of the requirements of `Concept`.
   Throws: | std::bad_alloc

5.     template<typename Concept2, typename Tag2> any(any< Concept2, Tag2 > && other);

   Constructs an `any` from another `any`.

   Parameters:

   `other` | The object to bind the reference to.

   Requires: | `Concept` must not refer to any non-deduced placeholder besides `T`.
   Requires: | After substituting `T` for `Tag2`, the requirements of `Concept2` must be a superset of the requirements of `Concept`.
   Throws: | std::bad_alloc

6.     template<typename Concept2, typename Tag2, typename Map>
         any(const any< Concept2, Tag2 && > & other,
             const static_binding< Map > & binding);

   Constructs an `any` from another reference.

   Parameters:

   `binding` | Specifies the mapping between the two concepts.
   `other` | The reference to copy.

   Requires: | `Map` must be an MPL map with keys for all the non-deduced placeholders used by `Concept` and values for the corresponding placeholders in `Concept2`.
   Requires: | After substituting placeholders according to `Map`, the requirements of `Concept2` must be a superset of the requirements of `Concept`.
   Throws: | std::bad_alloc

7.     template<typename Concept2, typename Tag2, typename Map>
         any(any< Concept2, Tag2 > && other, const static_binding< Map > & binding);

   Constructs an `any` from another `any`.

   Parameters:

   `binding` | Specifies the mapping between the two concepts.
   `other` | The object to bind the reference to.

   Requires: | `Map` must be an MPL map with keys for all the non-deduced placeholders used by `Concept` and values for the corresponding placeholders in `Concept2`.
   Requires: | After substituting placeholders according to `Map`, the requirements of `Concept2` must be a superset of the requirements of `Concept`.
   Throws: | std::bad_alloc

8.     template<typename Concept2, typename Tag2>
         any(const any< Concept2, Tag2 && > & other,
             const binding< Concept > & binding);

   Constructs an `any` from another rvalue reference.

   Parameters:

   `binding` | Specifies the bindings of placeholders to actual types.
   `other` | The reference to copy.

   Requires: | The type stored in `other` must match the type expected by `binding`.
   Postconditions: | binding_of(*this) == `binding`
   Throws: | Nothing.

9.     template<typename Concept2, typename Tag2>
         any(any< Concept2, Tag2 > && other, const binding< Concept > & binding);

   Constructs an `any` from another `any`.

   Parameters:

   `binding` | Specifies the bindings of placeholders to actual types.
   `other` | The object to bind the reference to.

   Requires: | The type stored in `other` must match the type expected by `binding`.
   Postconditions: | binding_of(*this) == `binding`
   Throws: | Nothing.

10.     template<typename U> any & operator=(U && other);

    Assigns to an `any`.

    If an appropriate overload of `assignable` is not available and `relaxed` is in `Concept`, falls back on constructing from `other`.

    Throws: | Whatever the assignment operator of the contained type throws. When falling back on construction, can only throw `std::bad_alloc` if `U` is an any that uses a different `Concept`. In this case assignment provides the strong exception guarantee. When calling the assignment operator of the contained type, the exception guarantee is whatever the contained type provides.