220 33956 <12275369-dca3-40aa-b37c-93d60ffc3db8@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: shmitti.guardia@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Proposal for two new traits: `std::greedy_conjunction`
 and `std::greedy_disjunction `
Date: Thu, 17 Aug 2017 03:02:56 -0700 (PDT)
Lines: 813
Approved: news@gmane.org
Message-ID: <12275369-dca3-40aa-b37c-93d60ffc3db8@isocpp.org>
References: <a79ce0b4-ca2d-4c37-b49e-cb707689a0e2@isocpp.org>
 <CAPCFJdSoAKm4SO4PQrs93ZGzH-nBexfO0X_3OEw4b5RJXqM49g@mail.gmail.com>
 <4b2924fd-0a54-45eb-a2c3-55ddbb5edd73@isocpp.org> <81a6a1fa-a331-483e-8f4d-4184c661b106@isocpp.org>
 <CAPCFJdTA7pfnGu8uQ7FBu-qj=UCJuRO78G-CYovSz9gAxPNSmw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_868_1660773175.1502964176680"
X-Trace: blaine.gmane.org 1502964183 15222 195.159.176.226 (17 Aug 2017 10:03:03 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 17 Aug 2017 10:03:03 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCSIDV7PUYJBBUOT2XGAKGQE42LAC5Y@isocpp.org Thu Aug 17 12:02:53 2017
Return-path: <std-proposals+bncBCSIDV7PUYJBBUOT2XGAKGQE42LAC5Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f70.google.com ([209.85.214.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCSIDV7PUYJBBUOT2XGAKGQE42LAC5Y@isocpp.org>)
	id 1diHdd-0003Tn-0d
	for gclcip-std-proposals@m.gmane.org; Thu, 17 Aug 2017 12:02:53 +0200
Original-Received: by mail-it0-f70.google.com with SMTP id o72sf54158837ita.3
        for <gclcip-std-proposals@m.gmane.org>; Thu, 17 Aug 2017 03:02:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=UDSVPafmqVPnh7xoupKL2jt0dZVEqaRFlN9+6NwjjjQ=;
        b=qumPdO+mwLGdNcWDiZYlLmh8YSv5B+cYoQV1ECkV8bbH6WgZne02fawA26DzfQN8HE
         QXLUjLL5jhKWTziorQKmmAYk4WbmCOHd80gOWJ6x1TzQC/RwwUuFl5QL4rQdvHU3ieoK
         Sg2lZDS4oBAr8svPnsBSz7ZLAWT2L2RcnINC6AVSScJhcP6PyxUfvxbmitC7VW/1C6h8
         jXx6YB4XTDa1OOCG3oCL/K3QNcbg7ZqvL8GYe19oPeUXjBfK5L9/SOjCaIgzYA/w4mH4
         2+ALYInaPm2aggiNM3Au4t+pdflQw8basFRUqqogRpGeeKbqpE9fhR6vjROA8n0pFdpk
         k38A==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=UDSVPafmqVPnh7xoupKL2jt0dZVEqaRFlN9+6NwjjjQ=;
        b=c+mcFCN572JuLIVsV24xuOMGd3xo9FjvBQj8R1HTAizuSeDwzUaKi4Yon95o/HYFYH
         dbQ4YdzGJ5nHflJtgbHRRegQwq9y0MHTmzJZth33S/gT7DUbdi1bbig/JFBnS2ALYCN9
         4VlZ+n2uu5e9+UY9eocO7cr+0ytol+PmoiWQSHGHsK3HLpd+zkreHfpZfOzag/+L9pUr
         FbmeiiWs0pMbq5AifdSVTzu1c1cG/DYu0i0DrxxVKT/GHOxp6IZp3shqhJi9tt1vQvPD
         CMGnqlhrx8rVchn0oVv0/4jJ7J9vwX6CAfJaCjFPm/i8QK0VMUattUS+Rs3COF0yAM6g
         3TOA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=UDSVPafmqVPnh7xoupKL2jt0dZVEqaRFlN9+6NwjjjQ=;
        b=bAucg7SUMZPXixlZV1Z51QZQN6TmRdkxpK5CAAtWBIMmsxmDcHa6ah7dYjaizeK0vJ
         0wuUOyWTujoH6gcg4uO3Qj3lVGvH6yzUEEfk70miZ7CDqUA6esRgflIX+L8x6eA8K7nN
         TG8Nyb2qAmXiWAdyk/Qk3ePSUaAxb3ht5X227Pvj3/c50JCGbUjGxkb5afFtRxe1h5ZH
         DypQYFkHwmAQc/wjlfKnLunbUhKcxQvGyL5W6ohLeHR3oJwrkZvjMcUvbM15jE4NQX9k
         eHNyrQLFwmmfsu0sYaWi2svmBl5lvn+aBlBA1NTQDq9c1HWR8SmStiTIVgeP6KGjlbq+
         x3WQ==
X-Gm-Message-State: AHYfb5gXhFiaBdc9EXAKdttgK8OuMySaIqB6YmIJAqJN6qPIxRXY4cq2
	HoZiqymUovI64bQS
X-Received: by 10.107.35.200 with SMTP id j191mr2977233ioj.51.1502964178646;
        Thu, 17 Aug 2017 03:02:58 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.25.69 with SMTP id b66ls2767965itb.19.canary-gmail; Thu, 17
 Aug 2017 03:02:57 -0700 (PDT)
X-Received: by 10.31.69.82 with SMTP id s79mr46796vka.2.1502964177220;
        Thu, 17 Aug 2017 03:02:57 -0700 (PDT)
In-Reply-To: <CAPCFJdTA7pfnGu8uQ7FBu-qj=UCJuRO78G-CYovSz9gAxPNSmw@mail.gmail.com>
X-Original-Sender: shmitti.guardia@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:33956
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33956>

------=_Part_868_1660773175.1502964176680
Content-Type: multipart/alternative; 
	boundary="----=_Part_869_151071870.1502964176681"

------=_Part_869_151071870.1502964176681
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Got it. Thank you!

W dniu czwartek, 17 sierpnia 2017 10:26:13 UTC+2 u=C5=BCytkownik Micha=C5=
=82 Dominiak=20
napisa=C5=82:
>
> What I meant is that you don't really need a specific trait.
>
> You can't obtain the result of std::{con,dis}junction directly, without=
=20
> using a layer of abstraction for the laziness.
>
> You can, however, obtain the result of the greedy operation directly - by=
=20
> just &&ing or ||ing the values of the traits you'd pass to this trait.=20
> Evaluation in templates is already eager that way, and it's no problem to=
=20
> && or || them together even in generic contexts, especially since we have=
=20
> fold expressions now.
>
> The reason for the traits that we have is laziness. If you don't need=20
> laziness, you don't need the trait.
>
> On Thu, Aug 17, 2017, 10:17 AM <mateusz...@gmail.com <javascript:>> wrote=
:
>
>> Hello again,
>> I am wondering if lack of response in this thread means that my idea has=
=20
>> been already rejected? If yes then could anyone explain why?
>>
>> I might be wrong but this is why I'm not convicted by the current=20
>> arguments:
>>
>> >You can already write your "greedy" things by just... deriving from=20
>> bool_constant directly (exactly like in your last snippet).
>> I assume that your point is that it's easy to implement by the user on=
=20
>> his own. I'm not convicted because there is a lot of stuff in the standa=
rd=20
>> library that are easy to implement, e.g. std::negation
>>
>> >Your thing doesn't seem to be very useful.
>> Not sure if I follow. If they are not useful =3D> std::conjunction and=
=20
>> disjunction are not as well (:
>> As you can see they compute almost same result as std::conjunction and=
=20
>> disjunction, plus they give a choice to the user about the compilation t=
ime.
>>
>> The only thing that concerns me here is if it's in the standard library=
=20
>> scope to care about the compilation time.
>>
>> Thanks in advance,
>> Mateusz Janek
>>
>> W dniu =C5=9Broda, 9 sierpnia 2017 23:22:53 UTC+2 u=C5=BCytkownik=20
>> mateusz...@gmail.com napisa=C5=82:
>>>
>>> These traits are as useful as current conjunction and disjunction are -=
=20
>>> they compute the same result, but additionally give user a choice about=
=20
>>> compilation time and IMO that's a useful addition.
>>>
>>> W dniu =C5=9Broda, 9 sierpnia 2017 14:37:05 UTC+2 u=C5=BCytkownik Micha=
=C5=82 Dominiak=20
>>> napisa=C5=82:
>>>>
>>>> You can already write your "greedy" things by just... deriving from=20
>>>> bool_constant directly (exactly like in your last snippet). You couldn=
't do=20
>>>> what the two traits are doing directly, and that's I believe is the on=
ly=20
>>>> justification of their existence. Your thing doesn't seem to be very u=
seful.
>>>>
>>>> On Wed, Aug 9, 2017 at 2:31 PM <mateusz...@gmail.com> wrote:
>>>>
>>>>> *Introduction*
>>>>>
>>>>> C++17 introduced besides the others two new structures in=20
>>>>> `<type_traits>` header: `std::conjuction` and `std::disjunction`. The=
y are=20
>>>>> very useful in metaprogramming, but standard has in some way forced t=
heir=20
>>>>> implementation.=20
>>>>> In p0013r1=20
>>>>> <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0013r1.html=
> we=20
>>>>> can read:
>>>>> The BaseCharacteristic of a specialization conjunction<B1, ..., BN> i=
s=20
>>>>> the first type Bi in the list true_type, B1, ..., BN for which Bi::va=
lue=20
>>>>> =3D=3D false, or if every Bi::value !=3D false the BaseCharacteristic=
 is BN.=20
>>>>> [*Note:* This means a specialization of conjunction does not=20
>>>>> necessarily have a BaseCharacteristic of either true_type or=20
>>>>> false_type. =E2=80=94 *end note*]
>>>>>
>>>>> Similar in the disjunction:=20
>>>>> The BaseCharacteristic of a specialization disjunction<B1, ..., BN> i=
s=20
>>>>> the first type Bi in the list false_type, B1, ..., BN for which Bi::v=
alue=20
>>>>> !=3D false, or if every Bi::value =3D=3D false the BaseCharacteristic=
 is BN.=20
>>>>> [*Note:* This means a specialization of disjunction does not=20
>>>>> necessarily have a BaseCharacteristic of either true_type or=20
>>>>> false_type. =E2=80=94 *end note*]
>>>>>
>>>>> I'd like to propose a two new structures in `<type_traits>`:=20
>>>>> `std::greedy_conjunction` and `std::greedy_disjunction`. Their result=
s=20
>>>>> would very similar to the ones from `std::conjunciton` and=20
>>>>> `std::disjunction`, but their specification would give more flexibili=
ty to=20
>>>>> the standard library creators.
>>>>>
>>>>>
>>>>> *Motivation and Scope*
>>>>>
>>>>> With `std::conjuction` and `std::disjunction` restrictions in the=20
>>>>> standard, library creators are forced to make them in such (or simila=
r) way:
>>>>> template<class...> struct conjunction : std::true_type { };
>>>>> template<class B1> struct conjunction<B1> : B1 { };
>>>>> template<class B1, class... Bn>
>>>>> struct conjunction<B1, Bn...>=20
>>>>>     : std::conditional_t<bool(B1::value), conjunction<Bn...>, B1> {};
>>>>>    =20
>>>>> template<class...> struct disjunction : std::false_type { };
>>>>> template<class B1> struct disjunction<B1> : B1 { };
>>>>> template<class B1, class... Bn>
>>>>> struct disjunction<B1, Bn...>=20
>>>>>     : std::conditional_t<bool(B1::value), B1, disjunction<Bn...>>  {=
=20
>>>>> };
>>>>>
>>>>>
>>>>>    =20
>>>>> There are strong grounds to keep these implementations, e.g.=20
>>>>> short-circuiting, getting information on what type, recursion stopped=
 etc.=20
>>>>> Although, because of these restrictions compilation time suffers in s=
ome=20
>>>>> cases.
>>>>>
>>>>> *Why new, very similar traits?*
>>>>> *Abstract*
>>>>> During my pull request to folly (
>>>>> https://github.com/facebook/folly/pull/643) Jay Feldblum posted there=
=20
>>>>> a small benchmark script:=20
>>>>> https://gist.github.com/yfeldblum/ffae5374aaaa11b03f08919d25b1555b (b=
ig=20
>>>>> credits for poking my brain with the idea). I was surprised that, let=
's=20
>>>>> say, the naive implementation compiles faster that the standard one.=
=20
>>>>>
>>>>> I decided to benchmark this idea deeper:
>>>>> -problem was to find in a types sequence if there is a type which=20
>>>>> T::value is equal to 0
>>>>> -for every benchmark sequence has 1024 types inside
>>>>> -tested sequences with two kinds of types: light and heavy to=20
>>>>> instantiate
>>>>> -tested best and worse cases
>>>>> -tested two new implementations: fold expression and bool-pack
>>>>> -core benchmark was to measure the compilation time with given=20
>>>>> compiler (clang++-4.0/g++-6), case (best/worse), type (light/heavy),=
=20
>>>>> implementation (proposed/standard). Every compilation case was ran 50=
0=20
>>>>> times and average result was calculated.
>>>>>
>>>>> Whole benchmarks code you can find in the gh repo:=20
>>>>> https://github.com/stryku/boolpack_vs_recursion
>>>>>
>>>>> And here are the results (sorry for not posting it here, but table wa=
s=20
>>>>> too big and it was formatted in unreadable way):
>>>>>
>>>>> https://raw.githubusercontent.com/stryku/boolpack_vs_recursion/master=
/output
>>>>>
>>>>> As you can see, standard implementation is way better when we deal=20
>>>>> with the best case. It can compile 80x(!) faster than the proposed on=
es.=20
>>>>> Problem starts when the worse cases occurs.=20
>>>>> Standard library creators would be able to implement=20
>>>>> `greedy_conjunction` and `greedy_disjunction` in a way that they comp=
iles=20
>>>>> up to around 6x faster than the standard one. Users would be able cho=
ose=20
>>>>> implementation which will suit best, based on what cases they are mos=
tly=20
>>>>> expecting.
>>>>>
>>>>> *Specification*
>>>>> Since it's a pre-proposal I don't want to post fully described=20
>>>>> specification. I'm thinking about it in this way:
>>>>>
>>>>> `std::greedy_conjunction` would be an alias or would derive from a=20
>>>>> type, which has a constexpr member `value` which can be converted to =
bool=20
>>>>> and is equal to:
>>>>> -false if any bool(Tn::value0 =3D=3D false
>>>>> -true otherwise
>>>>>
>>>>> `std::greedy_disjunction` would be an alias or would derive from a=20
>>>>> type, which has a constexpr member `value` which can be converted to =
bool=20
>>>>> and is equal to:
>>>>> -false if all bool(Tn::value) =3D=3D false
>>>>> -true otherwise
>>>>>
>>>>> *Example implementations*
>>>>> bool-pack (this one seems to compile faster than fold expression):
>>>>> template <bool... Bn>
>>>>> struct __bools {};
>>>>>
>>>>> template <typename... Tn>=20
>>>>> struct greedy_disjunction: std::negation<std::is_same<__bools<bool(Tn
>>>>> ::value)...>, __bools<(Tn::value && false)...>>> {};
>>>>>
>>>>> template <typename... Tn>=20
>>>>> struct greedy_conjunction: std::is_same<__bools<bool(Tn::value)...>,=
=20
>>>>> __bools<(Tn::value || true)...>> {};
>>>>>
>>>>>
>>>>> fold expression:
>>>>> template <typename... Tn>=20
>>>>> struct greedy_disjunction : std::bool_constant<(false || ... || bool(
>>>>> Tn::value))> {};
>>>>>
>>>>> template <typename... Tn>=20
>>>>> struct greedy_conjunction : std::bool_constant<(true && ... && bool(T=
n
>>>>> ::value))> {};
>>>>>
>>>>>
>>>>> *Wordings:*
>>>>> *There is couple of questions*
>>>>> I asked them to myself a lot, during this pre-proposal.
>>>>> -Is it in the C++ standard scope to care about how things will be=20
>>>>> implemented in standard library, even if the implementations will be =
not=20
>>>>> efficient on compile-time level?
>>>>> -Should the standard be changed because of standard library=20
>>>>> compilation time?
>>>>>
>>>>> And here's my conclusion (and reason why I'm writing this post).
>>>>> C++ standard purpose is not to specify a theoretical language. It's=
=20
>>>>> created to be used by a lot of people in the real world. Giving a cho=
ice to=20
>>>>> user between implementations which differs in a compile-time efficien=
cy is=20
>>>>> same thing as to give a choice between containers e.g. `std::vector` =
and=20
>>>>> `std::list`. In some cases one implementation is better, in others th=
e=20
>>>>> other one.
>>>>>
>>>>> *And of course the name*
>>>>> I thought about `strict_*` (like it's in Facebook/folly lib) instead=
=20
>>>>> of `greedy_*`, but I'm sure that if this proposal is a thing communit=
y will=20
>>>>> propose better names.
>>>>>
>>>>>
>>>>> What do you think?
>>>>>
>>>>> Mateusz (stryku) Janek
>>>>>
>>>>> --=20
>>>>> You received this message because you are subscribed to the Google=20
>>>>> Groups "ISO C++ Standard - Future Proposals" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, sen=
d=20
>>>>> an email to std-proposal...@isocpp.org.
>>>>> To post to this group, send email to std-pr...@isocpp.org.
>>>>> To view this discussion on the web visit=20
>>>>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/a79ce0b4=
-ca2d-4c37-b49e-cb707689a0e2%40isocpp.org=20
>>>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/a79ce0b=
4-ca2d-4c37-b49e-cb707689a0e2%40isocpp.org?utm_medium=3Demail&utm_source=3D=
footer>
>>>>> .
>>>>>
>>>> --=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit=20
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/81a6a1fa-a3=
31-483e-8f4d-4184c661b106%40isocpp.org=20
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/81a6a1fa-a=
331-483e-8f4d-4184c661b106%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoo=
ter>
>> .
>>
>

--=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/12275369-dca3-40aa-b37c-93d60ffc3db8%40isocpp.or=
g.

------=_Part_869_151071870.1502964176681
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Got it. Thank you!<br><br>W dniu czwartek, 17 sierpnia 201=
7 10:26:13 UTC+2 u=C5=BCytkownik Micha=C5=82 Dominiak napisa=C5=82:<blockqu=
ote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left=
: 1px #ccc solid;padding-left: 1ex;"><p dir=3D"ltr">What I meant is that yo=
u don&#39;t really need a specific trait.</p>
<p dir=3D"ltr">You can&#39;t obtain the result of std::{con,dis}junction di=
rectly, without using a layer of abstraction for the laziness.</p>
<p dir=3D"ltr">You can, however, obtain the result of the greedy operation =
directly - by just &amp;&amp;ing or ||ing the values of the traits you&#39;=
d pass to this trait. Evaluation in templates is already eager that way, an=
d it&#39;s no problem to &amp;&amp; or || them together even in generic con=
texts, especially since we have fold expressions now.</p>
<p dir=3D"ltr">The reason for the traits that we have is laziness. If you d=
on&#39;t need laziness, you don&#39;t need the trait.</p>
<br><div class=3D"gmail_quote"><div dir=3D"ltr">On Thu, Aug 17, 2017, 10:17=
 AM  &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D=
"942XN0vsCQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:=
&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return tru=
e;">mateusz...@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail=
_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:=
1ex"><div dir=3D"ltr"><div>Hello again,</div><div>I am wondering if lack of=
 response in this thread means that my idea has been already rejected? If y=
es then could anyone explain why?</div><div><br></div><div>I might be wrong=
 but this is why I&#39;m not convicted by the current arguments:</div></div=
><div dir=3D"ltr"><div><br></div><div>&gt;You can already write your &quot;=
greedy&quot; things by just... deriving from bool_constant directly (exactl=
y like in your last snippet).</div></div><div dir=3D"ltr"><div>I assume tha=
t your point is that it&#39;s easy to implement by the user on his own. I&#=
39;m not convicted because there is a lot of stuff in the standard library =
that are easy to implement, e.g. std::negation</div></div><div dir=3D"ltr">=
<div><br></div><div>&gt;Your thing doesn&#39;t seem to be very useful.</div=
></div><div dir=3D"ltr"><div>Not sure if I follow. If they are not useful =
=3D&gt; std::conjunction and disjunction are not as well (:</div><div>As yo=
u can see they compute almost same result as std::conjunction and disjuncti=
on, plus they give a choice to the user about the compilation time.</div><d=
iv><br></div><div>The only thing that concerns me here is if it&#39;s in th=
e standard library scope to care about the compilation time.</div><div><br>=
</div><div>Thanks in advance,</div><div>Mateusz Janek</div></div><div dir=
=3D"ltr"><br>W dniu =C5=9Broda, 9 sierpnia 2017 23:22:53 UTC+2 u=C5=BCytkow=
nik <a>mateusz...@gmail.com</a> napisa=C5=82:<blockquote class=3D"gmail_quo=
te" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-=
left:1ex"><div dir=3D"ltr">These traits are as useful as current conjunctio=
n and disjunction are - they compute the same result, but additionally give=
 user a choice about compilation time and IMO that&#39;s a useful addition.=
<br><br>W dniu =C5=9Broda, 9 sierpnia 2017 14:37:05 UTC+2 u=C5=BCytkownik M=
icha=C5=82 Dominiak napisa=C5=82:<blockquote class=3D"gmail_quote" style=3D=
"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><d=
iv dir=3D"ltr">You can already write your &quot;greedy&quot; things by just=
.... deriving from bool_constant directly (exactly like in your last snippet=
). You couldn&#39;t do what the two traits are doing directly, and that&#39=
;s I believe is the only justification of their existence. Your thing doesn=
&#39;t seem to be very useful.</div><br><div class=3D"gmail_quote"><div dir=
=3D"ltr">On Wed, Aug 9, 2017 at 2:31 PM &lt;<a rel=3D"nofollow">mateusz...@=
gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><div><b><font size=3D"4">Introduction</font></b></div><div><br></d=
iv><div>C++17 introduced besides the others two new structures in `&lt;type=
_traits&gt;` header: `std::conjuction` and `std::disjunction`. They are ver=
y useful in metaprogramming, but standard has in some way forced their impl=
ementation.=C2=A0</div><div>In <a href=3D"http://www.open-std.org/jtc1/sc22=
/wg21/docs/papers/2015/p0013r1.html" rel=3D"nofollow" target=3D"_blank" onm=
ousedown=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fww=
w.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2015%2Fp0013r1.html\x=
26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHrhD3oGJRVXphYJvzGExp6I3jexQ&#39;;re=
turn true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp=
%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2015%2Fp00=
13r1.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHrhD3oGJRVXphYJvzGExp6I3j=
exQ&#39;;return true;">p0013r1</a>=C2=A0we can read:</div><div><span style=
=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman&quot;;font-size:me=
dium;text-align:justify">The BaseCharacteristic of a specialization=C2=A0</=
span><code style=3D"color:rgb(0,160,0);text-align:justify">conjunction&lt;B=
1, ..., BN&gt;</code><span style=3D"color:rgb(0,160,0);font-family:&quot;Ti=
mes New Roman&quot;;font-size:medium;text-align:justify">=C2=A0is the first=
 type=C2=A0</span><code style=3D"color:rgb(0,160,0);text-align:justify">Bi<=
/code><span style=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman&q=
uot;;font-size:medium;text-align:justify">=C2=A0in the list=C2=A0</span><co=
de style=3D"color:rgb(0,160,0);text-align:justify">true_type, B1, ..., BN</=
code><span style=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman&qu=
ot;;font-size:medium;text-align:justify">=C2=A0for which=C2=A0</span><code =
style=3D"color:rgb(0,160,0);text-align:justify">Bi::value =3D=3D false</cod=
e><span style=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman&quot;=
;font-size:medium;text-align:justify">, or if every=C2=A0</span><code style=
=3D"color:rgb(0,160,0);text-align:justify">Bi::value !=3D false</code><span=
 style=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman&quot;;font-s=
ize:medium;text-align:justify">=C2=A0the BaseCharacteristic is=C2=A0</span>=
<code style=3D"color:rgb(0,160,0);text-align:justify">BN</code><span style=
=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman&quot;;font-size:me=
dium;text-align:justify">. [</span><em style=3D"color:rgb(0,160,0);font-fam=
ily:&quot;Times New Roman&quot;;font-size:medium;text-align:justify">Note:<=
/em><span style=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman&quo=
t;;font-size:medium;text-align:justify">=C2=A0This means a specialization o=
f=C2=A0</span><code style=3D"color:rgb(0,160,0);text-align:justify">conjunc=
tion</code><span style=3D"color:rgb(0,160,0);font-family:&quot;Times New Ro=
man&quot;;font-size:medium;text-align:justify">=C2=A0does not necessarily h=
ave a BaseCharacteristic of either=C2=A0</span><code style=3D"color:rgb(0,1=
60,0);text-align:justify">true_type</code><span style=3D"color:rgb(0,160,0)=
;font-family:&quot;Times New Roman&quot;;font-size:medium;text-align:justif=
y">=C2=A0or=C2=A0</span><code style=3D"color:rgb(0,160,0);text-align:justif=
y">false_type</code><span style=3D"color:rgb(0,160,0);font-family:&quot;Tim=
es New Roman&quot;;font-size:medium;text-align:justify"><wbr>. =E2=80=94=C2=
=A0</span><em style=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman=
&quot;;font-size:medium;text-align:justify">end note</em><span style=3D"col=
or:rgb(0,160,0);font-family:&quot;Times New Roman&quot;;font-size:medium;te=
xt-align:justify">]</span><br></div><div><span style=3D"color:rgb(0,160,0);=
font-family:&quot;Times New Roman&quot;;font-size:medium;text-align:justify=
"><br></span></div><div>Similar in the disjunction:=C2=A0</div><div><span s=
tyle=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman&quot;;font-siz=
e:medium;text-align:justify">The BaseCharacteristic of a specialization=C2=
=A0</span><code style=3D"color:rgb(0,160,0);text-align:justify">disjunction=
&lt;B1, ..., BN&gt;</code><span style=3D"color:rgb(0,160,0);font-family:&qu=
ot;Times New Roman&quot;;font-size:medium;text-align:justify">=C2=A0is the =
first type=C2=A0</span><code style=3D"color:rgb(0,160,0);text-align:justify=
">Bi</code><span style=3D"color:rgb(0,160,0);font-family:&quot;Times New Ro=
man&quot;;font-size:medium;text-align:justify">=C2=A0in the list=C2=A0</spa=
n><code style=3D"color:rgb(0,160,0);text-align:justify">false_type, B1, ...=
, BN</code><span style=3D"color:rgb(0,160,0);font-family:&quot;Times New Ro=
man&quot;;font-size:medium;text-align:justify">=C2=A0for which=C2=A0</span>=
<code style=3D"color:rgb(0,160,0);text-align:justify">Bi::value !=3D false<=
/code><span style=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman&q=
uot;;font-size:medium;text-align:justify">, or if every=C2=A0</span><code s=
tyle=3D"color:rgb(0,160,0);text-align:justify">Bi::value =3D=3D false</code=
><span style=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman&quot;;=
font-size:medium;text-align:justify">=C2=A0the BaseCharacteristic is=C2=A0<=
/span><code style=3D"color:rgb(0,160,0);text-align:justify">BN</code><span =
style=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman&quot;;font-si=
ze:medium;text-align:justify">. [</span><em style=3D"color:rgb(0,160,0);fon=
t-family:&quot;Times New Roman&quot;;font-size:medium;text-align:justify">N=
ote:</em><span style=3D"color:rgb(0,160,0);font-family:&quot;Times New Roma=
n&quot;;font-size:medium;text-align:justify">=C2=A0This means a specializat=
ion of=C2=A0</span><code style=3D"color:rgb(0,160,0);text-align:justify">di=
sjunction</code><span style=3D"color:rgb(0,160,0);font-family:&quot;Times N=
ew Roman&quot;;font-size:medium;text-align:justify">=C2=A0does not necessar=
ily have a BaseCharacteristic of either=C2=A0</span><code style=3D"color:rg=
b(0,160,0);text-align:justify">true_type</code><span style=3D"color:rgb(0,1=
60,0);font-family:&quot;Times New Roman&quot;;font-size:medium;text-align:j=
ustify">=C2=A0or=C2=A0</span><code style=3D"color:rgb(0,160,0);text-align:j=
ustify">false_type</code><span style=3D"color:rgb(0,160,0);font-family:&quo=
t;Times New Roman&quot;;font-size:medium;text-align:justify"><wbr>. =E2=80=
=94=C2=A0</span><em style=3D"color:rgb(0,160,0);font-family:&quot;Times New=
 Roman&quot;;font-size:medium;text-align:justify">end note</em><span style=
=3D"color:rgb(0,160,0);font-family:&quot;Times New Roman&quot;;font-size:me=
dium;text-align:justify">]</span><br></div><div><br></div><div>I&#39;d like=
 to propose a two new structures in `&lt;type_traits&gt;`: `std::greedy_con=
junction` and `std::greedy_disjunction`. Their results would very similar t=
o the ones from `std::conjunciton` and `std::disjunction`, but their specif=
ication would give more flexibility to the standard library creators.</div>=
<div><br></div><div><br></div><div><b><font size=3D"4">Motivation and Scope=
</font></b></div><div><br></div><div>With `std::conjuction` and `std::disju=
nction` restrictions in the standard, library creators are forced to make t=
hem in such (or similar) way:</div><div style=3D"background-color:rgb(250,2=
50,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;w=
ord-wrap:break-word"><code><div><span style=3D"color:#008">template</span><=
span style=3D"color:#660">&lt;</span><span style=3D"color:#008">class</span=
><span style=3D"color:#660">...&gt;</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#008">struct</span><span style=3D"color:#000"> conju=
nction </span><span style=3D"color:#660">:</span><span style=3D"color:#000"=
> std</span><span style=3D"color:#660">::</span><span style=3D"color:#000">=
true_type </span><span style=3D"color:#660">{</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#660">};</span><span style=3D"color:#000">=
<br></span><span style=3D"color:#008">template</span><span style=3D"color:#=
660">&lt;</span><span style=3D"color:#008">class</span><span style=3D"color=
:#000"> B1</span><span style=3D"color:#660">&gt;</span><span style=3D"color=
:#000"> </span><span style=3D"color:#008">struct</span><span style=3D"color=
:#000"> conjunction</span><span style=3D"color:#660">&lt;</span><span style=
=3D"color:#000">B1</span><span style=3D"color:#660">&gt;</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">:</span><span style=3D"c=
olor:#000"> B1 </span><span style=3D"color:#660">{</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#660">};</span><span style=3D"color:#=
000"><br></span><span style=3D"color:#008">template</span><span style=3D"co=
lor:#660">&lt;</span><span style=3D"color:#008">class</span><span style=3D"=
color:#000"> B1</span><span style=3D"color:#660">,</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#008">class</span><span style=3D"colo=
r:#660">...</span><span style=3D"color:#000"> </span><span style=3D"color:#=
606">Bn</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#0=
00"><br></span><span style=3D"color:#008">struct</span><span style=3D"color=
:#000"> conjunction</span><span style=3D"color:#660">&lt;</span><span style=
=3D"color:#000">B1</span><span style=3D"color:#660">,</span><span style=3D"=
color:#000"> </span><span style=3D"color:#606">Bn</span><span style=3D"colo=
r:#660">...&gt;</span><span style=3D"color:#000"> <br>=C2=A0 =C2=A0 </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">conditional_t<=
/span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">bool=
</span><span style=3D"color:#660">(</span><span style=3D"color:#000">B1</sp=
an><span style=3D"color:#660">::</span><span style=3D"color:#000">va<wbr>lu=
e</span><span style=3D"color:#660">),</span><span style=3D"color:#000"> con=
junction</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#=
606">Bn</span><span style=3D"color:#660">...&gt;,</span><span style=3D"colo=
r:#000"> B1</span><span style=3D"color:#660">&gt;</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#660">{};</span><span style=3D"color:#=
000"><br>=C2=A0 =C2=A0 <br></span><span style=3D"color:#008">template</span=
><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">class</sp=
an><span style=3D"color:#660">...&gt;</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">struct</span><span style=3D"color:#000"> dis=
junction </span><span style=3D"color:#660">:</span><span style=3D"color:#00=
0"> std</span><span style=3D"color:#660">::</span><span style=3D"color:#000=
">false_type </span><span style=3D"color:#660">{</span><span style=3D"color=
:#000"> </span><span style=3D"color:#660">};</span><span style=3D"color:#00=
0"><br></span><span style=3D"color:#008">template</span><span style=3D"colo=
r:#660">&lt;</span><span style=3D"color:#008">class</span><span style=3D"co=
lor:#000"> B1</span><span style=3D"color:#660">&gt;</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#008">struct</span><span style=3D"co=
lor:#000"> disjunction</span><span style=3D"color:#660">&lt;</span><span st=
yle=3D"color:#000">B1</span><span style=3D"color:#660">&gt;</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#660">:</span><span style=3D=
"color:#000"> B1 </span><span style=3D"color:#660">{</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">};</span><span style=3D"color=
:#000"><br></span><span style=3D"color:#008">template</span><span style=3D"=
color:#660">&lt;</span><span style=3D"color:#008">class</span><span style=
=3D"color:#000"> B1</span><span style=3D"color:#660">,</span><span style=3D=
"color:#000"> </span><span style=3D"color:#008">class</span><span style=3D"=
color:#660">...</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#606">Bn</span><span style=3D"color:#660">&gt;</span><span style=3D"colo=
r:#000"><br></span><span style=3D"color:#008">struct</span><span style=3D"c=
olor:#000"> disjunction</span><span style=3D"color:#660">&lt;</span><span s=
tyle=3D"color:#000">B1</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Bn</span><span style=3D"=
color:#660">...&gt;</span><span style=3D"color:#000"> <br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color:#660">:</span><span style=3D"color:#000"> std</spa=
n><span style=3D"color:#660">::</span><span style=3D"color:#000">conditiona=
l_t</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">=
bool</span><span style=3D"color:#660">(</span><span style=3D"color:#000">B1=
</span><span style=3D"color:#660">::</span><span style=3D"color:#000">va<wb=
r>lue</span><span style=3D"color:#660">),</span><span style=3D"color:#000">=
 B1</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> di=
sjunction</span><span style=3D"color:#660">&lt;</span><span style=3D"color:=
#606">Bn</span><span style=3D"color:#660">...&gt;&gt;</span><span style=3D"=
color:#000"> =C2=A0</span><span style=3D"color:#660">{</span><span style=3D=
"color:#000"> </span><span style=3D"color:#660">};</span><span style=3D"col=
or:#000"><br><br></span></div></code></div><div><br>=C2=A0 =C2=A0=C2=A0</di=
v><div>There are strong grounds to keep these implementations, e.g. short-c=
ircuiting, getting information on what type, recursion stopped etc. Althoug=
h, because of these restrictions compilation time suffers in some cases.</d=
iv><div><br></div><div><b><font size=3D"4">Why new,=C2=A0<u>very similar</u=
> traits?</font></b></div><div><b>Abstract</b></div><div>During my pull req=
uest to folly (<a href=3D"https://github.com/facebook/folly/pull/643" rel=
=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D&#39;https://www=
..google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Ffacebook%2Ffolly%2Fpull%2F6=
43\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFmOzRzYUaerIKsE3rogxWBbtocbw&#39=
;;return true;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3=
dhttps%3A%2F%2Fgithub.com%2Ffacebook%2Ffolly%2Fpull%2F643\x26sa\x3dD\x26snt=
z\x3d1\x26usg\x3dAFQjCNFmOzRzYUaerIKsE3rogxWBbtocbw&#39;;return true;">http=
s://github.com/facebook/<wbr>folly/pull/643</a>) Jay Feldblum posted there =
a small benchmark script: <a href=3D"https://gist.github.com/yfeldblum/ffae=
5374aaaa11b03f08919d25b1555b" rel=3D"nofollow" target=3D"_blank" onmousedow=
n=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgist.gi=
thub.com%2Fyfeldblum%2Fffae5374aaaa11b03f08919d25b1555b\x26sa\x3dD\x26sntz\=
x3d1\x26usg\x3dAFQjCNHi3xrC-eDaheXnAHTmJ5rTlEJgRA&#39;;return true;" onclic=
k=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgist.gi=
thub.com%2Fyfeldblum%2Fffae5374aaaa11b03f08919d25b1555b\x26sa\x3dD\x26sntz\=
x3d1\x26usg\x3dAFQjCNHi3xrC-eDaheXnAHTmJ5rTlEJgRA&#39;;return true;">https:=
//gist.github.com/<wbr>yfeldblum/<wbr>ffae5374aaaa11b03f08919d25b155<wbr>5b=
</a>=C2=A0(big credits for poking my brain with the idea). I was surprised =
that, let&#39;s say, the naive implementation compiles faster that the stan=
dard one.=C2=A0</div><div><br></div><div>I decided to benchmark this idea d=
eeper:</div><div>-problem was to find in a types sequence if there is a typ=
e which T::value is equal to 0</div><div>-for every benchmark sequence has =
1024 types inside</div><div>-tested sequences with two kinds of types: ligh=
t and heavy to instantiate</div><div>-tested best and worse cases</div><div=
>-tested two new implementations: fold expression and bool-pack</div><div>-=
core benchmark was to measure the compilation time with given compiler (cla=
ng++-4.0/g++-6), case (best/worse), type (light/heavy), implementation (pro=
posed/standard). Every compilation case was ran 500 times and average resul=
t was calculated.</div><div><br></div><div>Whole benchmarks code you can fi=
nd in the gh repo:=C2=A0<a href=3D"https://github.com/stryku/boolpack_vs_re=
cursion" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D&#39=
;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fstryku%2Fboolpa=
ck_vs_recursion\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHICyJnr6jjlrCVLCKQE=
rJdqh0rLg&#39;;return true;" onclick=3D"this.href=3D&#39;https://www.google=
..com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fstryku%2Fboolpack_vs_recursion\x26=
sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHICyJnr6jjlrCVLCKQErJdqh0rLg&#39;;retu=
rn true;">https://github.com/<wbr>stryku/boolpack_vs_recursion</a></div><di=
v><br></div><div>And here are the results (sorry for not posting it here, b=
ut table was too big and it was formatted in unreadable way):</div><div><a =
href=3D"https://raw.githubusercontent.com/stryku/boolpack_vs_recursion/mast=
er/output" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D&#=
39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fraw.githubusercontent.com%=
2Fstryku%2Fboolpack_vs_recursion%2Fmaster%2Foutput\x26sa\x3dD\x26sntz\x3d1\=
x26usg\x3dAFQjCNFy33FwRHZtVQg2amM08KY4FDz5dQ&#39;;return true;" onclick=3D"=
this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fraw.githubus=
ercontent.com%2Fstryku%2Fboolpack_vs_recursion%2Fmaster%2Foutput\x26sa\x3dD=
\x26sntz\x3d1\x26usg\x3dAFQjCNFy33FwRHZtVQg2amM08KY4FDz5dQ&#39;;return true=
;">https://raw.githubusercontent.<wbr>com/stryku/boolpack_vs_<wbr>recursion=
/master/output</a></div><div><br></div><div>As you can see, standard implem=
entation is way better when we deal with the best case. It can compile 80x(=
!) faster than the proposed ones. Problem starts when the worse cases occur=
s.=C2=A0</div><div>Standard library creators would be able to implement `gr=
eedy_conjunction` and `greedy_disjunction` in a way that they compiles up t=
o around 6x faster than the standard one. Users would be able choose implem=
entation which will suit best, based on what cases they are mostly expectin=
g.</div><div><br></div><div><font size=3D"4"><b>Specification</b></font></d=
iv><div>Since it&#39;s a pre-proposal I don&#39;t want to post fully descri=
bed specification. I&#39;m thinking about it in this way:</div><div><br></d=
iv><div>`std::greedy_conjunction` would be an alias or would derive from a =
type, which has a constexpr member `value` which can be converted to bool a=
nd is equal to:</div><div>-false if any bool(Tn::value0 =3D=3D false</div><=
div>-true otherwise</div><div><br></div><div><div>`std::greedy_disjunction`=
 would be an alias or would derive from a type, which has a constexpr membe=
r `value` which can be converted to bool and is equal to:</div><div>-false =
if all bool(Tn::value) =3D=3D false</div><div>-true otherwise</div></div><d=
iv><br></div><div><font size=3D"4"><b>Example implementations</b></font></d=
iv><div>bool-pack (this one seems to compile faster than fold expression):<=
/div><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,1=
87,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><di=
v><span style=3D"color:#008">template</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">bool</=
span><span style=3D"color:#660">...</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#606">Bn</span><span style=3D"color:#660">&gt;</span=
><span style=3D"color:#000"><br></span><span style=3D"color:#008">struct</s=
pan><span style=3D"color:#000"> __bools </span><span style=3D"color:#660">{=
};</span><span style=3D"color:#000"><br><br></span><span style=3D"color:#00=
8">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"co=
lor:#660">...</span><span style=3D"color:#000"> </span><span style=3D"color=
:#606">Tn</span><span style=3D"color:#660">&gt;</span><span style=3D"color:=
#000"> <br></span><span style=3D"color:#008">struct</span><span style=3D"co=
lor:#000"> greedy_disjunction</span><span style=3D"color:#660">:</span><spa=
n style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span=
 style=3D"color:#000">negation</span><span style=3D"color:#660">&lt;</span>=
<span style=3D"color:#000">std</span><span style=3D"color:#660">::</span><s=
pan style=3D"color:#000">is_same</span><span style=3D"color:#660">&lt;</spa=
n><span style=3D"color:#000">__<wbr>bools</span><span style=3D"color:#660">=
&lt;</span><span style=3D"color:#008">bool</span><span style=3D"color:#660"=
>(</span><span style=3D"color:#606">Tn</span><span style=3D"color:#660">::<=
/span><span style=3D"color:#000">value</span><span style=3D"color:#660">)..=
..&gt;,</span><span style=3D"color:#000"> __bools</span><span style=3D"color=
:#660">&lt;(</span><span style=3D"color:#606">Tn</span><span style=3D"color=
:#660">::</span><span style=3D"color:#000">value </span><span style=3D"colo=
r:#660">&amp;&amp;</span><span style=3D"color:#000"> </span><span style=3D"=
color:#008">false</span><span style=3D"color:#660">)...&gt;&gt;&gt;</span><=
span style=3D"color:#000"> </span><span style=3D"color:#660">{};</span><spa=
n style=3D"color:#000"><br><br></span><span style=3D"color:#008">template</=
span><span style=3D"color:#000"> </span><span style=3D"color:#660">&lt;</sp=
an><span style=3D"color:#008">typename</span><span style=3D"color:#660">...=
</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Tn</sp=
an><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"> <br></=
span><span style=3D"color:#008">struct</span><span style=3D"color:#000"> gr=
eedy_conjunction</span><span style=3D"color:#660">:</span><span style=3D"co=
lor:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">is_same</span><span style=3D"color:#660">&lt;</span><span style=3D=
"color:#000">__bools</span><span style=3D"color:#660">&lt;</span><span styl=
e=3D"color:#008">bool</span><span style=3D"color:#660">(</span><span style=
=3D"color:#606">Tn</span><span style=3D"color:#660">::</span><span style=3D=
"color:#000"><wbr>value</span><span style=3D"color:#660">)...&gt;,</span><s=
pan style=3D"color:#000"> __bools</span><span style=3D"color:#660">&lt;(</s=
pan><span style=3D"color:#606">Tn</span><span style=3D"color:#660">::</span=
><span style=3D"color:#000">value </span><span style=3D"color:#660">||</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#008">true</span>=
<span style=3D"color:#660">)...&gt;&gt;</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#660">{};</span><span style=3D"color:#000"><br><=
/span></div></code></div><div><br><br></div><div>fold expression:</div><div=
 style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);b=
order-style:solid;border-width:1px;word-wrap:break-word"><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:#660">...</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#606">Tn</span><span style=3D"color:#660">&gt;</span><spa=
n style=3D"color:#000"> <br></span><span style=3D"color:#008">struct</span>=
<span style=3D"color:#000"> greedy_disjunction </span><span style=3D"color:=
#660">:</span><span style=3D"color:#000"> std</span><span style=3D"color:#6=
60">::</span><span style=3D"color:#000">bool_constant</span><span style=3D"=
color:#660">&lt;(</span><span style=3D"color:#008">false</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">||</span><span style=3D"=
color:#000"> </span><span style=3D"color:#660">...</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#660">||</span><span style=3D"color:#=
000"> </span><span style=3D"color:#008">bool</span><span style=3D"color:#66=
0">(</span><span style=3D"color:#606">Tn</span><span style=3D"color:#660">:=
:</span><span style=3D"color:#000">value</span><span style=3D"color:#660">)=
)&gt;</span><span style=3D"color:#000"> </span><span style=3D"color:#660">{=
};</span><span style=3D"color:#000"><br><br></span><span style=3D"color:#00=
8">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"co=
lor:#660">...</span><span style=3D"color:#000"> </span><span style=3D"color=
:#606">Tn</span><span style=3D"color:#660">&gt;</span><span style=3D"color:=
#000"> <br></span><span style=3D"color:#008">struct</span><span style=3D"co=
lor:#000"> greedy_conjunction </span><span style=3D"color:#660">:</span><sp=
an style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><spa=
n style=3D"color:#000">bool_constant</span><span style=3D"color:#660">&lt;(=
</span><span style=3D"color:#008">true</span><span style=3D"color:#000"> </=
span><span style=3D"color:#660">&amp;&amp;</span><span style=3D"color:#000"=
> </span><span style=3D"color:#660">...</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#660">&amp;&amp;</span><span style=3D"color:#000=
"> </span><span style=3D"color:#008">bool</span><span style=3D"color:#660">=
(</span><span style=3D"color:#606">Tn</span><span style=3D"color:#660">::</=
span><span style=3D"color:#000">value</span><span style=3D"color:#660">))&g=
t;</span><span style=3D"color:#000"> </span><span style=3D"color:#660">{};<=
/span><span style=3D"color:#000"><br></span></div></code></div><div><br><br=
></div><div><font size=3D"4"><b>Wordings:</b></font></div><div><b>There is =
couple of questions</b></div><div>I asked them to myself a lot, during this=
 pre-proposal.</div><div>-Is it in the C++ standard scope to care about how=
 things will be implemented in standard library, even if the implementation=
s will be not efficient on compile-time level?</div><div>-Should the standa=
rd be changed because of standard library compilation time?</div><div><br><=
/div><div>And here&#39;s my conclusion (and reason why I&#39;m writing this=
 post).</div><div>C++ standard purpose is not to specify a theoretical lang=
uage. It&#39;s created to be used by a lot of people in the real world. Giv=
ing a choice to user between implementations which differs in a compile-tim=
e efficiency is same thing as to give a choice between containers e.g. `std=
::vector` and `std::list`. In some cases one implementation is better, in o=
thers the other one.</div><div><br></div><div><b>And of course the name</b>=
</div><div>I thought about `strict_*` (like it&#39;s in Facebook/folly lib)=
 instead of `greedy_*`, but I&#39;m sure that if this proposal is a thing c=
ommunity will propose better names.</div><div><br></div><div><br></div><div=
>What do you think?</div><div><br></div><div>Mateusz (stryku) Janek</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 rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</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/a79ce0b4-ca2d-4c37-b49e-cb707689a0e2%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" rel=3D"nofollow" t=
arget=3D"_blank" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/a79ce0b4-ca2d-4c37-b49e-cb707689a0e2%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/a79ce0b4-ca2d-4c37-b49e-cb707689a0e2%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/a79ce0b4-ca2d-4c37-<wbr>b49e-=
cb707689a0e2%40isocpp.org</a><wbr>.<br>
</blockquote></div>
</blockquote></div></blockquote></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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
942XN0vsCQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"942XN0vsCQAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@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/81a6a1fa-a331-483e-8f4d-4184c661b106%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/81a6a1fa-a331-483e-8f4d-4184c661b106%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/81a6a1fa-a331-483e-8f4d-4184c661b106%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/81a6a1fa-a331-483e-<wbr>8f4d-=
4184c661b106%40isocpp.org</a><wbr>.<br>
</blockquote></div>
</blockquote></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/12275369-dca3-40aa-b37c-93d60ffc3db8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/12275369-dca3-40aa-b37c-93d60ffc3db8=
%40isocpp.org</a>.<br />

------=_Part_869_151071870.1502964176681--

------=_Part_868_1660773175.1502964176680--

.
