| Home | Libraries | People | FAQ | More

## Struct placeholder

boost::type_erasure::placeholder

## Synopsis

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

    struct placeholder {
    };

## Description

Placeholders are used heavily throughout the library. Every placeholder must derive from placeholder. The library provides a number of placeholders, out of the box, but you are welcome to define your own, if you want more descriptive names. The placeholder _self is special in that it is used as the default wherever possible.

What exactly is a placeholder? Placeholders act as a substitute for template parameters in concepts. The library automatically replaces all the placeholders used in a concept with the actual types involved when it stores an object in an any.

For example, in the following,

    * any<copy_constructible<_a>, _a> x(1);
    *

The library sees that we're constructing an any that uses the _a placeholder with an `int`. Thus it binds _a to int and instantiates copy_constructible<int>.

When there are multiple placeholders involved, you will have to use tuple, or pass the bindings explicitly, but the substitution still works the same way.