diff options
author | Chanho Park <chanho61.park@samsung.com> | 2014-12-11 18:55:56 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-12-11 18:55:56 +0900 |
commit | 08c1e93fa36a49f49325a07fe91ff92c964c2b6c (patch) | |
tree | 7a7053ceb8874b28ec4b868d4c49b500008a102e /boost/type_erasure/deduced.hpp | |
parent | bb4dd8289b351fae6b55e303f189127a394a1edd (diff) | |
download | boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.gz boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.bz2 boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.zip |
Imported Upstream version 1.57.0upstream/1.57.0
Diffstat (limited to 'boost/type_erasure/deduced.hpp')
-rw-r--r-- | boost/type_erasure/deduced.hpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/boost/type_erasure/deduced.hpp b/boost/type_erasure/deduced.hpp new file mode 100644 index 0000000000..b9ed96094c --- /dev/null +++ b/boost/type_erasure/deduced.hpp @@ -0,0 +1,53 @@ +// Boost.TypeErasure library +// +// Copyright 2011 Steven Watanabe +// +// Distributed under the Boost Software License Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// $Id$ + +#ifndef BOOST_TYPE_ERASURE_DEDUCED_HPP_INCLUDED +#define BOOST_TYPE_ERASURE_DEDUCED_HPP_INCLUDED + +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/set.hpp> +#include <boost/mpl/empty.hpp> +#include <boost/type_erasure/detail/get_placeholders.hpp> +#include <boost/type_erasure/placeholder.hpp> + +namespace boost { +namespace type_erasure { + +/** + * A placeholder for an associated type. The type corresponding + * to this placeholder is deduced by substituting placeholders + * in the arguments of the metafunction and then evaluating it. + * + * When using @ref deduced in a template context, if it is possible for + * Metafunction to contain no placeholders at all, use the nested type, + * to automatically evaluate it early as needed. + */ +template<class Metafunction> +struct deduced : ::boost::type_erasure::placeholder +{ + typedef typename ::boost::mpl::eval_if< + ::boost::mpl::empty< + typename ::boost::type_erasure::detail::get_placeholders< + Metafunction, + ::boost::mpl::set0<> + >::type + >, + Metafunction, + ::boost::mpl::identity< + ::boost::type_erasure::deduced<Metafunction> + > + >::type type; +}; + +} +} + +#endif |