| Home | Libraries | People | FAQ | More

## Macro BOOST_TYPE_ERASURE_MEMBER

BOOST_TYPE_ERASURE_MEMBER — Defines a primitive concept for a member function.

## Synopsis

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

    BOOST_TYPE_ERASURE_MEMBER(concept_name, member)

## Description

The declaration of the concept is

    template<class Sig, class T = _self>
    struct concept_name;

where `Sig` is a function type giving the signature of the member function, and `T` is the object type. `T` may be const-qualified for const member functions. `concept_name<R(A...) const, T>` is an alias for `concept_name<R(A...), const T>`.

This macro can only be used at namespace scope.

Example:

    namespace boost {
    BOOST_TYPE_ERASURE_MEMBER(push_back)
    }
    typedef boost::has_push_back<void(int)> push_back_concept;

The concept defined by this function may be specialized to provide a concept_map. The class object will be passed by reference as the first parameter.

    template<>
    struct has_push_back<void(int), std::list<int> > {
      static void apply(std::list<int>& l, int i) { l.push_back(i); }
    };

In C++03, the macro can only be used in the global namespace and is defined as:

    #define BOOST_TYPE_ERASURE_MEMBER(qualified_name, member, N)

Example:

    BOOST_TYPE_ERASURE_MEMBER((boost)(has_push_back), push_back, 1)
    typedef boost::has_push_back<void(int), _self> push_back_concept;

For backwards compatibility, this form is always accepted.

Parameters:

`concept_name` | is the name of the concept to declare. If it is omitted it defaults to `has_ ## member`
`member` | is the name of the member function.