Topic: STL: 'all_of', 'none_of' and 'any_of' for type traits


Author: c.ger@gmx.de
Date: Thu, 11 Aug 2016 23:11:39 -0700 (PDT)
Raw View
------=_Part_21_1274303015.1470982299642
Content-Type: multipart/alternative;
 boundary="----=_Part_22_1675127559.1470982299645"

------=_Part_22_1675127559.1470982299645
Content-Type: text/plain; charset=UTF-8

I'm not following the standardization process that closely and although I
did some quick research I'm not sure whether something like this already
has been proposed or is simply to trivial to be considered for the standard.

When working with template-heavy code it is often necessary to use type
traits, especially when using SFINAE to for differentiate function calls.
With many arguments these conditions sometimes get very large, can be hard
to read and bloat the code.

Imagine you have several matrix types and want to write a function that
adds an arbitrary combination of them together. It could be useful to
differentiate between the matrices and other types (e.g. vectors) that
might also have an add function. This could be done via a type trait
'is_matrix'.

A classic version could look like the following:

template <typename TMatrix1, typename TMatrix2, typename TMatrix3, typename
TMatrix4, typename TMatrix5>
auto add(const TMatrix1& m1, const TMatrix2& m2, const TMatrix1& m3, const
TMatrix2& m4, TMatrix3& r)
 -> std::enable_if_t<is_matrix<TMatrix1>::value && is_matrix<TMatrix2>::value
&& is_matrix<TMatrix3>::value &&
 is_matrix<TMatrix4>::value && is_matrix<TMatrix5>::value>;


Now this of course could be simplified by using variable templates -- which
might not always be available:

template <typename TMatrix1, typename TMatrix2, typename TMatrix3, typename
TMatrix4, typename TMatrix5>
auto add(const TMatrix1& m1, const TMatrix2& m2, const TMatrix1& m3, const
TMatrix2& m4, TMatrix3& r)
 ->std::enable_if_t<is_matrix_v<TMatrix1> && is_matrix_v<TMatrix2> &&
is_matrix_v<TMatrix3> &&
 is_matrix_v<TMatrix4> && is_matrix_v<TMatrix5>>;


Or alternatively in C++17:

template <typename TMatrix1, typename TMatrix2, typename TMatrix3, typename
TMatrix4, typename TMatrix5>
auto add(const TMatrix1& m1, const TMatrix2& m2, const TMatrix1& m3, const
TMatrix2& m4, TMatrix3& r)
-> std::enable_if_t<std::conjunction_v<is_matrix<TMatrix1>, is_matrix<
TMatrix2>,
 is_matrix<TMatrix3>, is_matrix<TMatrix4>, is_matrix<TMatrix5>>;


This problem gets even worse with longer names for the type traits:

template <typename T1, typename T2, typename T3, typename T4>
auto foo(T1&& t1, T2&& t2, T3&& t3, T4&& t4)
{
 using namespace std;
 static_assert(has_unique_object_representations_v<T1> &&
has_unique_object_representations_v<T2> &&
 has_unique_object_representations_v<T3> &&
has_unique_object_representations_v<T4>, "not allowed");
}


What about variadic templates where you only have a parameter pack? In
C++17 this can be done with a little trickery, if you do know how:

template <typename... Ts>
auto bar(Ts&&... ts)
{
 using namespace std;
 static_assert(conjunction_v<negation<is_lvalue_reference<Ts>>...>, "not
allowed");
}


As you can see, although many of this is already currently possible -- or
probably will be in C++17 -- the solutions are longer than you want them to
and/or require some tricks. Of course these problems can be mitigated by
using variable and alias templates or implementing custom types. But that
is all extra code that you have to implement.

Why not have 'all_of', 'none_of' or 'any_of' meta types in the STL, similar
to those in the algorithm header, only for type traits?

Above examples could be written like this:

template <typename TMatrix1, typename TMatrix2, typename TMatrix3, typename
TMatrix4, typename TMatrix5>
auto add(const TMatrix1& m1, const TMatrix2& m2, const TMatrix1& m3, const
TMatrix2& m4, TMatrix3& r)
->std::enable_if_t<std::all_of_v<is_matrix, TMatrix1, TMatrix2, TMatrix3,
TMatrix4, TMatrix5>>;


template <typename T1, typename T2, typename T3, typename T4>
auto foo(T1&& t1, T2&& t2, T3&& t3, T4&& t4)
{
 using namespace std;
 static_assert(all_of_v<has_unique_object_representations, T1, T2, T3, T4>, "not
allowed");
}


template <typename... Ts>
auto bar(Ts&&... ts)
{
 using namespace std;
 static_assert(none_of_v<is_lvalue_reference, Ts...>, "not allowed");
}


Not only are these solutions shorter, they also make the intention clearer
and the code probably easier to understand. Template-heavy code ist hard to
read as it is and does not need to get bloated even further when
unnecessary. This is a tiny proposal that can be implemented in a quite
elegant way using already proposed C++17 features:

template <template <typename> class Pred, typename... Ts>
struct all_of : std::conjunction<Pred<Ts>...>::type {};


template <template <typename> class Pred, typename... Ts>
constexpr bool all_of_v = all_of<Pred, Ts...>::value;


template <template <typename> class Pred, typename... Ts>
struct none_of : std::conjunction<std::negation<Pred<Ts>>...>::type {};


template <template <typename> class Pred, typename... Ts>
constexpr bool none_of_v = none_of<Pred, Ts...>::value;


template <template <typename> class Pred, typename... Ts>
struct any_of : std::disjunction<Pred<Ts>...>::type {};


template <template <typename> class Pred, typename... Ts>
constexpr bool any_of_v = any_of<Pred, Ts...>::value;


This of course would also allow an easy implementation of 'enable_if_all',
'enable_if_none' and 'enable_if_any'.

This should conform to the standard, but I'm no one hundred percent sure.
At the moment I can only test it with VS2015.

I'm aware some of the examples might be a little contrived, but I hope you
get my point :)

Thoughts?

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/86d96e28-f584-4c32-86dc-41f9906c7bda%40isocpp.org.

------=_Part_22_1675127559.1470982299645
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I&#39;m not following the standardization process tha=
t closely and although I did some quick research I&#39;m not sure whether s=
omething like this already has been proposed or is simply to trivial to be =
considered for the standard.</div><div><br></div><div>When working with tem=
plate-heavy code it is often necessary to use type traits, especially when =
using SFINAE to for differentiate function calls. With many arguments these=
 conditions sometimes get very large, can be hard to read and bloat the cod=
e.</div><div><br></div><div>Imagine you have several matrix types and want =
to write a function that adds an arbitrary combination of them together. It=
 could be useful to differentiate between the matrices and other types (e.g=
.. vectors) that might also have an add function. This could be done via a t=
ype trait &#39;is_matrix&#39;.</div><div><br></div><div>A classic version c=
ould look like the following:</div><div><br></div><div class=3D"prettyprint=
" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; bac=
kground-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">template</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #606;" class=3D"styled-by-prettify">TMatrix1</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"s=
tyled-by-prettify">TMatrix2</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">t=
ypename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix3</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">TMatrix4</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify"=
>TMatrix5</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&=
gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> add</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">const</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">TMatrix1</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> m1</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">const=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix2</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> m2</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">const</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">TMatrix1</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> m3</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">const</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">TMatrix2</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> m4</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pre=
ttify">TMatrix3</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 r</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">enable_if_t</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">is_matrix</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">TMatrix1</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&gt;::</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">value </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> is_matrix</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&lt;</span><span style=3D"color: #606;" class=3D"styled-by=
-prettify">TMatrix2</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&gt;::</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">value </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> is_matrix</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">TMatr=
ix3</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;::<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">value </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0is_ma=
trix</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix4</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;::</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">value </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> is_matrix</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">TMatrix5</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&gt;::</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">value</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&gt;;</span></div></code></div><div><=
br></div><div>=C2=A0=C2=A0</div><div>Now this of course could be simplified=
 by using variable templates -- which might not always be available:</div><=
div><br></div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187=
, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);">=
<code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">template</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">TMatrix1</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">typen=
ame</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix2</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" c=
lass=3D"styled-by-prettify">TMatrix3</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">TMa=
trix4</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #606;" class=3D"styled-by-prettify">TMatrix5</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> add</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">const</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix1=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> m1</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">const</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D=
"styled-by-prettify">TMatrix2</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> m2</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">const</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #606;" class=3D"styled-by-prettify">TMatrix1</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> m3</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">const</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pretti=
fy">TMatrix2</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> m4=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">TMatrix3</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> r</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br>=C2=A0</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">-&gt;</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">enable_if_t</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
is_matrix_v</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">TMatr=
ix1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> is_matrix_v</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span sty=
le=3D"color: #606;" class=3D"styled-by-prettify">TMatrix2</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> is_matrix_v</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #606;" c=
lass=3D"styled-by-prettify">TMatrix3</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br>=C2=A0is_matrix_v</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #606;" class=3D"st=
yled-by-prettify">TMatrix4</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> is_matrix_v</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">TMa=
trix5</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&=
gt;;</span></div></code></div><div><br></div><div>=C2=A0=C2=A0</div><div>Or=
 alternatively in C++17:</div><div><br></div><div class=3D"prettyprint" sty=
le=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; backgrou=
nd-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"su=
bprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">tem=
plate</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #606;" class=3D"styled-by-prettify">TMatrix1</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">TMatrix2</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">typen=
ame</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix3</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" c=
lass=3D"styled-by-prettify">TMatrix4</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">TMa=
trix5</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> add</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">const</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">TMatrix1</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> m1</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">const<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix2</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> m2</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">const</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">TMatrix1</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> m3</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">const</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">TMatrix2</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> m4</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pre=
ttify">TMatrix3</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 r</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">enable_if_t</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify">conjunction_v</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">is_matrix</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettif=
y">TMatrix1</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&gt;,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> is_=
matrix</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;=
</span><span style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix2</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;,</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0is_matr=
ix</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix3</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;,</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> is_matrix</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">TMatrix4</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&gt;,</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> is_matrix</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: =
#606;" class=3D"styled-by-prettify">TMatrix5</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&gt;&gt;;</span></div></code></div><div><=
br></div><div>=C2=A0=C2=A0</div><div>This problem gets even worse with long=
er names for the type traits:</div><div><br></div><div class=3D"prettyprint=
" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; bac=
kground-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">template</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> T1</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">typename</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> T2</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">typename</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> T3</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> T4</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> foo</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">T1</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> t1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T2</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> t2</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> T3</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> t3</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> T4</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> t4</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
></span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0</span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">using</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">namespace</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>=C2=A0</span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">static_assert</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">has_unique_object_representations_v</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">T1</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> has_unique_object_representations_v</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">T2</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>=C2=A0has_unique_object_representations_v</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">T3</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> has_unique_object_representations_v</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">T4</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&gt;,</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=3D"s=
tyled-by-prettify">&quot;not allowed&quot;</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">}</span></div></code></div><div><br></div><div><br></div>=
<div>What about variadic templates where you only have a parameter pack? In=
 C++17 this can be done with a little trickery, if you do know how:</div><d=
iv><br></div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187,=
 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><=
code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">template</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typename</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">...</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pr=
ettify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> bar</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"c=
olor: #606;" class=3D"styled-by-prettify">Ts</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&amp;&amp;...</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> ts</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>=C2=A0</span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">using</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">namespac=
e</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0</span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">static_assert</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">conjunction_v</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">negation</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify">is_lvalue_reference</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #606;" class=3D"styled-by-prettify">Ts</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&gt;&gt;...&gt;,</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;"=
 class=3D"styled-by-prettify">&quot;not allowed&quot;</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">}</span></div></code></div><div><br></div><div=
><br></div><div>As you can see, although many of this is already currently =
possible -- or probably will be in C++17 -- the solutions are longer than y=
ou want them to and/or require some tricks. Of course these problems can be=
 mitigated by using variable and alias templates or implementing custom typ=
es. But that is all extra code that you have to implement.</div><div><br></=
div><div>Why not have &#39;all_of&#39;, &#39;none_of&#39; or &#39;any_of&#3=
9; meta types in the STL, similar to those in the algorithm header, only fo=
r type traits?</div><div><br></div><div>Above examples could be written lik=
e this:</div><div><br></div><div class=3D"prettyprint" style=3D"border: 1px=
 solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250=
, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">template</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">TMatrix1</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">typename</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">TMat=
rix2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">TMatrix3</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">typename</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">TMatrix4</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix5</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> add</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">const</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pret=
tify">TMatrix1</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
m1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">const</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
606;" class=3D"styled-by-prettify">TMatrix2</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> m2</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">const</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix1</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> m3</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">const</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"st=
yled-by-prettify">TMatrix2</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> m4</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix3</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> r</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">-&gt;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">enable_if_t</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">all_of_v=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">is_matrix</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">TMatrix1</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"=
styled-by-prettify">TMatrix2</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
TMatrix3</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #606;" class=3D"styled-by-prettify">TMatrix4</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
606;" class=3D"styled-by-prettify">TMatrix5</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&gt;&gt;;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br><br><br></span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">template</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> T1</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T2</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> T3</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> T4</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
></span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> foo</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">T1</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> t1</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T2</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> t2</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> T3</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&=
amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> t3</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> T4</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> t4</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br>=C2=A0</span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">using</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">namespace</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0</sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">static_assert<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">all_of_v</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">has_unique_object_representa=
tions</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> T1</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T2</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> T3</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> T4</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&gt;,</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;=
not allowed&quot;</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br><br></sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">template</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" cla=
ss=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">auto</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 bar</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;...</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> ts</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">namespace</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0</span><span style=3D"color: #008;" class=3D"styled-by-prettify">stat=
ic_assert</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">none_of_v<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">is_lvalue_referen=
ce</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">...&gt;,</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;"=
 class=3D"styled-by-prettify">&quot;not allowed&quot;</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">}</span></div></code></div><div><br></div><div=
><br></div><div>Not only are these solutions shorter, they also make the in=
tention clearer and the code probably easier to understand. Template-heavy =
code ist hard to read as it is and does not need to get bloated even furthe=
r when unnecessary. This is a tiny proposal that can be implemented in a qu=
ite elegant way using already proposed C++17 features:</div><div><br></div>=
<div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); w=
ord-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=3D=
"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">template</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">template</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">&=
lt;typename&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">clas=
s</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #606;" class=3D"styled-by-prettify">Pred</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">typename</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">...</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">struc=
t</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> all_of <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">conjunction</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: =
#606;" class=3D"styled-by-prettify">Pred</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&gt;...&gt;::</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">type </span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">{};</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br><br><br></span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">template</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">template=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #080;" class=3D"styled-by-prettify">&lt;typename&gt;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">Pred</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">typename</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">...</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ts<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">constexpr</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">bool</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> all_of_v </span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> all_of</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&lt;</span><span style=3D"color: #606;" class=3D"=
styled-by-prettify">Pred</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ts</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">...&gt;::</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">value</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br><br><br></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">template</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">template</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=
=3D"styled-by-prettify">&lt;typename&gt;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pre=
ttify">Pred</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">...</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">Ts</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> none_of </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">conjunct=
ion</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">negation</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #606;" class=3D"styled-by-prettify">Pred</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #606;" =
class=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&gt;&gt;...&gt;::</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">type </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{};</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br><br><br></span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">template</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">template</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #080;" class=3D"styled-by-prettify">&lt;typen=
ame&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #606;" class=3D"styled-by-prettify">Pred</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">typename</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">...</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pr=
ettify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">constexpr</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">bool</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> none_of_v </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> none_of</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">Pred</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>...&gt;::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
value</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br><br></=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">template</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #080;" class=3D"styled-by-prettify">&lt;typename&gt;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">class</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D=
"styled-by-prettify">Pred</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">typ=
ename</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> any_of </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">disjunction</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettify"=
>Pred</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&gt;...&gt;::</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">type </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">{};</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br><br></span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">template</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=3D=
"styled-by-prettify">&lt;typename&gt;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pretti=
fy">Pred</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">...</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">constexpr</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">bool</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> any_of_v </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> any_=
of</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">Pred</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">...&gt;::</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify">value</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span></div></code></div><div><br></div><div><br>=
</div><div>This of course would also allow an easy implementation of &#39;e=
nable_if_all&#39;, &#39;enable_if_none&#39; and &#39;enable_if_any&#39;.</d=
iv><div><br></div><div>This should conform to the standard, but I&#39;m no =
one hundred percent sure. At the moment I can only test it with VS2015.</di=
v><div><br></div><div>I&#39;m aware some of the examples might be a little =
contrived, but I hope you get my point :)</div><div><br></div><div>Thoughts=
? =C2=A0 =C2=A0=C2=A0</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/86d96e28-f584-4c32-86dc-41f9906c7bda%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/86d96e28-f584-4c32-86dc-41f9906c7bda=
%40isocpp.org</a>.<br />

------=_Part_22_1675127559.1470982299645--

------=_Part_21_1274303015.1470982299642--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 12 Aug 2016 12:06:03 +0300
Raw View
On 12 August 2016 at 09:11,  <c.ger@gmx.de> wrote:
> This should conform to the standard, but I'm no one hundred percent sure. At
> the moment I can only test it with VS2015.

Tip: use an online compiler, like the one at melpon.org/wandbox.

> I'm aware some of the examples might be a little contrived, but I hope you
> get my point :)


all_of, any_of and none_of are existing algorithms, so having them as
traits will necessitate
different names for the traits.

Other than that, I would certainly like shorter names for conjunction,
disjunction and negation.
The question is, would it be simply better to have those shorter names
to begin with, rather
than introduce wrappers that merely shorten the names. :)

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFk2RUbrD6M_rmpzB_75k8cyYiebdyvnVZV_PjNq5_PY%3D%3DpTeA%40mail.gmail.com.

.


Author: c.ger@gmx.de
Date: Fri, 12 Aug 2016 07:45:17 -0700 (PDT)
Raw View
------=_Part_2069_1041821854.1471013117267
Content-Type: multipart/alternative;
 boundary="----=_Part_2070_1601931970.1471013117267"

------=_Part_2070_1601931970.1471013117267
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



On Friday, August 12, 2016 at 11:06:05 AM UTC+2, Ville Voutilainen wrote:
>
> On 12 August 2016 at 09:11,  <c....@gmx.de <javascript:>> wrote:=20
> > This should conform to the standard, but I'm no one hundred percent=20
> sure. At=20
> > the moment I can only test it with VS2015.=20
>
> Tip: use an online compiler, like the one at melpon.org/wandbox.=20
>
> > I'm aware some of the examples might be a little contrived, but I hope=
=20
> you=20
> > get my point :)=20
>
>
> all_of, any_of and none_of are existing algorithms, so having them as=20
> traits will necessitate=20
> different names for the traits.=20
>
> Other than that, I would certainly like shorter names for conjunction,=20
> disjunction and negation.=20
> The question is, would it be simply better to have those shorter names=20
> to begin with, rather=20
> than introduce wrappers that merely shorten the names. :)=20
>

Thank you for your feedback. I think there may have been a=20
misunderstanding. The proposed meta traits are not merely shorter names or=
=20
wrappers for 'std::conjunction' or 'std::disjunction'. Since those already=
=20
have been voted into the standard (as far as i know), proposing something=
=20
identical with a different name would be moot.

But there is an important difference. The already existing=20
'std::conjunction' and 'std::disjunction' both take instantiated type=20
traits and combine the (short-circuited) results. The proposed meta traits=
=20
however, take an single uninstantiated type trait and a list of types,=20
which then gets applied to all types.

They are not the same but rather would have a nice synergy with one=20
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...>>>;

Regarding the names I'm not sure if this is an issue or not, since the C++=
=20
standard, as far as I know, allows functions and types that have the same=
=20
name. However, the names can be changed to something else when needed.

And thank you for the link to wandbox which provides the newest GCC=20
version. I tried IDEOne, but their version of GCC does not support the=20
necessary C++17 features yet. I can confirm that the proposal also works on=
=20
the GCC =C2=B4version provided by wandbox.

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/b780cb89-8bcc-4139-818b-0d476852c368%40isocpp.or=
g.

------=_Part_2070_1601931970.1471013117267
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Friday, August 12, 2016 at 11:06:05 AM UTC+2, V=
ille Voutilainen wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 12 A=
ugust 2016 at 09:11, =C2=A0&lt;<a href=3D"javascript:" target=3D"_blank" gd=
f-obfuscated-mailto=3D"K3BQJYb7CQAJ" rel=3D"nofollow" onmousedown=3D"this.h=
ref=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javas=
cript:&#39;;return true;">c....@gmx.de</a>&gt; wrote:
<br>&gt; This should conform to the standard, but I&#39;m no one hundred pe=
rcent sure. At
<br>&gt; the moment I can only test it with VS2015.
<br>
<br>Tip: use an online compiler, like the one at <a href=3D"http://melpon.o=
rg/wandbox" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&=
#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmelpon.org%2Fwandbox\x26sa\=
x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHi7OiVvqvGuEBN7YPY5yvBvxvXcw&#39;;return =
true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2=
F%2Fmelpon.org%2Fwandbox\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHi7OiVvqvG=
uEBN7YPY5yvBvxvXcw&#39;;return true;">melpon.org/wandbox</a>.
<br>
<br>&gt; I&#39;m aware some of the examples might be a little contrived, bu=
t I hope you
<br>&gt; get my point :)
<br>
<br>
<br>all_of, any_of and none_of are existing algorithms, so having them as
<br>traits will necessitate
<br>different names for the traits.
<br>
<br>Other than that, I would certainly like shorter names for conjunction,
<br>disjunction and negation.
<br>The question is, would it be simply better to have those shorter names
<br>to begin with, rather
<br>than introduce wrappers that merely shorten the names. :)
<br></blockquote><div><br></div><div>Thank you for your feedback. I think t=
here may have been a misunderstanding. The proposed meta traits are not mer=
ely shorter names or wrappers for &#39;std::conjunction&#39; or &#39;std::d=
isjunction&#39;. Since those already have been voted into the standard (as =
far as i know), proposing something identical with a different name would b=
e moot.<br></div><div><br></div><div>But there is an important difference. =
The already existing &#39;std::conjunction&#39; and &#39;std::disjunction&#=
39; both take instantiated type traits and combine the (short-circuited) re=
sults. The proposed meta traits however, take an single uninstantiated type=
 trait and a list of types, which then gets applied to all types.</div><div=
><br></div><div>They are not the same but rather would have a nice synergy =
with one another. You could for example write something like this:</div><di=
v><div><br></div><div>template &lt;typename... Ts&gt;</div><div>auto foo(Ts=
&amp;&amp;...)</div><div>-&gt; std::enable_if_t&lt;std::conjunction_v&lt;</=
div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>a=
ll_of&lt;std::is_rvalue_reference, Ts&amp;&amp;...&gt;,</div><div><span cla=
ss=3D"Apple-tab-span" style=3D"white-space:pre"> </span>none_of&lt;std::is_=
pointer, Ts...&gt;,</div><div><span class=3D"Apple-tab-span" style=3D"white=
-space:pre"> </span>none_of&lt;std::is_integral, Ts...&gt;&gt;&gt;;</div></=
div><div><br></div><div>Regarding the names I&#39;m not sure if this is an =
issue or not, since the C++ standard, as far as I know, allows functions an=
d types that have the same name. However, the names can be changed to somet=
hing else when needed.</div><div><br></div><div>And thank you for the link =
to wandbox which provides the newest GCC version. I tried IDEOne, but their=
 version of GCC does not support the necessary C++17 features yet. I can co=
nfirm that the proposal also works on the GCC =C2=B4version provided by wan=
dbox.</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/b780cb89-8bcc-4139-818b-0d476852c368%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b780cb89-8bcc-4139-818b-0d476852c368=
%40isocpp.org</a>.<br />

------=_Part_2070_1601931970.1471013117267--

------=_Part_2069_1041821854.1471013117267--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 12 Aug 2016 18:07:57 +0300
Raw View
On 12 August 2016 at 17:45,  <c.ger@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.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFk2RUZCYRvQJqq4T8Gz6y7BELuFfH%2BF0fVcmcQWGXSjMtJ4Fg%40mail.gmail.com.

.


Author: Bo Persson <bop@gmb.dk>
Date: Fri, 12 Aug 2016 17:09:09 +0200
Raw View
On 2016-08-12 16:45, c.ger@gmx.de wrote:
>
>
> On Friday, August 12, 2016 at 11:06:05 AM UTC+2, Ville Voutilainen wrote:
>
>     On 12 August 2016 at 09:11,  <c....@gmx.de <javascript:>> wrote:
>     > This should conform to the standard, but I'm no one hundred
>     percent sure. At
>     > the moment I can only test it with VS2015.
>
>     Tip: use an online compiler, like the one at melpon.org/wandbox
>     <http://melpon.org/wandbox>.
>
>     > I'm aware some of the examples might be a little contrived, but I
>     hope you
>     > get my point :)
>
>
>     all_of, any_of and none_of are existing algorithms, so having them as
>     traits will necessitate
>     different names for the traits.
>
>     Other than that, I would certainly like shorter names for conjunction,
>     disjunction and negation.
>     The question is, would it be simply better to have those shorter names
>     to begin with, rather
>     than introduce wrappers that merely shorten the names. :)
>
>
> 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.
>


The orginal proposal was for naming the traits and_ and or_, but those
were rejected as being too close to other names.

The uglier names std::conjunction and std::disjunction were chosen
specifically to not interfere with others. I don't think a proposal to
rename them back will be accepted.  :-)

http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/p0013r1.html



     Bo Persson



--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/nokoqm%24ji0%241%40blaine.gmane.org.

.


Author: c.ger@gmx.de
Date: Fri, 12 Aug 2016 08:35:56 -0700 (PDT)
Raw View
------=_Part_1858_44171173.1471016156412
Content-Type: multipart/alternative;
 boundary="----=_Part_1859_1642806213.1471016156412"

------=_Part_1859_1642806213.1471016156412
Content-Type: text/plain; charset=UTF-8



On Friday, August 12, 2016 at 5:08:00 PM UTC+2, Ville Voutilainen wrote:
>
>
> 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.
>

You are right, I just tested this. Thanks for the correction. However, I
chose the names primarily to show the motivation behind the idea. And as I
said, names can be changed if necessary.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f8b682dd-1249-4f6e-be81-cd840d4becfa%40isocpp.org.

------=_Part_1859_1642806213.1471016156412
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Friday, August 12, 2016 at 5:08:00 PM UTC+2, Vi=
lle Voutilainen wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;=
margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<br>You can&#39;t have a function template and a class template with the sa=
me
<br>name, regardless
<br>of other kinds of different entities being able to use the same name,
<br>like non-template
<br>functions and structs, or types and variables.
<br></blockquote><div><br></div><div>You are right, I just tested this. Tha=
nks for the correction. However, I chose the names primarily to show the mo=
tivation behind the idea. And as I said, names can be changed if necessary.=
</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f8b682dd-1249-4f6e-be81-cd840d4becfa%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f8b682dd-1249-4f6e-be81-cd840d4becfa=
%40isocpp.org</a>.<br />

------=_Part_1859_1642806213.1471016156412--

------=_Part_1858_44171173.1471016156412--

.


Author: 3dw4rd@verizon.net
Date: Wed, 24 Aug 2016 11:09:33 -0700 (PDT)
Raw View
------=_Part_0_1954622880.1472062173363
Content-Type: multipart/alternative;
 boundary="----=_Part_1_605999301.1472062173365"

------=_Part_1_605999301.1472062173365
Content-Type: text/plain; charset=UTF-8


Won't fold expressions allow something like this?

template<typename... TMatrixen>
  auto add(const TMatrixen&... m)
  -> std::enable_if_t<(... && is_matrix_v<TMatrixen>), matrix<double>>;


my syntax may be off but I think something like it should do the trick.
OTOH, just because something is easier to implement in the language doesn't
make the library components inutil - they are nicely readable.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/2723544d-b9da-47f0-bea0-0765feb51055%40isocpp.org.

------=_Part_1_605999301.1472062173365
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br>Won&#39;t fold expressions allow something like this?<=
br><br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, =
250); border-color: rgb(187, 187, 187); border-style: solid; border-width: =
1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subp=
rettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">templ=
ate</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">...</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #606;" class=3D"styled-by-prettify">TMatrixen</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> add</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">const</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettif=
y">TMatrixen</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&amp;...</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 m</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">enable_if_t</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&lt;(...</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> is_matrix_v</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #606;" cla=
ss=3D"styled-by-prettify">TMatrixen</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&gt;),</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> matrix</span><span style=3D"color: #080;" class=3D"st=
yled-by-prettify">&lt;double&gt;</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&gt;;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br><br></span></div></code></div><br>my syntax may be o=
ff but I think something like it should do the trick.<br>OTOH, just because=
 something is easier to implement in the language doesn&#39;t make the libr=
ary components inutil - they are nicely readable.<br><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2723544d-b9da-47f0-bea0-0765feb51055%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2723544d-b9da-47f0-bea0-0765feb51055=
%40isocpp.org</a>.<br />

------=_Part_1_605999301.1472062173365--

------=_Part_0_1954622880.1472062173363--

.


Author: c.ger@gmx.de
Date: Wed, 24 Aug 2016 11:36:55 -0700 (PDT)
Raw View
------=_Part_788_1620266252.1472063816010
Content-Type: multipart/alternative;
 boundary="----=_Part_789_2053889535.1472063816010"

------=_Part_789_2053889535.1472063816010
Content-Type: text/plain; charset=UTF-8

On Wednesday, August 24, 2016 at 8:09:33 PM UTC+2, 3dw...@verizon.net wrote:
>
>
> Won't fold expressions allow something like this?
>
> template<typename... TMatrixen>
>   auto add(const TMatrixen&... m)
>   -> std::enable_if_t<(... && is_matrix_v<TMatrixen>), matrix<double>>;
>
>
> my syntax may be off but I think something like it should do the trick.
> OTOH, just because something is easier to implement in the language
> doesn't make the library components inutil - they are nicely readable.
>

Yes, fold expressions would allow something like this, but that would only
work if you have a parameter pack. Some of the examples I showed in the
initial post illustrate how you could also utilize the proposed meta traits
with a fixed number of template parameters.

Beside the readability, there would also be other benefits. Since these
could be implemented on the basis of 'std::conditional' etc. (see initial
post), you would get all the advantages from those, such as
short-circuiting (see the second post from Ville)

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/c29f01ff-ede1-45d9-af27-d9db0cd68a71%40isocpp.org.

------=_Part_789_2053889535.1472063816010
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, August 24, 2016 at 8:09:33 PM UTC+2, 3dw...@=
verizon.net wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr"><br>Won&#39;t fold expressions allow something like this?<br><br><div =
style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);bo=
rder-style:solid;border-width:1px;word-wrap:break-word"><code><div><span st=
yle=3D"color:#008">template</span><span style=3D"color:#660">&lt;</span><sp=
an style=3D"color:#008">typename</span><span style=3D"color:#660">...</span=
><span style=3D"color:#000"> </span><span style=3D"color:#606">TMatrixen</s=
pan><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br>=
=C2=A0 </span><span style=3D"color:#008">auto</span><span style=3D"color:#0=
00"> add</span><span style=3D"color:#660">(</span><span style=3D"color:#008=
">const</span><span style=3D"color:#000"> </span><span style=3D"color:#606"=
>TMatrixen</span><span style=3D"color:#660">&amp;...</span><span style=3D"c=
olor:#000"> m</span><span style=3D"color:#660">)</span><span style=3D"color=
:#000"><br>=C2=A0 </span><span style=3D"color:#660">-&gt;</span><span style=
=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span style=
=3D"color:#000">enable_if_t</span><span style=3D"color:#660">&lt;(...</span=
><span style=3D"color:#000"> </span><span style=3D"color:#660">&amp;&amp;</=
span><span style=3D"color:#000"> is_matrix_v</span><span style=3D"color:#66=
0">&lt;</span><span style=3D"color:#606">TMatrixen</span><span style=3D"col=
or:#660">&gt;),</span><span style=3D"color:#000"> matrix</span><span style=
=3D"color:#080">&lt;double&gt;</span><span style=3D"color:#660">&gt;;</span=
><span style=3D"color:#000"><br><br></span></div></code></div><br>my syntax=
 may be off but I think something like it should do the trick.<br>OTOH, jus=
t because something is easier to implement in the language doesn&#39;t make=
 the library components inutil - they are nicely readable.<br></div></block=
quote><div><br></div><div>Yes, fold expressions would allow something like =
this, but that would only work if you have a parameter pack. Some of the ex=
amples I showed in the initial post illustrate how you could also utilize t=
he proposed meta traits with a fixed number of template parameters.</div><d=
iv><br></div><div>Beside the readability, there would also be other benefit=
s. Since these could be implemented on the basis of &#39;std::conditional&#=
39; etc. (see initial post), you would get all the advantages from those, s=
uch as short-circuiting (see the second post from Ville)</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/c29f01ff-ede1-45d9-af27-d9db0cd68a71%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c29f01ff-ede1-45d9-af27-d9db0cd68a71=
%40isocpp.org</a>.<br />

------=_Part_789_2053889535.1472063816010--

------=_Part_788_1620266252.1472063816010--

.


Author: Farid Mehrabi <farid.mehrabi@gmail.com>
Date: Thu, 25 Aug 2016 23:01:07 +0430
Raw View
--94eb2c124a324d3f83053ae99cb5
Content-Type: text/plain; charset=UTF-8

Isn't the 'concept' proposal what you might possibly look for? It is a long
on-going discussion. you can just google for 'c++ concept'.

regards,
FM.

2016-08-12 10:41 GMT+04:30 <c.ger@gmx.de>:

> I'm not following the standardization process that closely and although I
> did some quick research I'm not sure whether something like this already
> has been proposed or is simply to trivial to be considered for the standard.
>
> When working with template-heavy code it is often necessary to use type
> traits, especially when using SFINAE to for differentiate function calls.
> With many arguments these conditions sometimes get very large, can be hard
> to read and bloat the code.
>
> Imagine you have several matrix types and want to write a function that
> adds an arbitrary combination of them together. It could be useful to
> differentiate between the matrices and other types (e.g. vectors) that
> might also have an add function. This could be done via a type trait
> 'is_matrix'.
>
> A classic version could look like the following:
>
> template <typename TMatrix1, typename TMatrix2, typename TMatrix3,
> typename TMatrix4, typename TMatrix5>
> auto add(const TMatrix1& m1, const TMatrix2& m2, const TMatrix1& m3, const
> TMatrix2& m4, TMatrix3& r)
>  -> std::enable_if_t<is_matrix<TMatrix1>::value && is_matrix<TMatrix2>::value
> && is_matrix<TMatrix3>::value &&
>  is_matrix<TMatrix4>::value && is_matrix<TMatrix5>::value>;
>
>
> Now this of course could be simplified by using variable templates --
> which might not always be available:
>
> template <typename TMatrix1, typename TMatrix2, typename TMatrix3,
> typename TMatrix4, typename TMatrix5>
> auto add(const TMatrix1& m1, const TMatrix2& m2, const TMatrix1& m3, const
> TMatrix2& m4, TMatrix3& r)
>  ->std::enable_if_t<is_matrix_v<TMatrix1> && is_matrix_v<TMatrix2> &&
> is_matrix_v<TMatrix3> &&
>  is_matrix_v<TMatrix4> && is_matrix_v<TMatrix5>>;
>
>
> Or alternatively in C++17:
>
> template <typename TMatrix1, typename TMatrix2, typename TMatrix3,
> typename TMatrix4, typename TMatrix5>
> auto add(const TMatrix1& m1, const TMatrix2& m2, const TMatrix1& m3, const
> TMatrix2& m4, TMatrix3& r)
> -> std::enable_if_t<std::conjunction_v<is_matrix<TMatrix1>, is_matrix<
> TMatrix2>,
>  is_matrix<TMatrix3>, is_matrix<TMatrix4>, is_matrix<TMatrix5>>;
>
>
> This problem gets even worse with longer names for the type traits:
>
> template <typename T1, typename T2, typename T3, typename T4>
> auto foo(T1&& t1, T2&& t2, T3&& t3, T4&& t4)
> {
>  using namespace std;
>  static_assert(has_unique_object_representations_v<T1> &&
> has_unique_object_representations_v<T2> &&
>  has_unique_object_representations_v<T3> && has_unique_object_
> representations_v<T4>, "not allowed");
> }
>
>
> What about variadic templates where you only have a parameter pack? In
> C++17 this can be done with a little trickery, if you do know how:
>
> template <typename... Ts>
> auto bar(Ts&&... ts)
> {
>  using namespace std;
>  static_assert(conjunction_v<negation<is_lvalue_reference<Ts>>...>, "not
> allowed");
> }
>
>
> As you can see, although many of this is already currently possible -- or
> probably will be in C++17 -- the solutions are longer than you want them to
> and/or require some tricks. Of course these problems can be mitigated by
> using variable and alias templates or implementing custom types. But that
> is all extra code that you have to implement.
>
> Why not have 'all_of', 'none_of' or 'any_of' meta types in the STL,
> similar to those in the algorithm header, only for type traits?
>
> Above examples could be written like this:
>
> template <typename TMatrix1, typename TMatrix2, typename TMatrix3,
> typename TMatrix4, typename TMatrix5>
> auto add(const TMatrix1& m1, const TMatrix2& m2, const TMatrix1& m3, const
> TMatrix2& m4, TMatrix3& r)
> ->std::enable_if_t<std::all_of_v<is_matrix, TMatrix1, TMatrix2, TMatrix3,
> TMatrix4, TMatrix5>>;
>
>
> template <typename T1, typename T2, typename T3, typename T4>
> auto foo(T1&& t1, T2&& t2, T3&& t3, T4&& t4)
> {
>  using namespace std;
>  static_assert(all_of_v<has_unique_object_representations, T1, T2, T3, T4
> >, "not allowed");
> }
>
>
> template <typename... Ts>
> auto bar(Ts&&... ts)
> {
>  using namespace std;
>  static_assert(none_of_v<is_lvalue_reference, Ts...>, "not allowed");
> }
>
>
> Not only are these solutions shorter, they also make the intention clearer
> and the code probably easier to understand. Template-heavy code ist hard to
> read as it is and does not need to get bloated even further when
> unnecessary. This is a tiny proposal that can be implemented in a quite
> elegant way using already proposed C++17 features:
>
> template <template <typename> class Pred, typename... Ts>
> struct all_of : std::conjunction<Pred<Ts>...>::type {};
>
>
> template <template <typename> class Pred, typename... Ts>
> constexpr bool all_of_v = all_of<Pred, Ts...>::value;
>
>
> template <template <typename> class Pred, typename... Ts>
> struct none_of : std::conjunction<std::negation<Pred<Ts>>...>::type {};
>
>
> template <template <typename> class Pred, typename... Ts>
> constexpr bool none_of_v = none_of<Pred, Ts...>::value;
>
>
> template <template <typename> class Pred, typename... Ts>
> struct any_of : std::disjunction<Pred<Ts>...>::type {};
>
>
> template <template <typename> class Pred, typename... Ts>
> constexpr bool any_of_v = any_of<Pred, Ts...>::value;
>
>
> This of course would also allow an easy implementation of 'enable_if_all',
> 'enable_if_none' and 'enable_if_any'.
>
> This should conform to the standard, but I'm no one hundred percent sure.
> At the moment I can only test it with VS2015.
>
> I'm aware some of the examples might be a little contrived, but I hope you
> get my point :)
>
> Thoughts?
>
> --
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/86d96e28-f584-4c32-
> 86dc-41f9906c7bda%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/86d96e28-f584-4c32-86dc-41f9906c7bda%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>



--
how am I supposed to end the twisted road of  your hair in such a dark
night??
unless the candle of your face does shed some light upon my way!!!

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALDL7dEVZ3rh%2BA6keS%2B1H6b86ra-r4e-nEXM4hpjmv%2BqphRiZQ%40mail.gmail.com.

--94eb2c124a324d3f83053ae99cb5
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"rtl"><div class=3D"gmail_default" style=3D"text-align:left;font=
-family:&quot;arial narrow&quot;,sans-serif;font-size:large" dir=3D"ltr">Is=
n&#39;t the &#39;concept&#39; proposal what you might possibly look for? It=
 is a long on-going discussion. you can just google for &#39;c++ concept&#3=
9;.=C2=A0</div><div class=3D"gmail_default" style=3D"text-align:left;font-f=
amily:&quot;arial narrow&quot;,sans-serif;font-size:large" dir=3D"ltr"><br>=
</div><div class=3D"gmail_default" style=3D"text-align:right;font-family:&q=
uot;arial narrow&quot;,sans-serif;font-size:large" dir=3D"ltr">regards,</di=
v><div class=3D"gmail_default" style=3D"text-align:right;font-family:&quot;=
arial narrow&quot;,sans-serif;font-size:large" dir=3D"ltr">FM.</div></div><=
div class=3D"gmail_extra"><br><div class=3D"gmail_quote"><div dir=3D"ltr">2=
016-08-12 10:41 GMT+04:30  <span dir=3D"ltr">&lt;<a href=3D"mailto:c.ger@gm=
x.de" target=3D"_blank">c.ger@gmx.de</a>&gt;</span>:</div><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr"><div>I&#39;m not following the standardizati=
on process that closely and although I did some quick research I&#39;m not =
sure whether something like this already has been proposed or is simply to =
trivial to be considered for the standard.</div><div><br></div><div>When wo=
rking with template-heavy code it is often necessary to use type traits, es=
pecially when using SFINAE to for differentiate function calls. With many a=
rguments these conditions sometimes get very large, can be hard to read and=
 bloat the code.</div><div><br></div><div>Imagine you have several matrix t=
ypes and want to write a function that adds an arbitrary combination of the=
m together. It could be useful to differentiate between the matrices and ot=
her types (e.g. vectors) that might also have an add function. This could b=
e done via a type trait &#39;is_matrix&#39;.</div><div><br></div><div>A cla=
ssic version could look like the following:</div><div><br></div><div style=
=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;background-color=
:rgb(250,250,250)"><code><div><span style=3D"color:#008">template</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#660">&lt;</span><span=
 style=3D"color:#008">typename</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#606">TMatrix1</span><span style=3D"color:#660">,</span><=
span style=3D"color:#000"> </span><span style=3D"color:#008">typename</span=
><span style=3D"color:#000"> </span><span style=3D"color:#606">TMatrix2</sp=
an><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#008">typename</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#606">TMatrix3</span><span style=3D"color:#660">,</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#008">typename</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#606">TMatrix4<=
/span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span=
><span style=3D"color:#008">typename</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#606">TMatrix5</span><span style=3D"color:#660">&gt=
;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">au=
to</span><span style=3D"color:#000"> add</span><span style=3D"color:#660">(=
</span><span style=3D"color:#008">const</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#606">TMatrix1</span><span style=3D"color:#660">=
&amp;</span><span style=3D"color:#000"> m1</span><span style=3D"color:#660"=
>,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">cons=
t</span><span style=3D"color:#000"> </span><span style=3D"color:#606">TMatr=
ix2</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"=
> m2</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#008">const</span><span style=3D"color:#000"> </=
span><span style=3D"color:#606">TMatrix1</span><span style=3D"color:#660">&=
amp;</span><span style=3D"color:#000"> m3</span><span style=3D"color:#660">=
,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">const=
</span><span style=3D"color:#000"> </span><span style=3D"color:#606">TMatri=
x2</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000">=
 m4</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </=
span><span style=3D"color:#606">TMatrix3</span><span style=3D"color:#660">&=
amp;</span><span style=3D"color:#000"> r</span><span style=3D"color:#660">)=
</span><span style=3D"color:#000"><br>=C2=A0</span><span style=3D"color:#66=
0">-&gt;</span><span style=3D"color:#000"> std</span><span style=3D"color:#=
660">::</span><span style=3D"color:#000">enable_if_t</span><span style=3D"c=
olor:#660">&lt;</span><span style=3D"color:#000">is_matrix</span><span styl=
e=3D"color:#660">&lt;</span><span style=3D"color:#606">TMa<wbr>trix1</span>=
<span style=3D"color:#660">&gt;::</span><span style=3D"color:#000">value </=
span><span style=3D"color:#660">&amp;&amp;</span><span style=3D"color:#000"=
> is_matrix</span><span style=3D"color:#660">&lt;</span><span style=3D"colo=
r:#606">TMatrix2</span><span style=3D"color:#660">&gt;::</span><span style=
=3D"color:#000">value </span><span style=3D"color:#660">&amp;&amp;</span><s=
pan style=3D"color:#000"> is_matrix</span><span style=3D"color:#660">&lt;</=
span><span style=3D"color:#606">TMatrix3</span><span style=3D"color:#660">&=
gt;::</span><span style=3D"color:#000">value </span><span style=3D"color:#6=
60">&amp;&amp;</span><span style=3D"color:#000"><br>=C2=A0is_matrix</span><=
span style=3D"color:#660">&lt;</span><span style=3D"color:#606">TMatrix4</s=
pan><span style=3D"color:#660">&gt;::</span><span style=3D"color:#000">valu=
e </span><span style=3D"color:#660">&amp;&amp;</span><span style=3D"color:#=
000"> is_matrix</span><span style=3D"color:#660">&lt;</span><span style=3D"=
color:#606">TMatrix5</span><span style=3D"color:#660">&gt;::</span><span st=
yle=3D"color:#000">value</span><span style=3D"color:#660">&gt;;</span></div=
></code></div><div><br></div><div>=C2=A0=C2=A0</div><div>Now this of course=
 could be simplified by using variable templates -- which might not always =
be available:</div><div><br></div><div style=3D"border:1px solid rgb(187,18=
7,187);word-wrap:break-word;background-color:rgb(250,250,250)"><code><div><=
span style=3D"color:#008">template</span><span style=3D"color:#000"> </span=
><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">typename<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#606">TMatrix=
1</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#008">typename</span><span style=3D"color:#000"> </=
span><span style=3D"color:#606">TMatrix2</span><span style=3D"color:#660">,=
</span><span style=3D"color:#000"> </span><span style=3D"color:#008">typena=
me</span><span style=3D"color:#000"> </span><span style=3D"color:#606">TMat=
rix3</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#008">typename</span><span style=3D"color:#000">=
 </span><span style=3D"color:#606">TMatrix4</span><span style=3D"color:#660=
">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">typ=
ename</span><span style=3D"color:#000"> </span><span style=3D"color:#606">T=
Matrix5</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#0=
00"><br></span><span style=3D"color:#008">auto</span><span style=3D"color:#=
000"> add</span><span style=3D"color:#660">(</span><span style=3D"color:#00=
8">const</span><span style=3D"color:#000"> </span><span style=3D"color:#606=
">TMatrix1</span><span style=3D"color:#660">&amp;</span><span style=3D"colo=
r:#000"> m1</span><span style=3D"color:#660">,</span><span style=3D"color:#=
000"> </span><span style=3D"color:#008">const</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#606">TMatrix2</span><span style=3D"color:=
#660">&amp;</span><span style=3D"color:#000"> m2</span><span style=3D"color=
:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008=
">const</span><span style=3D"color:#000"> </span><span style=3D"color:#606"=
>TMatrix1</span><span style=3D"color:#660">&amp;</span><span style=3D"color=
:#000"> m3</span><span style=3D"color:#660">,</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#008">const</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#606">TMatrix2</span><span style=3D"color:#=
660">&amp;</span><span style=3D"color:#000"> m4</span><span style=3D"color:=
#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#606"=
>TMatrix3</span><span style=3D"color:#660">&amp;</span><span style=3D"color=
:#000"> r</span><span style=3D"color:#660">)</span><span style=3D"color:#00=
0"><br>=C2=A0</span><span style=3D"color:#660">-&gt;</span><span style=3D"c=
olor:#000">std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">enable_if_t</span><span style=3D"color:#660">&lt;</span><span styl=
e=3D"color:#000">is_matrix_<wbr>v</span><span style=3D"color:#660">&lt;</sp=
an><span style=3D"color:#606">TMatrix1</span><span style=3D"color:#660">&gt=
;</span><span style=3D"color:#000"> </span><span style=3D"color:#660">&amp;=
&amp;</span><span style=3D"color:#000"> is_matrix_v</span><span style=3D"co=
lor:#660">&lt;</span><span style=3D"color:#606">TMatrix2</span><span style=
=3D"color:#660">&gt;</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">&amp;&amp;</span><span style=3D"color:#000"> is_matrix_v</s=
pan><span style=3D"color:#660">&lt;</span><span style=3D"color:#606">TMatri=
x3</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"> =
</span><span style=3D"color:#660">&amp;&amp;</span><span style=3D"color:#00=
0"><br>=C2=A0is_matrix_v</span><span style=3D"color:#660">&lt;</span><span =
style=3D"color:#606">TMatrix4</span><span style=3D"color:#660">&gt;</span><=
span style=3D"color:#000"> </span><span style=3D"color:#660">&amp;&amp;</sp=
an><span style=3D"color:#000"> is_matrix_v</span><span style=3D"color:#660"=
>&lt;</span><span style=3D"color:#606">TMatrix5</span><span style=3D"color:=
#660">&gt;&gt;;</span></div></code></div><div><br></div><div>=C2=A0=C2=A0</=
div><div>Or alternatively in C++17:</div><div><br></div><div style=3D"borde=
r:1px solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,=
250,250)"><code><div><span style=3D"color:#008">template</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">&lt;</span><span style=
=3D"color:#008">typename</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#606">TMatrix1</span><span style=3D"color:#660">,</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#008">typename</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#606">TMatrix2</span><sp=
an style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#008">typename</span><span style=3D"color:#000"> </span><span =
style=3D"color:#606">TMatrix3</span><span style=3D"color:#660">,</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#008">typename</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#606">TMatrix4</span>=
<span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span=
 style=3D"color:#008">typename</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#606">TMatrix5</span><span style=3D"color:#660">&gt;</spa=
n><span style=3D"color:#000"><br></span><span style=3D"color:#008">auto</sp=
an><span style=3D"color:#000"> add</span><span style=3D"color:#660">(</span=
><span style=3D"color:#008">const</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#606">TMatrix1</span><span style=3D"color:#660">&amp;<=
/span><span style=3D"color:#000"> m1</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#008">const</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#606">TMatrix2</s=
pan><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"> m2</=
span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#008">const</span><span style=3D"color:#000"> </span><=
span style=3D"color:#606">TMatrix1</span><span style=3D"color:#660">&amp;</=
span><span style=3D"color:#000"> m3</span><span style=3D"color:#660">,</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#008">const</span=
><span style=3D"color:#000"> </span><span style=3D"color:#606">TMatrix2</sp=
an><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"> m4</s=
pan><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><=
span style=3D"color:#606">TMatrix3</span><span style=3D"color:#660">&amp;</=
span><span style=3D"color:#000"> r</span><span style=3D"color:#660">)</span=
><span style=3D"color:#000"><br></span><span style=3D"color:#660">-&gt;</sp=
an><span style=3D"color:#000"> std</span><span style=3D"color:#660">::</spa=
n><span style=3D"color:#000">enable_if_t</span><span style=3D"color:#660">&=
lt;</span><span style=3D"color:#000">std</span><span style=3D"color:#660">:=
:</span><span style=3D"color:#000">conjunct<wbr>ion_v</span><span style=3D"=
color:#660">&lt;</span><span style=3D"color:#000">is_matrix</span><span sty=
le=3D"color:#660">&lt;</span><span style=3D"color:#606">TMatrix1</span><spa=
n style=3D"color:#660">&gt;,</span><span style=3D"color:#000"> is_matrix</s=
pan><span style=3D"color:#660">&lt;</span><span style=3D"color:#606">TMatri=
x2</span><span style=3D"color:#660">&gt;,</span><span style=3D"color:#000">=
<br>=C2=A0is_matrix</span><span style=3D"color:#660">&lt;</span><span style=
=3D"color:#606">TMatrix3</span><span style=3D"color:#660">&gt;,</span><span=
 style=3D"color:#000"> is_matrix</span><span style=3D"color:#660">&lt;</spa=
n><span style=3D"color:#606">TMatrix4</span><span style=3D"color:#660">&gt;=
,</span><span style=3D"color:#000"> is_matrix</span><span style=3D"color:#6=
60">&lt;</span><span style=3D"color:#606">TMatrix5</span><span style=3D"col=
or:#660">&gt;&gt;;</span></div></code></div><div><br></div><div>=C2=A0=C2=
=A0</div><div>This problem gets even worse with longer names for the type t=
raits:</div><div><br></div><div style=3D"border:1px solid rgb(187,187,187);=
word-wrap:break-word;background-color:rgb(250,250,250)"><code><div><span st=
yle=3D"color:#008">template</span><span style=3D"color:#000"> </span><span =
style=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</span><=
span style=3D"color:#000"> T1</span><span style=3D"color:#660">,</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#008">typename</span><s=
pan style=3D"color:#000"> T2</span><span style=3D"color:#660">,</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#008">typename</span><sp=
an style=3D"color:#000"> T3</span><span style=3D"color:#660">,</span><span =
style=3D"color:#000"> </span><span style=3D"color:#008">typename</span><spa=
n style=3D"color:#000"> T4</span><span style=3D"color:#660">&gt;</span><spa=
n style=3D"color:#000"><br></span><span style=3D"color:#008">auto</span><sp=
an style=3D"color:#000"> foo</span><span style=3D"color:#660">(</span><span=
 style=3D"color:#000">T1</span><span style=3D"color:#660">&amp;&amp;</span>=
<span style=3D"color:#000"> t1</span><span style=3D"color:#660">,</span><sp=
an style=3D"color:#000"> T2</span><span style=3D"color:#660">&amp;&amp;</sp=
an><span style=3D"color:#000"> t2</span><span style=3D"color:#660">,</span>=
<span style=3D"color:#000"> T3</span><span style=3D"color:#660">&amp;&amp;<=
/span><span style=3D"color:#000"> t3</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> T4</span><span style=3D"color:#660">&amp;&am=
p;</span><span style=3D"color:#000"> t4</span><span style=3D"color:#660">)<=
/span><span style=3D"color:#000"><br></span><span style=3D"color:#660">{</s=
pan><span style=3D"color:#000"><br>=C2=A0</span><span style=3D"color:#008">=
using</span><span style=3D"color:#000"> </span><span style=3D"color:#008">n=
amespace</span><span style=3D"color:#000"> std</span><span style=3D"color:#=
660">;</span><span style=3D"color:#000"><br>=C2=A0</span><span style=3D"col=
or:#008">static_assert</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">has_unique_<wbr>object_representations_v</span><span style=
=3D"color:#660">&lt;</span><span style=3D"color:#000">T1</span><span style=
=3D"color:#660">&gt;</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">&amp;&amp;</span><span style=3D"color:#000"> has_unique_obj=
ect_<wbr>representations_v</span><span style=3D"color:#660">&lt;</span><spa=
n style=3D"color:#000">T2</span><span style=3D"color:#660">&gt;</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#660">&amp;&amp;</span><=
span style=3D"color:#000"><br>=C2=A0has_unique_object_<wbr>representations_=
v</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000">T3=
</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"> </=
span><span style=3D"color:#660">&amp;&amp;</span><span style=3D"color:#000"=
> has_unique_object_<wbr>representations_v</span><span style=3D"color:#660"=
>&lt;</span><span style=3D"color:#000">T4</span><span style=3D"color:#660">=
&gt;,</span><span style=3D"color:#000"> </span><span style=3D"color:#080">&=
quot;not allowed&quot;</span><span style=3D"color:#660">);</span><span styl=
e=3D"color:#000"><br></span><span style=3D"color:#660">}</span></div></code=
></div><div><br></div><div><br></div><div>What about variadic templates whe=
re you only have a parameter pack? In C++17 this can be done with a little =
trickery, if you do know how:</div><div><br></div><div style=3D"border:1px =
solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,25=
0)"><code><div><span style=3D"color:#008">template</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#660">&lt;</span><span style=3D"color=
:#008">typename</span><span style=3D"color:#660">...</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#606">Ts</span><span style=3D"color=
:#660">&gt;</span><span style=3D"color:#000"><br></span><span style=3D"colo=
r:#008">auto</span><span style=3D"color:#000"> bar</span><span style=3D"col=
or:#660">(</span><span style=3D"color:#606">Ts</span><span style=3D"color:#=
660">&amp;&amp;...</span><span style=3D"color:#000"> ts</span><span style=
=3D"color:#660">)</span><span style=3D"color:#000"><br></span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0</span><span s=
tyle=3D"color:#008">using</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#008">namespace</span><span style=3D"color:#000"> std</span><s=
pan style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0</spa=
n><span style=3D"color:#008">static_assert</span><span style=3D"color:#660"=
>(</span><span style=3D"color:#000">conjunction_v</span><span style=3D"colo=
r:#660">&lt;</span><span style=3D"color:#000">n<wbr>egation</span><span sty=
le=3D"color:#660">&lt;</span><span style=3D"color:#000">is_lvalue_reference=
</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#606">Ts<=
/span><span style=3D"color:#660"><wbr>&gt;&gt;...&gt;,</span><span style=3D=
"color:#000"> </span><span style=3D"color:#080">&quot;not allowed&quot;</sp=
an><span style=3D"color:#660">);</span><span style=3D"color:#000"><br></spa=
n><span style=3D"color:#660">}</span></div></code></div><div><br></div><div=
><br></div><div>As you can see, although many of this is already currently =
possible -- or probably will be in C++17 -- the solutions are longer than y=
ou want them to and/or require some tricks. Of course these problems can be=
 mitigated by using variable and alias templates or implementing custom typ=
es. But that is all extra code that you have to implement.</div><div><br></=
div><div>Why not have &#39;all_of&#39;, &#39;none_of&#39; or &#39;any_of&#3=
9; meta types in the STL, similar to those in the algorithm header, only fo=
r type traits?</div><div><br></div><div>Above examples could be written lik=
e this:</div><div><br></div><div style=3D"border:1px solid rgb(187,187,187)=
;word-wrap:break-word;background-color:rgb(250,250,250)"><code><div><span s=
tyle=3D"color:#008">template</span><span style=3D"color:#000"> </span><span=
 style=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#606">TMatrix1</spa=
n><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#008">typename</span><span style=3D"color:#000"> </span><=
span style=3D"color:#606">TMatrix2</span><span style=3D"color:#660">,</span=
><span style=3D"color:#000"> </span><span style=3D"color:#008">typename</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#606">TMatrix3</=
span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#008">typename</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#606">TMatrix4</span><span style=3D"color:#660">,</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#008">typename<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#606">TMatrix=
5</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"><b=
r></span><span style=3D"color:#008">auto</span><span style=3D"color:#000"> =
add</span><span style=3D"color:#660">(</span><span style=3D"color:#008">con=
st</span><span style=3D"color:#000"> </span><span style=3D"color:#606">TMat=
rix1</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000=
"> m1</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
</span><span style=3D"color:#008">const</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#606">TMatrix2</span><span style=3D"color:#660">=
&amp;</span><span style=3D"color:#000"> m2</span><span style=3D"color:#660"=
>,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">cons=
t</span><span style=3D"color:#000"> </span><span style=3D"color:#606">TMatr=
ix1</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"=
> m3</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#008">const</span><span style=3D"color:#000"> </=
span><span style=3D"color:#606">TMatrix2</span><span style=3D"color:#660">&=
amp;</span><span style=3D"color:#000"> m4</span><span style=3D"color:#660">=
,</span><span style=3D"color:#000"> </span><span style=3D"color:#606">TMatr=
ix3</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"=
> r</span><span style=3D"color:#660">)</span><span style=3D"color:#000"><br=
></span><span style=3D"color:#660">-&gt;</span><span style=3D"color:#000">s=
td</span><span style=3D"color:#660">::</span><span style=3D"color:#000">ena=
ble_if_t</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#=
000">std</span><span style=3D"color:#660">::</span><span style=3D"color:#00=
0">all_<wbr>of_v</span><span style=3D"color:#660">&lt;</span><span style=3D=
"color:#000">is_matrix</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">TMatrix1</span><span sty=
le=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D=
"color:#606">TMatrix2</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">TMatrix3</span><span sty=
le=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D=
"color:#606">TMatrix4</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">TMatrix5</span><span sty=
le=3D"color:#660">&gt;&gt;;</span><span style=3D"color:#000"><br><br><br></=
span><span style=3D"color:#008">template</span><span style=3D"color:#000"> =
</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">typ=
ename</span><span style=3D"color:#000"> T1</span><span style=3D"color:#660"=
>,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">type=
name</span><span style=3D"color:#000"> T2</span><span style=3D"color:#660">=
,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">typen=
ame</span><span style=3D"color:#000"> T3</span><span style=3D"color:#660">,=
</span><span style=3D"color:#000"> </span><span style=3D"color:#008">typena=
me</span><span style=3D"color:#000"> T4</span><span style=3D"color:#660">&g=
t;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">a=
uto</span><span style=3D"color:#000"> foo</span><span style=3D"color:#660">=
(</span><span style=3D"color:#000">T1</span><span style=3D"color:#660">&amp=
;&amp;</span><span style=3D"color:#000"> t1</span><span style=3D"color:#660=
">,</span><span style=3D"color:#000"> T2</span><span style=3D"color:#660">&=
amp;&amp;</span><span style=3D"color:#000"> t2</span><span style=3D"color:#=
660">,</span><span style=3D"color:#000"> T3</span><span style=3D"color:#660=
">&amp;&amp;</span><span style=3D"color:#000"> t3</span><span style=3D"colo=
r:#660">,</span><span style=3D"color:#000"> T4</span><span style=3D"color:#=
660">&amp;&amp;</span><span style=3D"color:#000"> t4</span><span style=3D"c=
olor:#660">)</span><span style=3D"color:#000"><br></span><span style=3D"col=
or:#660">{</span><span style=3D"color:#000"><br>=C2=A0</span><span style=3D=
"color:#008">using</span><span style=3D"color:#000"> </span><span style=3D"=
color:#008">namespace</span><span style=3D"color:#000"> std</span><span sty=
le=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0</span><span=
 style=3D"color:#008">static_assert</span><span style=3D"color:#660">(</spa=
n><span style=3D"color:#000">all_of_v</span><span style=3D"color:#660">&lt;=
</span><span style=3D"color:#000">has_<wbr>unique_object_representations</s=
pan><span style=3D"color:#660">,</span><span style=3D"color:#000"> T1</span=
><span style=3D"color:#660">,</span><span style=3D"color:#000"> T2</span><s=
pan style=3D"color:#660">,</span><span style=3D"color:#000"> T3</span><span=
 style=3D"color:#660">,</span><span style=3D"color:#000"> T4</span><span st=
yle=3D"color:#660">&gt;,</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#080">&quot;not allowed&quot;</span><span style=3D"color:#660">=
);</span><span style=3D"color:#000"><br></span><span style=3D"color:#660">}=
</span><span style=3D"color:#000"><br><br><br></span><span style=3D"color:#=
008">template</span><span style=3D"color:#000"> </span><span style=3D"color=
:#660">&lt;</span><span style=3D"color:#008">typename</span><span style=3D"=
color:#660">...</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#606">Ts</span><span style=3D"color:#660">&gt;</span><span style=3D"colo=
r:#000"><br></span><span style=3D"color:#008">auto</span><span style=3D"col=
or:#000"> bar</span><span style=3D"color:#660">(</span><span style=3D"color=
:#606">Ts</span><span style=3D"color:#660">&amp;&amp;...</span><span style=
=3D"color:#000"> ts</span><span style=3D"color:#660">)</span><span style=3D=
"color:#000"><br></span><span style=3D"color:#660">{</span><span style=3D"c=
olor:#000"><br>=C2=A0</span><span style=3D"color:#008">using</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#008">namespace</span><span=
 style=3D"color:#000"> std</span><span style=3D"color:#660">;</span><span s=
tyle=3D"color:#000"><br>=C2=A0</span><span style=3D"color:#008">static_asse=
rt</span><span style=3D"color:#660">(</span><span style=3D"color:#000">none=
_of_v</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000=
">is_<wbr>lvalue_reference</span><span style=3D"color:#660">,</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#606">Ts</span><span style=
=3D"color:#660">...&gt;,</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#080">&quot;not allowed&quot;</span><span style=3D"color:#660">=
);</span><span style=3D"color:#000"><br></span><span style=3D"color:#660">}=
</span></div></code></div><div><br></div><div><br></div><div>Not only are t=
hese solutions shorter, they also make the intention clearer and the code p=
robably easier to understand. Template-heavy code ist hard to read as it is=
 and does not need to get bloated even further when unnecessary. This is a =
tiny proposal that can be implemented in a quite elegant way using already =
proposed C++17 features:</div><div><br></div><div style=3D"border:1px solid=
 rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,250)"><=
code><div><span style=3D"color:#008">template</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008=
">template</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
80">&lt;typename&gt;</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">class</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">Pred</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">typename</span><span sty=
le=3D"color:#660">...</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">Ts</span><span style=3D"color:#660">&gt;</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#008">struct</span><span st=
yle=3D"color:#000"> all_of </span><span style=3D"color:#660">:</span><span =
style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span s=
tyle=3D"color:#000">conjunction</span><span style=3D"color:#660">&lt;</span=
><span style=3D"color:#606">Pred</span><span style=3D"color:#660">&lt;</spa=
n><span style=3D"color:#606">Ts</span><span style=3D"color:#660">&gt;...&gt=
;:<wbr>:</span><span style=3D"color:#000">type </span><span style=3D"color:=
#660">{};</span><span style=3D"color:#000"><br><br><br></span><span style=
=3D"color:#008">template</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#660">&lt;</span><span style=3D"color:#008">template</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#080">&lt;typename&gt;<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#008">class</=
span><span style=3D"color:#000"> </span><span style=3D"color:#606">Pred</sp=
an><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#008">typename</span><span style=3D"color:#660">...</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#606">Ts</span><s=
pan style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></span><=
span style=3D"color:#008">constexpr</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#008">bool</span><span style=3D"color:#000"> all_of_=
v </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> a=
ll_of</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#606=
">Pred</span><span style=3D"color:#660">,</span><span style=3D"color:#000">=
 </span><span style=3D"color:#606">Ts</span><span style=3D"color:#660">...&=
gt;::</span><span style=3D"color:#000">value</span><span style=3D"color:#66=
0">;</span><span style=3D"color:#000"><br><br><br></span><span style=3D"col=
or:#008">template</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#660">&lt;</span><span style=3D"color:#008">template</span><span style=
=3D"color:#000"> </span><span style=3D"color:#080">&lt;typename&gt;</span><=
span style=3D"color:#000"> </span><span style=3D"color:#008">class</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#606">Pred</span><spa=
n style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#008">typename</span><span style=3D"color:#660">...</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#606">Ts</span><span sty=
le=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></span><span st=
yle=3D"color:#008">struct</span><span style=3D"color:#000"> none_of </span>=
<span style=3D"color:#660">:</span><span style=3D"color:#000"> std</span><s=
pan style=3D"color:#660">::</span><span style=3D"color:#000">conjunction</s=
pan><span style=3D"color:#660">&lt;</span><span style=3D"color:#000">std</s=
pan><span style=3D"color:#660">::</span><span style=3D"color:#000">negation=
</span><span style=3D"color:#660"><wbr>&lt;</span><span style=3D"color:#606=
">Pred</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#60=
6">Ts</span><span style=3D"color:#660">&gt;&gt;...&gt;::</span><span style=
=3D"color:#000">type </span><span style=3D"color:#660">{};</span><span styl=
e=3D"color:#000"><br><br><br></span><span style=3D"color:#008">template</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#660">&lt;</span=
><span style=3D"color:#008">template</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#080">&lt;typename&gt;</span><span style=3D"color:#=
000"> </span><span style=3D"color:#008">class</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#606">Pred</span><span style=3D"color:#660=
">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">typ=
ename</span><span style=3D"color:#660">...</span><span style=3D"color:#000"=
> </span><span style=3D"color:#606">Ts</span><span style=3D"color:#660">&gt=
;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">co=
nstexpr</span><span style=3D"color:#000"> </span><span style=3D"color:#008"=
>bool</span><span style=3D"color:#000"> none_of_v </span><span style=3D"col=
or:#660">=3D</span><span style=3D"color:#000"> none_of</span><span style=3D=
"color:#660">&lt;</span><span style=3D"color:#606">Pred</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#606">Ts</span><span style=3D"color:#660">...&gt;::</span><span style=
=3D"color:#000">value</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br><br><br></span><span style=3D"color:#008">template</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#660">&lt;</span>=
<span style=3D"color:#008">template</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#080">&lt;typename&gt;</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#008">class</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#606">Pred</span><span style=3D"color:#660"=
>,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">type=
name</span><span style=3D"color:#660">...</span><span style=3D"color:#000">=
 </span><span style=3D"color:#606">Ts</span><span style=3D"color:#660">&gt;=
</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">str=
uct</span><span style=3D"color:#000"> any_of </span><span style=3D"color:#6=
60">:</span><span style=3D"color:#000"> std</span><span style=3D"color:#660=
">::</span><span style=3D"color:#000">disjunction</span><span style=3D"colo=
r:#660">&lt;</span><span style=3D"color:#606">Pred</span><span style=3D"col=
or:#660">&lt;</span><span style=3D"color:#606">Ts</span><span style=3D"colo=
r:#660">&gt;...&gt;:<wbr>:</span><span style=3D"color:#000">type </span><sp=
an style=3D"color:#660">{};</span><span style=3D"color:#000"><br><br><br></=
span><span style=3D"color:#008">template</span><span style=3D"color:#000"> =
</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">tem=
plate</span><span style=3D"color:#000"> </span><span style=3D"color:#080">&=
lt;typename&gt;</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#008">class</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#606">Pred</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000"> </span><span style=3D"color:#008">typename</span><span style=3D"colo=
r:#660">...</span><span style=3D"color:#000"> </span><span style=3D"color:#=
606">Ts</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#0=
00"><br></span><span style=3D"color:#008">constexpr</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#008">bool</span><span style=3D"colo=
r:#000"> any_of_v </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#000"> any_of</span><span style=3D"color:#660">&lt;</span><span s=
tyle=3D"color:#606">Pred</span><span style=3D"color:#660">,</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#606">Ts</span><span style=
=3D"color:#660">...&gt;::</span><span style=3D"color:#000">value</span><spa=
n style=3D"color:#660">;</span></div></code></div><div><br></div><div><br><=
/div><div>This of course would also allow an easy implementation of &#39;en=
able_if_all&#39;, &#39;enable_if_none&#39; and &#39;enable_if_any&#39;.</di=
v><div><br></div><div>This should conform to the standard, but I&#39;m no o=
ne hundred percent sure. At the moment I can only test it with VS2015.</div=
><div><br></div><div>I&#39;m aware some of the examples might be a little c=
ontrived, but I hope you get my point :)</div><div><br></div><div>Thoughts?=
 =C2=A0 =C2=A0=C2=A0</div></div><span class=3D"HOEnZb"><font color=3D"#8888=
88">

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/86d96e28-f584-4c32-86dc-41f9906c7bda%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/86d9=
6e28-f584-4c32-<wbr>86dc-41f9906c7bda%40isocpp.org</a><wbr>.<br>
</font></span></blockquote></div><br><br clear=3D"all"><div><br></div>-- <b=
r><div class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div di=
r=3D"rtl"><div><div dir=3D"ltr">how am I supposed to end the twisted road o=
f=C2=A0 your hair in such a dark night??<br>unless the candle of your face =
does shed some light upon my way!!!<br></div></div></div></div>
</div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CALDL7dEVZ3rh%2BA6keS%2B1H6b86ra-r4e-=
nEXM4hpjmv%2BqphRiZQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALDL7dEVZ3=
rh%2BA6keS%2B1H6b86ra-r4e-nEXM4hpjmv%2BqphRiZQ%40mail.gmail.com</a>.<br />

--94eb2c124a324d3f83053ae99cb5--

.