| Home | Libraries | People | FAQ | More

## Class template binding

boost::type_erasure::binding

## Synopsis

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

    template<typename Concept>
    class binding {
    public:
      // construct/copy/destruct
      binding();
      template<typename Map> explicit binding(const Map &);
      template<typename Map> binding(const static_binding< Map > &);
      template<typename Concept2, typename Map>
        binding(const binding< Concept2 > &, const Map &);
      template<typename Concept2, typename Map>
        binding(const binding< Concept2 > &, const static_binding< Map > &);
      template<typename Placeholders, typename Map>
        binding(const dynamic_binding< Placeholders > &,
                const static_binding< Map > &);

      // friend functions
      friend bool operator==(const binding &, const binding &);
      friend bool operator!=(const binding &, const binding &);
    };

## Description

Stores the binding of a `Concept` to a set of actual types. `Concept` is interpreted in the same way as with any.

### `binding` public construct/copy/destruct

1.     binding();

   Requires: | relaxed must be in `Concept`.
   Throws: | Nothing.

2.     template<typename Map> explicit binding(const Map &);

   Requires: | `Map` must be an MPL map with an entry for each placeholder referred to by `Concept`.
   Throws: | Nothing.

3.     template<typename Map> binding(const static_binding< Map > &);

   Requires: | `Map` must be an MPL map with an entry for each placeholder referred to by `Concept`.
   Throws: | Nothing.

4.     template<typename Concept2, typename Map>
         binding(const binding< Concept2 > & other, const Map &);

   Converts from another set of bindings.

   Requires: | Map must be an MPL map with an entry for each placeholder referred to by `Concept`. The mapped type should be the corresponding placeholder in Concept2.
   Throws: | std::bad_alloc

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

   Converts from another set of bindings.

   Requires: | Map must be an MPL map with an entry for each placeholder referred to by `Concept`. The mapped type should be the corresponding placeholder in Concept2.
   Throws: | std::bad_alloc

6.     template<typename Placeholders, typename Map>
         binding(const dynamic_binding< Placeholders > & other,
                 const static_binding< Map > &);

   Converts from another set of bindings.

   Requires: | Map must be an MPL map with an entry for each placeholder referred to by `Concept`. The mapped type should be the corresponding placeholder in Concept2.
   Throws: | std::bad_alloc

### `binding` friend functions

1.     friend bool operator==(const binding & lhs, const binding & rhs);

   Returns: | true iff the sets of types that the placeholders bind to are the same for both arguments.
   Throws: | Nothing.

2.     friend bool operator!=(const binding & lhs, const binding & rhs);

   Returns: | true iff the arguments do not map to identical sets of types.
   Throws: | Nothing.