| 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(const any &);
      any(any< Concept, T > &);
      template<typename Concept2, typename Tag2>
        any(const 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 > &);
      any & operator=(const any &);
      template<typename U> any & operator=(U &);
      template<typename U> any & operator=(const 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`. `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`. `Map` is an MPL map with an entry for every non-deduced placeholder referred to by `Concept`.
   Throws: | Nothing.

3.     any(const any & other);

   Constructs an `any` from another reference.

   Parameters:

   `other` | The reference to copy.

   Throws: | Nothing.

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

   Constructs an `any` from another `any`.

   Parameters:

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

   Throws: | Nothing.

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

   Constructs an `any` from another reference.

   Parameters:

   `other` | The reference to copy.

   Requires: | `Concept` must not refer to any non-deduced placeholder besides `T`. 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> 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`. After substituting `T` for `Tag2`, 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(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`. 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, 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`. After substituting placeholders according to `Map`, the requirements of `Concept2` must be a superset of the requirements of `Concept`.
   Throws: | std::bad_alloc

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

   Constructs an `any` from another 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.

10.     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.

11.     any & operator=(const any & 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, throws `std::bad_alloc`. 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.

12.     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, throws `std::bad_alloc`. 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.

13.     template<typename U> any & operator=(const 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, throws `std::bad_alloc`. 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.