Topic: Towards an is_instantiable type trait?


Author: Vincent Reverdy <vince.rev@gmail.com>
Date: Sun, 8 Apr 2018 22:06:48 -0700 (PDT)
Raw View
------=_Part_21736_811739554.1523250408462
Content-Type: multipart/alternative;
 boundary="----=_Part_21737_1340002712.1523250408463"

------=_Part_21737_1340002712.1523250408463
Content-Type: text/plain; charset="UTF-8"

Hello all,

I've been wondering lately whether an is_instantiable type trait would be
any useful, and if so why, and how it would be defined. I am pretty neutral
on the subject, so this thread is more an exploration of the idea than any
concrete proposal. As always constructive feedback is welcome, as well as
discussions on ideas.

So first, let's define what we are talking about:
template <class T>
struct is_instantiable
{
    static constexpr bool value = /* something */;
}

template <class T>
inline constexpr bool is_instantiable_v = is_instantiable<T>::value;

Currently the standard has these related traits:
template <class T> struct is_abstract;
template <class T> struct is_[*]_constructible;
template <class T> struct is_[*]_destructible;

I've searched but I am not sure that the standards actually defines what it
means that a type can be instantiated even if we (at least "think we") know
what it means. We could think that is_[*]_constructible gives us everything
we need, but there are types that have deleted constructors that are
nevertheless instantiable:

struct instantiable
{
    instantiable() = delete;
    instantiable(const instantiable&) = delete;
    instantiable(instantiable&&) = delete;
    instantiable& operator=(const instantiable&) = delete;
    instantiable& operator=(instantiable&&) = delete;
    int x = 0;
};
//instantiable x0; // not working
instantiable x1{}; // working

So here are my questions to this group:

   - How does the standard defines what it means that a type can be
   instantiated? And if it's not clearly defined, is there anything we could
   define clearly? Or, on the contrary, instantiability is a very blurry
   notion because of reasons A, B, C (in that case please provide examples why
   it is a blurry notion)?
   - If one can define the notion of instantiability, do the current
   existing type traits already provide all we need to very easily test if a
   type is instantiable? (I don't think that's the case but I may have missed
   something)
   - If one can define the notion of instantiability and it is not directly
   covered by existing type traits, how could we implement is_instantiable
   (ie what should go in the /* something */ of the first code box) (if
   it's not doable without compiler magic, pseudo-code is welcome)
   - So far, none of the three previous questions were discussing the
   usefulness of such a trait, because definability + implementatibility
   versus usefulness are completely orthogonal notions. So for the last
   question let's discuss usefulness: would you have use cases in mind for
   such a trait?

Thank you very much for your feedback!
Best,

Vincent

--
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/edee7e15-1c9c-4c4f-a359-9a4ab1ca1ed9%40isocpp.org.

------=_Part_21737_1340002712.1523250408463
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hello all,</div><div><br></div><div>I&#39;ve been won=
dering lately whether an <span style=3D"font-family: courier new, monospace=
;">is_instantiable</span> type trait would be any useful, and if so why, an=
d how it would be defined. I am pretty neutral on the subject, so this thre=
ad is more an exploration of the idea than any concrete proposal. As always=
 constructive feedback is welcome, as well as discussions on ideas. <br></d=
iv><div><br></div><div>So first, let&#39;s define what we are talking about=
:</div><div style=3D"background-color: rgb(250, 250, 250); border-color: rg=
b(187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: br=
eak-word;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"=
subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">t=
emplate</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">class</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> T</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">struct</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> is_instantiable<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 =C2=A0 </span><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">static</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">constexpr</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">bool</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> value </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #800;" class=3D"styled-by-prettify">/* somethi=
ng */</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br></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=
: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">class</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"s=
tyled-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-pre=
ttify">inline</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">conste=
xpr</span><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"> is_instantiable_v </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> is_instantiable</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">T</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>Currently the standard has these related traits:</div><div style=
=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187);=
 border-style: solid; border-width: 1px; overflow-wrap: break-word;" class=
=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subprettyprint">=
<span style=3D"color: #008;" class=3D"styled-by-prettify">template</span><s=
pan 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"co=
lor: #008;" class=3D"styled-by-prettify">class</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> is_abstract</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">te=
mplate</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> T</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: #008;" c=
lass=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> is_</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">[*]</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">_constructible</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></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: #660;" class=3D"styled-by-prettify">&lt;</span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> T</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: #008=
;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> is_</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">[*]</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">_destructible</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br></span></div></code></div><div><br>I&#39;ve searched but I a=
m not sure that the standards actually defines what it means that a type ca=
n be instantiated even if we (at least &quot;think we&quot;) know what it m=
eans. We could think that <code class=3D"prettyprint"><span style=3D"color:=
 #000;" class=3D"styled-by-prettify">is_</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">[*]</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">_constructible</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify"></span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"></span></code><code> </code>gives us everything we need, =
but there are types that have deleted constructors that are nevertheless in=
stantiable:</div><div><br></div><div style=3D"background-color: rgb(250, 25=
0, 250); border-color: rgb(187, 187, 187); border-style: solid; border-widt=
h: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code class=3D"pr=
ettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> instantiable<br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 =C2=A0 instantiable</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: #660;" class=3D=
"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">delete</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 =C2=A0 instantiable</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">const</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
instantiable</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&amp;)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">delete</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 =C2=A0 instantiable</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">instantiable</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;)</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">delete</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>=C2=A0 =C2=A0 instantiable</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">operator</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">=3D(</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">const</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> instantiable</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&amp;)</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">delete</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 instantiable</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">operator</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">=3D(</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">instantiable</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&amp;&amp;)</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">delete</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 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> x </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br></span><span style=3D"color: #800;" class=3D=
"styled-by-prettify">//instantiable x0; // not working</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>instantiable x1</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=
: #800;" class=3D"styled-by-prettify">// working</span></div></code></div><=
div><br></div><div>So here are my questions to this group:</div><div><ul><l=
i>How does the standard defines what it means that a type can be instantiat=
ed? And if it&#39;s not clearly defined, is there anything we could define =
clearly? Or, on the contrary, instantiability is a very blurry notion becau=
se of reasons A, B, C (in that case please provide examples why it is a blu=
rry notion)?</li><li>If one can define the notion of instantiability, do th=
e current existing type traits already provide all we need to very easily t=
est if a type is instantiable? (I don&#39;t think that&#39;s the case but I=
 may have missed something)<br></li><li>If one can define the notion of ins=
tantiability and it is not directly covered by existing type traits, how co=
uld we implement <span style=3D"font-family: courier new, monospace;">is_in=
stantiable</span> (ie what should go in the <span style=3D"font-family: cou=
rier new, monospace;">/* something */</span> of the first code box) (if it&=
#39;s not doable without compiler magic, pseudo-code is welcome)</li><li>So=
 far, none of the three previous questions were discussing the usefulness o=
f such a trait, because definability + implementatibility versus usefulness=
 are completely orthogonal notions. So for the last question let&#39;s disc=
uss usefulness: would you have use cases in mind for such a trait?</li></ul=
><div>Thank you very much for your feedback!</div><div>Best,</div><div><br>=
</div><div>Vincent<br></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/edee7e15-1c9c-4c4f-a359-9a4ab1ca1ed9%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/edee7e15-1c9c-4c4f-a359-9a4ab1ca1ed9=
%40isocpp.org</a>.<br />

------=_Part_21737_1340002712.1523250408463--

------=_Part_21736_811739554.1523250408462--

.


Author: Tony V E <tvaneerd@gmail.com>
Date: Mon, 09 Apr 2018 01:14:30 -0400
Raw View
<html><head></head><body lang=3D"en-US" style=3D"background-color: rgb(255,=
 255, 255); line-height: initial;">                                        =
                                              <div style=3D"width: 100%; fo=
nt-size: initial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif=
; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, =
255, 255);">I don't see much use.&nbsp;</div><div style=3D"width: 100%; fon=
t-size: initial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif;=
 color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 2=
55, 255);"><br></div><div style=3D"width: 100%; font-size: initial; font-fa=
mily: Calibri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 73, 125)=
; text-align: initial; background-color: rgb(255, 255, 255);">If someone sa=
ys, 'yes, it is instantiable', but then doesn't tell you how, what do you d=
o to instantiate, just guess?</div><div style=3D"width: 100%; font-size: in=
itial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif; color: rg=
b(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);"=
><br></div>                                                                =
                                                                     <div s=
tyle=3D"width: 100%; font-size: initial; font-family: Calibri, 'Slate Pro',=
 sans-serif, sans-serif; color: rgb(31, 73, 125); text-align: initial; back=
ground-color: rgb(255, 255, 255);"><br style=3D"display:initial"></div>    =
                                                                           =
                                                                           =
                                         <div style=3D"font-size: initial; =
font-family: Calibri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 7=
3, 125); text-align: initial; background-color: rgb(255, 255, 255);">Sent&n=
bsp;from&nbsp;my&nbsp;BlackBerry&nbsp;portable&nbsp;Babbage&nbsp;Device</di=
v>                                                                         =
                                                                           =
                              <table width=3D"100%" style=3D"background-col=
or:white;border-spacing:0px;"> <tbody><tr><td colspan=3D"2" style=3D"font-s=
ize: initial; text-align: initial; background-color: rgb(255, 255, 255);"> =
                          <div style=3D"border-style: solid none none; bord=
er-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0=
in; font-family: Tahoma, 'BB Alpha Sans', 'Slate Pro'; font-size: 10pt;">  =
<div><b>From: </b>Vincent Reverdy</div><div><b>Sent: </b>Monday, April 9, 2=
018 1:06 AM</div><div><b>To: </b>ISO C++ Standard - Future Proposals</div><=
div><b>Reply To: </b>std-proposals@isocpp.org</div><div><b>Subject: </b>[st=
d-proposals] Towards an is_instantiable type trait?</div></div></td></tr></=
tbody></table><div style=3D"border-style: solid none none; border-top-color=
: rgb(186, 188, 209); border-top-width: 1pt; font-size: initial; text-align=
: initial; background-color: rgb(255, 255, 255);"></div><br><div id=3D"_ori=
ginalContent" style=3D""><div dir=3D"ltr"><div>Hello all,</div><div><br></d=
iv><div>I've been wondering lately whether an <span style=3D"font-family: c=
ourier new, monospace;">is_instantiable</span> type trait would be any usef=
ul, and if so why, and how it would be defined. I am pretty neutral on the =
subject, so this thread is more an exploration of the idea than any concret=
e proposal. As always constructive feedback is welcome, as well as discussi=
ons on ideas. <br></div><div><br></div><div>So first, let's define what we =
are talking about:</div><div style=3D"background-color: rgb(250, 250, 250);=
 border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; =
overflow-wrap: break-word;" class=3D"prettyprint"><code class=3D"prettyprin=
t"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">template</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">c=
lass</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> is_instantiable<br></span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">static</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">constexpr</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">bool</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> value </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pr=
ettify">/* something */</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><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></s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">template</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">inline</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">constexpr</span><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"> is_i=
nstantiable_v </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> is=
_instantiable</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">T</=
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><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">;</span></div></code>=
</div><div><br></div><div>Currently the standard has these related traits:<=
/div><div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(=
187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: brea=
k-word;" class=3D"prettyprint"><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">class</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> is_abstract</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">template</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">class<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> is_</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">[*]</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">_constructible</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></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: #660;" class=3D"styled-by-prettify=
">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">clas=
s</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</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: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> is_</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">[*]</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">_destructible</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br></span></div></code></div><div><br>I've searched bu=
t I am not sure that the standards actually defines what it means that a ty=
pe can be instantiated even if we (at least "think we") know what it means.=
 We could think that <code class=3D"prettyprint"><span style=3D"color: #000=
;" class=3D"styled-by-prettify">is_</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">[*]</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">_constructible</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"></span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"></span></code><code> </code>gives us everything we need, but =
there are types that have deleted constructors that are nevertheless instan=
tiable:</div><div><br></div><div style=3D"background-color: rgb(250, 250, 2=
50); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1=
px; overflow-wrap: break-word;" class=3D"prettyprint"><code class=3D"pretty=
print"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"=
styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> instantiable<br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>&nbsp; &nbsp; instantiable</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: #660;" class=3D"st=
yled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">delete</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; =
&nbsp; instantiable</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
const</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> inst=
antiable</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&a=
mp;)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">delete</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; instantiable</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">instantiable</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">&amp;&amp;)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">delete</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br>&nbsp; &nbsp; instantiable</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">operator</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">=3D(</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">const</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> instantiable</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&amp;)</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">delete</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; instantiable</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">operator</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">=3D(</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">instantiable</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&amp;&amp;)</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">delete</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>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> x </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br></span><span style=3D"color: #800;" class=3D=
"styled-by-prettify">//instantiable x0; // not working</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>instantiable x1</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=
: #800;" class=3D"styled-by-prettify">// working</span></div></code></div><=
div><br></div><div>So here are my questions to this group:</div><div><ul><l=
i>How does the standard defines what it means that a type can be instantiat=
ed? And if it's not clearly defined, is there anything we could define clea=
rly? Or, on the contrary, instantiability is a very blurry notion because o=
f reasons A, B, C (in that case please provide examples why it is a blurry =
notion)?</li><li>If one can define the notion of instantiability, do the cu=
rrent existing type traits already provide all we need to very easily test =
if a type is instantiable? (I don't think that's the case but I may have mi=
ssed something)<br></li><li>If one can define the notion of instantiability=
 and it is not directly covered by existing type traits, how could we imple=
ment <span style=3D"font-family: courier new, monospace;">is_instantiable</=
span> (ie what should go in the <span style=3D"font-family: courier new, mo=
nospace;">/* something */</span> of the first code box) (if it's not doable=
 without compiler magic, pseudo-code is welcome)</li><li>So far, none of th=
e three previous questions were discussing the usefulness of such a trait, =
because definability + implementatibility versus usefulness are completely =
orthogonal notions. So for the last question let's discuss usefulness: woul=
d you have use cases in mind for such a trait?</li></ul><div>Thank you very=
 much for your feedback!</div><div>Best,</div><div><br></div><div>Vincent<b=
r></div></div></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" 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/edee7e15-1c9c-4c4f-a359-9a4ab1ca1ed9%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter">https://groups.goo=
gle.com/a/isocpp.org/d/msgid/std-proposals/edee7e15-1c9c-4c4f-a359-9a4ab1ca=
1ed9%40isocpp.org</a>.<br>
<br><!--end of _originalContent --></div></body></html>

<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/20180409051430.5103698.23293.49476%40=
gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com=
/a/isocpp.org/d/msgid/std-proposals/20180409051430.5103698.23293.49476%40gm=
ail.com</a>.<br />

.


Author: Vincent Reverdy <vince.rev@gmail.com>
Date: Sun, 8 Apr 2018 23:05:03 -0700 (PDT)
Raw View
------=_Part_21751_773737658.1523253903989
Content-Type: multipart/alternative;
 boundary="----=_Part_21752_1358552353.1523253903989"

------=_Part_21752_1358552353.1523253903989
Content-Type: text/plain; charset="UTF-8"

Maybe because you don't want to instantiate, but use it as a condition to
decide of a behaviour in a template metaprogramming context.

template <template <class> class Template, class Type>
struct foo
: std::conditional_t<is_inheritable_v<Template<Type>> && is_instantiable_v<
Template<Type>>, Template<Type>, std::monostate>
{
    // something
};



--
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/325d1a7f-4691-492a-88d9-176a734cb4ac%40isocpp.org.

------=_Part_21752_1358552353.1523253903989
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Maybe because you don&#39;t want to instantiate, but =
use it as a condition to decide of a behaviour in a template metaprogrammin=
g context.</div><div><br></div><div style=3D"background-color: rgb(250, 250=
, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width=
: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code class=3D"pre=
ttyprint"><div class=3D"subprettyprint"><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: #660;" class=3D"style=
d-by-prettify">&lt;</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: #080;" class=3D"styled-by-prettify">&l=
t;class&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #606;" class=3D"styled-by-prettify">Template</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">class</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"s=
tyled-by-prettify">Type</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>struct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> fo=
o <br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">conditional_t</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">is_inheritable_v</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #606;" class=3D"styled-by-prettify">Type</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&gt;&gt;</span><span style=3D"color: #00=
0;" 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_instantiable_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">Template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #606;" class=3D"st=
yled-by-prettify">Type</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">&gt;&gt;,</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify=
">Template</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Type</=
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=
"color: #000;" class=3D"styled-by-prettify">monostate</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: #660;=
" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800=
;" class=3D"styled-by-prettify">// something</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">};</span></div></code></div><div><br><br></div>=
<div><br></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/325d1a7f-4691-492a-88d9-176a734cb4ac%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/325d1a7f-4691-492a-88d9-176a734cb4ac=
%40isocpp.org</a>.<br />

------=_Part_21752_1358552353.1523253903989--

------=_Part_21751_773737658.1523253903989--

.


Author: Nicolas Lesser <blitzrakete@gmail.com>
Date: Mon, 09 Apr 2018 12:37:40 +0000
Raw View
--00000000000094da8e056969ac89
Content-Type: text/plain; charset="UTF-8"

Please use another name, instantiation refers to only templates. In fact,
every use of "instantiate" in your emails is just wrong.

On Mon, Apr 9, 2018, 7:06 AM Vincent Reverdy <vince.rev@gmail.com> wrote:

> Hello all,
>
> I've been wondering lately whether an is_instantiable type trait would be
> any useful, and if so why, and how it would be defined. I am pretty neutral
> on the subject, so this thread is more an exploration of the idea than any
> concrete proposal. As always constructive feedback is welcome, as well as
> discussions on ideas.
>
> So first, let's define what we are talking about:
> template <class T>
> struct is_instantiable
> {
>     static constexpr bool value = /* something */;
> }
>
> template <class T>
> inline constexpr bool is_instantiable_v = is_instantiable<T>::value;
>
> Currently the standard has these related traits:
> template <class T> struct is_abstract;
> template <class T> struct is_[*]_constructible;
> template <class T> struct is_[*]_destructible;
>
> I've searched but I am not sure that the standards actually defines what
> it means that a type can be instantiated even if we (at least "think we")
> know what it means.
>

The reason for this is that "instantiate" is the wrong term.

We could think that is_[*]_constructible gives us everything we need, but
> there are types that have deleted constructors that are nevertheless
> instantiable:
>

Yes, this is an unfortunate fact that aggregate initialization sometimes
can ignore certain deleted constructors.

>
> struct instantiable
> {
>     instantiable() = delete;
>     instantiable(const instantiable&) = delete;
>     instantiable(instantiable&&) = delete;
>     instantiable& operator=(const instantiable&) = delete;
>     instantiable& operator=(instantiable&&) = delete;
>     int x = 0;
> };
> //instantiable x0; // not working
> instantiable x1{}; // working
>
> So here are my questions to this group:
>
>    - How does the standard defines what it means that a type can be
>    instantiated?
>
> It doesn't really. If type can be used outside of a template, then another
function which does the same thing can also be instantiated using the same
type.

>
>    - And if it's not clearly defined, is there anything we could define
>    clearly?
>
> Don't need to IMO.

>
>    - Or, on the contrary, instantiability is a very blurry notion because
>    of reasons A, B, C (in that case please provide examples why it is a blurry
>    notion)?
>
> I don't think it's blurry, but it's not really a "notion" or property of a
type in itself.

>
>    - If one can define the notion of instantiability, do the current
>    existing type traits already provide all we need to very easily test if a
>    type is instantiable?
>
> No, there is no test whenever something is initializable with aggregate
initialization, which is what you are doing.

I'm getting really confused about your use of instantiate right now :). The
existing type traits like std::is_*_constructible don't have one for
aggregates, which is what you want.

Indeed, this is the only form of initialization that is not covered by
existing type traits, which is basically what you're after.

Note that EWG expressed interest not to have this weird behavior (where
aggregate initialization bypasses the deleted constructor and other such
counter intuitive behavior) so you'll have to find another use case for
such a trait possibly in the future.

>
>    - (I don't think that's the case but I may have missed something)
>    - If one can define the notion of instantiability and it is not
>    directly covered by existing type traits, how could we implement
>    is_instantiable (ie what should go in the /* something */ of the first
>    code box) (if it's not doable without compiler magic, pseudo-code is
>    welcome)
>
> Just like std::is_constructible but with braces instead of parens.

>
>    - So far, none of the three previous questions were discussing the
>    usefulness of such a trait, because definability + implementatibility
>    versus usefulness are completely orthogonal notions. So for the last
>    question let's discuss usefulness: would you have use cases in mind for
>    such a trait?
>
> A bit. I can imagine that functions like std::make_unique should
differentiate between aggregates and "normal" classes. We have a type trait
for the later, but not the former. Your proposed aggregate initialization
trait would solve this by allowing more specialization.

Thank you very much for your feedback!
> Best,
>
> Vincent
>
> --
> 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/edee7e15-1c9c-4c4f-a359-9a4ab1ca1ed9%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/edee7e15-1c9c-4c4f-a359-9a4ab1ca1ed9%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

--
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/CALmDwq3qzqurg9OgogXJi1HY8RyC%2B9Q%2Bx0L2zvNzBpE%2BpdmnGw%40mail.gmail.com.

--00000000000094da8e056969ac89
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div>Please use another name, instantiation refers to onl=
y templates. In fact, every use of &quot;instantiate&quot; in your emails i=
s just wrong.<br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon, Ap=
r 9, 2018, 7:06 AM Vincent Reverdy &lt;<a href=3D"mailto:vince.rev@gmail.co=
m" target=3D"_blank" rel=3D"noreferrer">vince.rev@gmail.com</a>&gt; wrote:<=
br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Hello all,</d=
iv><div><br></div><div>I&#39;ve been wondering lately whether an <span styl=
e=3D"font-family:courier new,monospace">is_instantiable</span> type trait w=
ould be any useful, and if so why, and how it would be defined. I am pretty=
 neutral on the subject, so this thread is more an exploration of the idea =
than any concrete proposal. As always constructive feedback is welcome, as =
well as discussions on ideas. <br></div><div><br></div><div>So first, let&#=
39;s define what we are talking about:</div><div style=3D"background-color:=
rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-wi=
dth:1px" class=3D"m_-8376694287186993880m_8170454476277447105prettyprint"><=
code class=3D"m_-8376694287186993880m_8170454476277447105prettyprint"><div =
class=3D"m_-8376694287186993880m_8170454476277447105subprettyprint"><span s=
tyle=3D"color:#008" class=3D"m_-8376694287186993880m_8170454476277447105sty=
led-by-prettify">template</span><span style=3D"color:#000" class=3D"m_-8376=
694287186993880m_8170454476277447105styled-by-prettify"> </span><span style=
=3D"color:#660" class=3D"m_-8376694287186993880m_8170454476277447105styled-=
by-prettify">&lt;</span><span style=3D"color:#008" class=3D"m_-837669428718=
6993880m_8170454476277447105styled-by-prettify">class</span><span style=3D"=
color:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-p=
rettify"> T</span><span style=3D"color:#660" class=3D"m_-837669428718699388=
0m_8170454476277447105styled-by-prettify">&gt;</span><span style=3D"color:#=
000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify=
"><br></span><span style=3D"color:#008" class=3D"m_-8376694287186993880m_81=
70454476277447105styled-by-prettify">struct</span><span style=3D"color:#000=
" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify"> =
is_instantiable<br></span><span style=3D"color:#660" class=3D"m_-8376694287=
186993880m_8170454476277447105styled-by-prettify">{</span><span style=3D"co=
lor:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pre=
ttify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008" class=3D"m_-8376=
694287186993880m_8170454476277447105styled-by-prettify">static</span><span =
style=3D"color:#000" class=3D"m_-8376694287186993880m_8170454476277447105st=
yled-by-prettify"> </span><span style=3D"color:#008" class=3D"m_-8376694287=
186993880m_8170454476277447105styled-by-prettify">constexpr</span><span sty=
le=3D"color:#000" class=3D"m_-8376694287186993880m_8170454476277447105style=
d-by-prettify"> </span><span style=3D"color:#008" class=3D"m_-8376694287186=
993880m_8170454476277447105styled-by-prettify">bool</span><span style=3D"co=
lor:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pre=
ttify"> value </span><span style=3D"color:#660" class=3D"m_-837669428718699=
3880m_8170454476277447105styled-by-prettify">=3D</span><span style=3D"color=
:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pretti=
fy"> </span><span style=3D"color:#800" class=3D"m_-8376694287186993880m_817=
0454476277447105styled-by-prettify">/* something */</span><span style=3D"co=
lor:#660" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pre=
ttify">;</span><span style=3D"color:#000" class=3D"m_-8376694287186993880m_=
8170454476277447105styled-by-prettify"><br></span><span style=3D"color:#660=
" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">}=
</span><span style=3D"color:#000" class=3D"m_-8376694287186993880m_81704544=
76277447105styled-by-prettify"><br><br></span><span style=3D"color:#008" cl=
ass=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">templ=
ate</span><span style=3D"color:#000" class=3D"m_-8376694287186993880m_81704=
54476277447105styled-by-prettify"> </span><span style=3D"color:#660" class=
=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">&lt;</sp=
an><span style=3D"color:#008" class=3D"m_-8376694287186993880m_817045447627=
7447105styled-by-prettify">class</span><span style=3D"color:#000" class=3D"=
m_-8376694287186993880m_8170454476277447105styled-by-prettify"> T</span><sp=
an style=3D"color:#660" class=3D"m_-8376694287186993880m_817045447627744710=
5styled-by-prettify">&gt;</span><span style=3D"color:#000" class=3D"m_-8376=
694287186993880m_8170454476277447105styled-by-prettify"><br></span><span st=
yle=3D"color:#008" class=3D"m_-8376694287186993880m_8170454476277447105styl=
ed-by-prettify">inline</span><span style=3D"color:#000" class=3D"m_-8376694=
287186993880m_8170454476277447105styled-by-prettify"> </span><span style=3D=
"color:#008" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-=
prettify">constexpr</span><span style=3D"color:#000" class=3D"m_-8376694287=
186993880m_8170454476277447105styled-by-prettify"> </span><span style=3D"co=
lor:#008" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pre=
ttify">bool</span><span style=3D"color:#000" class=3D"m_-837669428718699388=
0m_8170454476277447105styled-by-prettify"> is_instantiable_v </span><span s=
tyle=3D"color:#660" class=3D"m_-8376694287186993880m_8170454476277447105sty=
led-by-prettify">=3D</span><span style=3D"color:#000" class=3D"m_-837669428=
7186993880m_8170454476277447105styled-by-prettify"> is_instantiable</span><=
span style=3D"color:#660" class=3D"m_-8376694287186993880m_8170454476277447=
105styled-by-prettify">&lt;</span><span style=3D"color:#000" class=3D"m_-83=
76694287186993880m_8170454476277447105styled-by-prettify">T</span><span sty=
le=3D"color:#660" class=3D"m_-8376694287186993880m_8170454476277447105style=
d-by-prettify">&gt;::</span><span style=3D"color:#000" class=3D"m_-83766942=
87186993880m_8170454476277447105styled-by-prettify">value</span><span style=
=3D"color:#660" class=3D"m_-8376694287186993880m_8170454476277447105styled-=
by-prettify">;</span></div></code></div><div><br></div><div>Currently the s=
tandard has these related traits:</div><div style=3D"background-color:rgb(2=
50,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1=
px" class=3D"m_-8376694287186993880m_8170454476277447105prettyprint"><code =
class=3D"m_-8376694287186993880m_8170454476277447105prettyprint"><div class=
=3D"m_-8376694287186993880m_8170454476277447105subprettyprint"><span style=
=3D"color:#008" class=3D"m_-8376694287186993880m_8170454476277447105styled-=
by-prettify">template</span><span style=3D"color:#000" class=3D"m_-83766942=
87186993880m_8170454476277447105styled-by-prettify"> </span><span style=3D"=
color:#660" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-p=
rettify">&lt;</span><span style=3D"color:#008" class=3D"m_-8376694287186993=
880m_8170454476277447105styled-by-prettify">class</span><span style=3D"colo=
r:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prett=
ify"> T</span><span style=3D"color:#660" class=3D"m_-8376694287186993880m_8=
170454476277447105styled-by-prettify">&gt;</span><span style=3D"color:#000"=
 class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify"> <=
/span><span style=3D"color:#008" class=3D"m_-8376694287186993880m_817045447=
6277447105styled-by-prettify">struct</span><span style=3D"color:#000" class=
=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify"> is_abst=
ract</span><span style=3D"color:#660" class=3D"m_-8376694287186993880m_8170=
454476277447105styled-by-prettify">;</span><span style=3D"color:#000" class=
=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify"><br></sp=
an><span style=3D"color:#008" class=3D"m_-8376694287186993880m_817045447627=
7447105styled-by-prettify">template</span><span style=3D"color:#000" class=
=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify"> </span>=
<span style=3D"color:#660" class=3D"m_-8376694287186993880m_817045447627744=
7105styled-by-prettify">&lt;</span><span style=3D"color:#008" class=3D"m_-8=
376694287186993880m_8170454476277447105styled-by-prettify">class</span><spa=
n style=3D"color:#000" class=3D"m_-8376694287186993880m_8170454476277447105=
styled-by-prettify"> T</span><span style=3D"color:#660" class=3D"m_-8376694=
287186993880m_8170454476277447105styled-by-prettify">&gt;</span><span style=
=3D"color:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-=
by-prettify"> </span><span style=3D"color:#008" class=3D"m_-837669428718699=
3880m_8170454476277447105styled-by-prettify">struct</span><span style=3D"co=
lor:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pre=
ttify"> is_</span><span style=3D"color:#660" class=3D"m_-837669428718699388=
0m_8170454476277447105styled-by-prettify">[*]</span><span style=3D"color:#0=
00" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify"=
>_constructible</span><span style=3D"color:#660" class=3D"m_-83766942871869=
93880m_8170454476277447105styled-by-prettify">;</span><span style=3D"color:=
#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettif=
y"><br></span><span style=3D"color:#008" class=3D"m_-8376694287186993880m_8=
170454476277447105styled-by-prettify">template</span><span style=3D"color:#=
000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify=
"> </span><span style=3D"color:#660" class=3D"m_-8376694287186993880m_81704=
54476277447105styled-by-prettify">&lt;</span><span style=3D"color:#008" cla=
ss=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">class<=
/span><span style=3D"color:#000" class=3D"m_-8376694287186993880m_817045447=
6277447105styled-by-prettify"> T</span><span style=3D"color:#660" class=3D"=
m_-8376694287186993880m_8170454476277447105styled-by-prettify">&gt;</span><=
span style=3D"color:#000" class=3D"m_-8376694287186993880m_8170454476277447=
105styled-by-prettify"> </span><span style=3D"color:#008" class=3D"m_-83766=
94287186993880m_8170454476277447105styled-by-prettify">struct</span><span s=
tyle=3D"color:#000" class=3D"m_-8376694287186993880m_8170454476277447105sty=
led-by-prettify"> is_</span><span style=3D"color:#660" class=3D"m_-83766942=
87186993880m_8170454476277447105styled-by-prettify">[*]</span><span style=
=3D"color:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-=
by-prettify">_destructible</span><span style=3D"color:#660" class=3D"m_-837=
6694287186993880m_8170454476277447105styled-by-prettify">;</span><span styl=
e=3D"color:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled=
-by-prettify"><br></span></div></code></div><div><br>I&#39;ve searched but =
I am not sure that the standards actually defines what it means that a type=
 can be instantiated even if we (at least &quot;think we&quot;) know what i=
t means.</div></div></blockquote></div></div><div dir=3D"auto"><br></div><d=
iv dir=3D"auto"></div><div dir=3D"auto">The reason for this is that &quot;i=
nstantiate&quot; is the wrong term.=C2=A0</div><div dir=3D"auto"><br></div>=
<div dir=3D"auto"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"ltr"><div> We could think that <code class=3D"m_-8376694287186=
993880m_8170454476277447105prettyprint"><span style=3D"color:#000" class=3D=
"m_-8376694287186993880m_8170454476277447105styled-by-prettify">is_</span><=
span style=3D"color:#660" class=3D"m_-8376694287186993880m_8170454476277447=
105styled-by-prettify">[*]</span><span style=3D"color:#000" class=3D"m_-837=
6694287186993880m_8170454476277447105styled-by-prettify">_constructible</sp=
an><span style=3D"color:#660" class=3D"m_-8376694287186993880m_817045447627=
7447105styled-by-prettify"></span><span style=3D"color:#000" class=3D"m_-83=
76694287186993880m_8170454476277447105styled-by-prettify"></span></code><co=
de> </code>gives us everything we need, but there are types that have delet=
ed constructors that are nevertheless instantiable:</div><div></div></div><=
/blockquote></div></div><div dir=3D"auto"><br></div><div dir=3D"auto">Yes, =
this is an unfortunate fact that aggregate initialization sometimes can ign=
ore certain deleted constructors.</div><div dir=3D"auto"><div class=3D"gmai=
l_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><br></div><di=
v style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);=
border-style:solid;border-width:1px" class=3D"m_-8376694287186993880m_81704=
54476277447105prettyprint"><code class=3D"m_-8376694287186993880m_817045447=
6277447105prettyprint"><div class=3D"m_-8376694287186993880m_81704544762774=
47105subprettyprint"><span style=3D"color:#008" class=3D"m_-837669428718699=
3880m_8170454476277447105styled-by-prettify">struct</span><span style=3D"co=
lor:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pre=
ttify"> instantiable<br></span><span style=3D"color:#660" class=3D"m_-83766=
94287186993880m_8170454476277447105styled-by-prettify">{</span><span style=
=3D"color:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-=
by-prettify"><br>=C2=A0 =C2=A0 instantiable</span><span style=3D"color:#660=
" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">(=
)</span><span style=3D"color:#000" class=3D"m_-8376694287186993880m_8170454=
476277447105styled-by-prettify"> </span><span style=3D"color:#660" class=3D=
"m_-8376694287186993880m_8170454476277447105styled-by-prettify">=3D</span><=
span style=3D"color:#000" class=3D"m_-8376694287186993880m_8170454476277447=
105styled-by-prettify"> </span><span style=3D"color:#008" class=3D"m_-83766=
94287186993880m_8170454476277447105styled-by-prettify">delete</span><span s=
tyle=3D"color:#660" class=3D"m_-8376694287186993880m_8170454476277447105sty=
led-by-prettify">;</span><span style=3D"color:#000" class=3D"m_-83766942871=
86993880m_8170454476277447105styled-by-prettify"><br>=C2=A0 =C2=A0 instanti=
able</span><span style=3D"color:#660" class=3D"m_-8376694287186993880m_8170=
454476277447105styled-by-prettify">(</span><span style=3D"color:#008" class=
=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">const</s=
pan><span style=3D"color:#000" class=3D"m_-8376694287186993880m_81704544762=
77447105styled-by-prettify"> instantiable</span><span style=3D"color:#660" =
class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">&am=
p;)</span><span style=3D"color:#000" class=3D"m_-8376694287186993880m_81704=
54476277447105styled-by-prettify"> </span><span style=3D"color:#660" class=
=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">=3D</spa=
n><span style=3D"color:#000" class=3D"m_-8376694287186993880m_8170454476277=
447105styled-by-prettify"> </span><span style=3D"color:#008" class=3D"m_-83=
76694287186993880m_8170454476277447105styled-by-prettify">delete</span><spa=
n style=3D"color:#660" class=3D"m_-8376694287186993880m_8170454476277447105=
styled-by-prettify">;</span><span style=3D"color:#000" class=3D"m_-83766942=
87186993880m_8170454476277447105styled-by-prettify"><br>=C2=A0 =C2=A0 insta=
ntiable</span><span style=3D"color:#660" class=3D"m_-8376694287186993880m_8=
170454476277447105styled-by-prettify">(</span><span style=3D"color:#000" cl=
ass=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">insta=
ntiable</span><span style=3D"color:#660" class=3D"m_-8376694287186993880m_8=
170454476277447105styled-by-prettify">&amp;&amp;)</span><span style=3D"colo=
r:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prett=
ify"> </span><span style=3D"color:#660" class=3D"m_-8376694287186993880m_81=
70454476277447105styled-by-prettify">=3D</span><span style=3D"color:#000" c=
lass=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify"> </s=
pan><span style=3D"color:#008" class=3D"m_-8376694287186993880m_81704544762=
77447105styled-by-prettify">delete</span><span style=3D"color:#660" class=
=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">;</span>=
<span style=3D"color:#000" class=3D"m_-8376694287186993880m_817045447627744=
7105styled-by-prettify"><br>=C2=A0 =C2=A0 instantiable</span><span style=3D=
"color:#660" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-=
prettify">&amp;</span><span style=3D"color:#000" class=3D"m_-83766942871869=
93880m_8170454476277447105styled-by-prettify"> </span><span style=3D"color:=
#008" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettif=
y">operator</span><span style=3D"color:#660" class=3D"m_-837669428718699388=
0m_8170454476277447105styled-by-prettify">=3D(</span><span style=3D"color:#=
008" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify=
">const</span><span style=3D"color:#000" class=3D"m_-8376694287186993880m_8=
170454476277447105styled-by-prettify"> instantiable</span><span style=3D"co=
lor:#660" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pre=
ttify">&amp;)</span><span style=3D"color:#000" class=3D"m_-8376694287186993=
880m_8170454476277447105styled-by-prettify"> </span><span style=3D"color:#6=
60" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify"=
>=3D</span><span style=3D"color:#000" class=3D"m_-8376694287186993880m_8170=
454476277447105styled-by-prettify"> </span><span style=3D"color:#008" class=
=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">delete</=
span><span style=3D"color:#660" class=3D"m_-8376694287186993880m_8170454476=
277447105styled-by-prettify">;</span><span style=3D"color:#000" class=3D"m_=
-8376694287186993880m_8170454476277447105styled-by-prettify"><br>=C2=A0 =C2=
=A0 instantiable</span><span style=3D"color:#660" class=3D"m_-8376694287186=
993880m_8170454476277447105styled-by-prettify">&amp;</span><span style=3D"c=
olor:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pr=
ettify"> </span><span style=3D"color:#008" class=3D"m_-8376694287186993880m=
_8170454476277447105styled-by-prettify">operator</span><span style=3D"color=
:#660" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pretti=
fy">=3D(</span><span style=3D"color:#000" class=3D"m_-8376694287186993880m_=
8170454476277447105styled-by-prettify">instantiable</span><span style=3D"co=
lor:#660" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pre=
ttify">&amp;&amp;)</span><span style=3D"color:#000" class=3D"m_-83766942871=
86993880m_8170454476277447105styled-by-prettify"> </span><span style=3D"col=
or:#660" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pret=
tify">=3D</span><span style=3D"color:#000" class=3D"m_-8376694287186993880m=
_8170454476277447105styled-by-prettify"> </span><span style=3D"color:#008" =
class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">del=
ete</span><span style=3D"color:#660" class=3D"m_-8376694287186993880m_81704=
54476277447105styled-by-prettify">;</span><span style=3D"color:#000" class=
=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:#008" class=3D"m_-837669428718699388=
0m_8170454476277447105styled-by-prettify">int</span><span style=3D"color:#0=
00" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify"=
> x </span><span style=3D"color:#660" class=3D"m_-8376694287186993880m_8170=
454476277447105styled-by-prettify">=3D</span><span style=3D"color:#000" cla=
ss=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify"> </spa=
n><span style=3D"color:#066" class=3D"m_-8376694287186993880m_8170454476277=
447105styled-by-prettify">0</span><span style=3D"color:#660" class=3D"m_-83=
76694287186993880m_8170454476277447105styled-by-prettify">;</span><span sty=
le=3D"color:#000" class=3D"m_-8376694287186993880m_8170454476277447105style=
d-by-prettify"><br></span><span style=3D"color:#660" class=3D"m_-8376694287=
186993880m_8170454476277447105styled-by-prettify">};</span><span style=3D"c=
olor:#000" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pr=
ettify"><br></span><span style=3D"color:#800" class=3D"m_-83766942871869938=
80m_8170454476277447105styled-by-prettify">//instantiable x0; // not workin=
g</span><span style=3D"color:#000" class=3D"m_-8376694287186993880m_8170454=
476277447105styled-by-prettify"><br>instantiable x1</span><span style=3D"co=
lor:#660" class=3D"m_-8376694287186993880m_8170454476277447105styled-by-pre=
ttify">{};</span><span style=3D"color:#000" class=3D"m_-8376694287186993880=
m_8170454476277447105styled-by-prettify"> </span><span style=3D"color:#800"=
 class=3D"m_-8376694287186993880m_8170454476277447105styled-by-prettify">//=
 working</span></div></code></div><div><br></div><div>So here are my questi=
ons to this group:</div><div><ul><li>How does the standard defines what it =
means that a type can be instantiated?</li></ul></div></div></blockquote></=
div></div><div dir=3D"auto">It doesn&#39;t really. If type can be used outs=
ide of a template, then another function which does the same thing can also=
 be instantiated using the same type.</div><div dir=3D"auto"><div class=3D"=
gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><ul><li> =
And if it&#39;s not clearly defined, is there anything we could define clea=
rly?</li></ul></div></div></blockquote></div></div><div dir=3D"auto">Don&#3=
9;t need to IMO.</div><div dir=3D"auto"><div class=3D"gmail_quote"><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc s=
olid;padding-left:1ex"><div dir=3D"ltr"><div><ul><li> Or, on the contrary, =
instantiability is a very blurry notion because of reasons A, B, C (in that=
 case please provide examples why it is a blurry notion)?</li></ul></div></=
div></blockquote></div></div><div dir=3D"auto">I don&#39;t think it&#39;s b=
lurry, but it&#39;s not really a &quot;notion&quot; or property of a type i=
n itself.</div><div dir=3D"auto"><div class=3D"gmail_quote"><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa=
dding-left:1ex"><div dir=3D"ltr"><div><ul><li>If one can define the notion =
of instantiability, do the current existing type traits already provide all=
 we need to very easily test if a type is instantiable? </li></ul></div></d=
iv></blockquote></div></div><div dir=3D"auto">No, there is no test whenever=
 something is initializable with aggregate initialization, which is what yo=
u are doing.</div><div dir=3D"auto"><br></div><div dir=3D"auto">I&#39;m get=
ting really confused about your use of instantiate right now :). The existi=
ng type traits like std::is_*_constructible don&#39;t have one for aggregat=
es, which is what you want.</div><div dir=3D"auto"><br></div><div dir=3D"au=
to">Indeed, this is the only form of initialization that is not covered by =
existing type traits, which is basically what you&#39;re after.=C2=A0</div>=
<div dir=3D"auto"><br></div><div dir=3D"auto">Note that EWG expressed inter=
est not to have this weird behavior (where aggregate initialization bypasse=
s the deleted constructor and other such counter intuitive behavior) so you=
&#39;ll have to find another use case for such a trait possibly in the futu=
re.</div><div dir=3D"auto"><div class=3D"gmail_quote"><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><ul><li>(I don&#39;t think that&#39;s the c=
ase but I may have missed something)<br></li><li>If one can define the noti=
on of instantiability and it is not directly covered by existing type trait=
s, how could we implement <span style=3D"font-family:courier new,monospace"=
>is_instantiable</span> (ie what should go in the <span style=3D"font-famil=
y:courier new,monospace">/* something */</span> of the first code box) (if =
it&#39;s not doable without compiler magic, pseudo-code is welcome)</li></u=
l></div></div></blockquote></div></div><div dir=3D"auto">Just like std::is_=
constructible but with braces instead of parens.</div><div dir=3D"auto"><di=
v class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0=
 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><di=
v><ul><li>So far, none of the three previous questions were discussing the =
usefulness of such a trait, because definability + implementatibility versu=
s usefulness are completely orthogonal notions. So for the last question le=
t&#39;s discuss usefulness: would you have use cases in mind for such a tra=
it?</li></ul></div></div></blockquote></div></div><div dir=3D"auto">A bit. =
I can imagine that functions like std::make_unique should differentiate bet=
ween aggregates and &quot;normal&quot; classes. We have a type trait for th=
e later, but not the former. Your proposed aggregate initialization trait w=
ould solve this by allowing more specialization.</div><div dir=3D"auto"><br=
></div><div dir=3D"auto"><div class=3D"gmail_quote"><blockquote class=3D"gm=
ail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-le=
ft:1ex"><div dir=3D"ltr"><div><div>Thank you very much for your feedback!</=
div><div>Best,</div><div><br></div><div>Vincent<br></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" rel=3D"nore=
ferrer noreferrer" target=3D"_blank">std-proposals+unsubscribe@isocpp.org</=
a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" rel=3D"noreferrer noreferrer" 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/edee7e15-1c9c-4c4f-a359-9a4ab1ca1ed9%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" rel=3D"noreferrer =
noreferrer" target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgi=
d/std-proposals/edee7e15-1c9c-4c4f-a359-9a4ab1ca1ed9%40isocpp.org</a>.<br>
</blockquote></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/CALmDwq3qzqurg9OgogXJi1HY8RyC%2B9Q%2B=
x0L2zvNzBpE%2BpdmnGw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALmDwq3qzq=
urg9OgogXJi1HY8RyC%2B9Q%2Bx0L2zvNzBpE%2BpdmnGw%40mail.gmail.com</a>.<br />

--00000000000094da8e056969ac89--

.


Author: Todd Fleming <tbfleming@gmail.com>
Date: Sun, 15 Apr 2018 07:26:43 -0700 (PDT)
Raw View
------=_Part_18062_1727278488.1523802403221
Content-Type: multipart/alternative;
 boundary="----=_Part_18063_267453636.1523802403221"

------=_Part_18063_267453636.1523802403221
Content-Type: text/plain; charset="UTF-8"

On Monday, April 9, 2018 at 8:37:53 AM UTC-4, Nicolas Lesser wrote:
>
> Please use another name, instantiation refers to only templates. In fact,
> every use of "instantiate" in your emails is just wrong.
>

Unfortunately this term is commonly used this way in the wild, especially
with languages which don't have templates. It'd be nice if C++ had a
standardized single-word replacement for "begin the lifetime of".
"construct" doesn't quite fit.

Todd

--
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/906805c2-79e6-4ac7-87b1-76266b02640a%40isocpp.org.

------=_Part_18063_267453636.1523802403221
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Monday, April 9, 2018 at 8:37:53 AM UTC-4, Nicolas Less=
er wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: =
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"auto"><di=
v>Please use another name, instantiation refers to only templates. In fact,=
 every use of &quot;instantiate&quot; in your emails is just wrong.</div></=
div></blockquote><div><br></div><div>Unfortunately this term is commonly us=
ed this way in the wild, especially with languages which don&#39;t have tem=
plates. It&#39;d be nice if C++ had a standardized single-word replacement =
for &quot;begin the lifetime of&quot;. &quot;construct&quot; doesn&#39;t qu=
ite fit.</div><div><br></div><div>Todd</div><div><br></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/906805c2-79e6-4ac7-87b1-76266b02640a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/906805c2-79e6-4ac7-87b1-76266b02640a=
%40isocpp.org</a>.<br />

------=_Part_18063_267453636.1523802403221--

------=_Part_18062_1727278488.1523802403221--

.


Author: Nicolas Lesser <blitzrakete@gmail.com>
Date: Sun, 15 Apr 2018 17:04:44 +0200
Raw View
--000000000000f192700569e46cc7
Content-Type: text/plain; charset="UTF-8"

On Sun, Apr 15, 2018 at 4:26 PM, Todd Fleming <tbfleming@gmail.com> wrote:

> On Monday, April 9, 2018 at 8:37:53 AM UTC-4, Nicolas Lesser wrote:
>>
>> Please use another name, instantiation refers to only templates. In fact,
>> every use of "instantiate" in your emails is just wrong.
>>
>
> Unfortunately this term is commonly used this way in the wild, especially
> with languages which don't have templates. It'd be nice if C++ had a
> standardized single-word replacement for "begin the lifetime of".
> "construct" doesn't quite fit.
>

Oh wow. I find "define" sufficient for everyday needs. Of course placement
new is problematic if I use "define", but I don't talk about placement new
often, so it's fine :)

--
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/CALmDwq3qu3msxtrP8hQ%2Bzf2%3DdGxYPcy9VhH1-PunpVjbU%3DZ4Ng%40mail.gmail.com.

--000000000000f192700569e46cc7
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On S=
un, Apr 15, 2018 at 4:26 PM, Todd Fleming <span dir=3D"ltr">&lt;<a href=3D"=
mailto:tbfleming@gmail.com" target=3D"_blank">tbfleming@gmail.com</a>&gt;</=
span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><span class=
=3D"">On Monday, April 9, 2018 at 8:37:53 AM UTC-4, Nicolas Lesser wrote:<b=
lockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-=
left:1px #ccc solid;padding-left:1ex"><div dir=3D"auto"><div>Please use ano=
ther name, instantiation refers to only templates. In fact, every use of &q=
uot;instantiate&quot; in your emails is just wrong.</div></div></blockquote=
><div><br></div></span><div>Unfortunately this term is commonly used this w=
ay in the wild, especially with languages which don&#39;t have templates. I=
t&#39;d be nice if C++ had a standardized single-word replacement for &quot=
;begin the lifetime of&quot;. &quot;construct&quot; doesn&#39;t quite fit.<=
/div></div></blockquote><div><br></div><div>Oh wow. I find &quot;define&quo=
t; sufficient for everyday needs. Of course placement new is problematic if=
 I use &quot;define&quot;, but I don&#39;t talk about placement new often, =
so it&#39;s fine :)=C2=A0</div></div><br></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/CALmDwq3qu3msxtrP8hQ%2Bzf2%3DdGxYPcy9=
VhH1-PunpVjbU%3DZ4Ng%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALmDwq3qu3=
msxtrP8hQ%2Bzf2%3DdGxYPcy9VhH1-PunpVjbU%3DZ4Ng%40mail.gmail.com</a>.<br />

--000000000000f192700569e46cc7--

.