On 12 August 2016 at 17:45, <
c....@gmx.de> wrote:
> Thank you for your feedback. I think there may have been a misunderstanding.
> The proposed meta traits are not merely shorter names or wrappers for
> 'std::conjunction' or 'std::disjunction'. Since those already have been
> voted into the standard (as far as i know), proposing something identical
> with a different name would be moot.
>
> But there is an important difference. The already existing
> 'std::conjunction' and 'std::disjunction' both take instantiated type traits
> and combine the (short-circuited) results. The proposed meta traits however,
> take an single uninstantiated type trait and a list of types, which then
> gets applied to all types.
>
> They are not the same but rather would have a nice synergy with one another.
> You could for example write something like this:
>
> template <typename... Ts>
> auto foo(Ts&&...)
> -> std::enable_if_t<std::conjunction_v<
> all_of<std::is_rvalue_reference, Ts&&...>,
> none_of<std::is_pointer, Ts...>,
> none_of<std::is_integral, Ts...>>>;
Ok. Why would I do that, instead of using a fold-expression? I can already write
(is_rvalue_reference_v<Ts&&> && ...)
instead of the proposed
all_of<is_rvalue_reference, Ts&&...>
and if I want to turn the expression's result back into a trait-type,
I can just wrap it
back into a bool_constant.
Note: I have an answer to that question. It's more or less the same as
the answer for logical traits,
as explained in
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0013r0.html
which is that the traits can short-circuit better, and also the traits
can easily be provided for
pre-C++17 compilers.
> Regarding the names I'm not sure if this is an issue or not, since the C++
> standard, as far as I know, allows functions and types that have the same
> name. However, the names can be changed to something else when needed.
You can't have a function template and a class template with the same
name, regardless
of other kinds of different entities being able to use the same name,
like non-template
functions and structs, or types and variables.