Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

deduce

Description

Metafunction to apply element conversion to the full argument type.

It removes references to const, references to array types are kept, even if the array is const. Reference wrappers are removed (see Reference Wrappers)[5].

Header
#include <boost/fusion/support/deduce.hpp>
#include <boost/fusion/include/deduce.hpp>
Synopsis
namespace traits
{
    template <typename T>
    struct deduce
    {
        typedef unspecified type;
    };
}
Example
template <typename T>
struct holder
{
    typename traits::deduce<T const &>::type element;

    holder(T const & a)
      : element(a)
    { }
};

template <typename T>
holder<T> make_holder(T const & a)
{
    return holder<T>(a);
}
See also


[5] Since C++11, the standard reference wrappers are also removed.


PrevUpHomeNext