[/ / Copyright 2017 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) /] [section:utility Utility Components, ``] [section `mp_identity`] template struct mp_identity { using type = T; }; [endsect] [section `mp_identity_t`] template using mp_identity_t = T; [endsect] [section `mp_inherit`] template struct mp_inherit: T... {}; [endsect] [section `mp_if_c`] template using mp_if_c = /*...*/; `mp_if_c` is an alias for `T`. `mp_if_c` is an alias for `E`. Otherwise, the result is a substitution failure. using R1 = mp_if_c; // int using R2 = mp_if_c; // void template using void_if_5 = mp_if_c; // `void` when `I::value` is 5, substitution failure otherwise [endsect] [section `mp_if`] template using mp_if = mp_if_c(C::value), T, E...>; Like `mp_if_c`, but the first argument is a type. [endsect] [section `mp_eval_if_c`] template class F, class... U> using mp_eval_if_c = /*...*/; `mp_eval_if_c` is an alias for `T` when `C` is `true`, for `F` otherwise. Its purpose is to avoid evaluating `F` when the condition is `true` as it may not be valid in this case. [endsect] [section `mp_eval_if`] template class F, class... U> using mp_eval_if = mp_eval_if_c(C::value), T, F, U...>; Like `mp_eval_if_c`, but the first argument is a type. [endsect] [section `mp_eval_if_q`] template using mp_eval_if_q = mp_eval_if; Like `mp_eval_if`, but takes a quoted metafunction. [endsect] [section `mp_valid`] template class F, class... T> using mp_valid = /*...*/; `mp_valid` is an alias for `mp_true` when `F` is a valid expression, for `mp_false` otherwise. [endsect] [section `mp_defer`] template class F, class... T> using mp_defer = /*...*/; When `mp_valid` is `mp_true`, `mp_defer` is a struct with a nested type `type` which is an alias for `F`. Otherwise, `mp_defer` is an empty struct. [endsect] [section `mp_quote`] template class F> struct mp_quote { template using fn = F; }; `mp_quote` transforms the template `F` into a type with a nested template `fn` such that `fn` returns `F`. [endsect] [section `mp_invoke`] template using mp_invoke = typename Q::template fn; `mp_invoke` evaluates the nested template `fn` of a quoted metafunction. `mp_invoke, T...>` returns `F`. [endsect] [endsect:utility]