Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::type_erasure::placeholder Struct Reference

Placeholders are used heavily throughout the library. More...

#include <placeholder.hpp>

Inheritance diagram for boost::type_erasure::placeholder:

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


The documentation for this struct was generated from the following file: