#ifndef BOOST_MP11_UTILITY_HPP_INCLUDED #define BOOST_MP11_UTILITY_HPP_INCLUDED // Copyright 2015 Peter Dimov. // // 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 #include namespace boost { // mp_identity template struct mp_identity { using type = T; }; // mp_identity_t template using mp_identity_t = T; // mp_inherit template struct mp_inherit: T... {}; // mp_if, mp_if_c namespace detail { template struct mp_if_c_impl; template struct mp_if_c_impl { using type = T; }; template struct mp_if_c_impl { using type = E; }; } // namespace detail template using mp_if_c = typename detail::mp_if_c_impl::type; template using mp_if = typename detail::mp_if_c_impl(C::value), T, E>::type; // mp_eval_if, mp_eval_if_c namespace detail { template class F, class... U> struct mp_eval_if_c_impl; template class F, class... U> struct mp_eval_if_c_impl { using type = T; }; template class F, class... U> struct mp_eval_if_c_impl { using type = F; }; } // namespace detail template class F, class... U> using mp_eval_if_c = typename detail::mp_eval_if_c_impl::type; template class F, class... U> using mp_eval_if = typename detail::mp_eval_if_c_impl(C::value), T, F, U...>::type; // mp_valid // implementation by Bruno Dutra (by the name is_evaluable) namespace detail { template class F, class... T> struct mp_valid_impl { template class G, class = G> static mp_true check(int); template class> static mp_false check(...); using type = decltype(check(0)); }; } // namespace detail template class F, class... T> using mp_valid = typename detail::mp_valid_impl::type; // mp_defer namespace detail { template class F, class... T> struct mp_defer_impl { using type = F; }; struct mp_no_type { }; } // namespace detail template class F, class... T> using mp_defer = mp_if, detail::mp_defer_impl, detail::mp_no_type>; } // namespace boost #endif // #ifndef BOOST_MP11_UTILITY_HPP_INCLUDED