Topic: Anyone else think that a std::has_member would be useful?


Author: Evan Teran <evan.teran@gmail.com>
Date: Tue, 22 Oct 2013 20:56:35 -0700 (PDT)
Raw View
------=_Part_5084_1284539.1382500595758
Content-Type: text/plain; charset=ISO-8859-1

I'm new to the forum so forgive me if this has been discussed in the past.
I was  reading about new C++14 template constraints and other work with
compile time reflection, and I thought that there may be a relatively
simple mechanism which could be very useful in these categories.

What I am thinking is something like this:

std::has_member<&T::member, int(int)>::value

I'm not settled on has_member, perhaps "is_callable" would be a better fit,
but that's an unimportant detail.

The idea being to test if there is a function in T, named "member" which
has a signature matching "int member(int)". I believe that this would be
require special compile support since if T::member doesn't exist, it would
of course normally be compiler error to write things like &T::member.

The idea isn't quite fleshed out in my mind of how it could/should be
implemented while still keeping with the spirit of C++, but I do feel that
in general, the ability to test for the existence of a class member could
be monumentally useful. It would allow things like:

* using static asserts to get better compiler errors when types are missing
operators/member functions
* it would allow using enable_if to select a template specialization based
on what a class supports which I think has interesting potential

Thoughts, Criticisms and Improvements are all welcome :-)

Evan

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_5084_1284539.1382500595758
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I'm new to the forum so forgive me if this has been discus=
sed in the past. I was &nbsp;reading about new C++14 template constraints a=
nd other work with compile time reflection, and I thought that there may be=
 a relatively simple mechanism which could be very useful in these categori=
es.<div><br></div><div>What I am thinking is something like this:</div><div=
><br></div><div><div class=3D"prettyprint" style=3D"background-color: rgb(2=
50, 250, 250); border: 1px solid rgb(187, 187, 187); word-wrap: break-word;=
"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"=
font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, =
255);"><span style=3D"color: #000;" class=3D"styled-by-prettify">std</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">has_member</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">&lt;&amp;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">T</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">member</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">int</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">)&gt;::</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">value</span></sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></d=
iv></code></div><div><br></div>I'm not settled on has_member, perhaps "is_c=
allable" would be a better fit, but that's an unimportant detail.</div><div=
><br>The idea being to test if there is a function in T, named "member" whi=
ch has a signature matching "int member(int)". I believe that this would be=
 require special compile support since if T::member doesn't exist, it would=
 of course normally be compiler error to write things like &amp;T::member.<=
/div><div><br></div><div>The idea isn't quite fleshed out in my mind of how=
 it could/should be implemented while still keeping with the spirit of C++,=
 but I do feel that in general, the ability to test for the existence of a =
class member could be monumentally useful. It would allow things like:</div=
><div><br></div><div>* using static asserts to get better compiler errors w=
hen types are missing operators/member functions</div><div>* it would allow=
 using enable_if to select a template specialization based on what a class =
supports which I think has interesting potential</div><div><br></div><div>T=
houghts, Criticisms and Improvements are all welcome :-)</div><div><br></di=
v><div>Evan</div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_5084_1284539.1382500595758--

.


Author: "J. Daniel Garcia" <josedaniel.garcia@uc3m.es>
Date: Wed, 23 Oct 2013 10:27:34 +0200
Raw View
--089e0102f84a64837504e9644c38
Content-Type: text/plain; charset=ISO-8859-1

Hi Eva,

What would be the use cases.

In particular, are all the use cases for this feature in generic contexts?
Or did you find some intersting use case in non generic contexts?
--
  J. Daniel


> What I am thinking is something like this:
>
> std::has_member<&T::member, int(int)>::value
>
> I'm not settled on has_member, perhaps "is_callable" would be a better
> fit, but that's an unimportant detail.
>
> The idea being to test if there is a function in T, named "member" which
> has a signature matching "int member(int)". I believe that this would be
> require special compile support since if T::member doesn't exist, it would
> of course normally be compiler error to write things like &T::member.
>
> The idea isn't quite fleshed out in my mind of how it could/should be
> implemented while still keeping with the spirit of C++, but I do feel that
> in general, the ability to test for the existence of a class member could
> be monumentally useful. It would allow things like:
>
> * using static asserts to get better compiler errors when types are
> missing operators/member functions
> * it would allow using enable_if to select a template specialization based
> on what a class supports which I think has interesting potential
>
> Thoughts, Criticisms and Improvements are all welcome :-)
>
> Evan
>
> --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--089e0102f84a64837504e9644c38
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Eva,<div><br></div><div>What would be the use cases.</d=
iv><div><br></div><div>In particular, are all the use cases for this featur=
e in generic contexts? Or did you find some intersting use case in non gene=
ric contexts?</div>

<div class=3D"gmail_extra"><div><div dir=3D"ltr">--</div></div><div>=A0 J. =
Daniel</div><div><br></div><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><br></div><div>What I am thinking is something like t=
his:</div><div><br></div><div><div style=3D"background-color:rgb(250,250,25=
0);border:1px solid rgb(187,187,187);word-wrap:break-word"><code><div><span=
 style=3D"font-family:Arial,Helvetica,sans-serif;background-color:rgb(255,2=
55,255)"><span style>std</span><span style=3D"color:#660">::</span><span st=
yle>has_member</span><span style=3D"color:#660">&lt;&amp;</span><span style=
>T</span><span style=3D"color:#660">::</span><span style>member</span><span=
 style=3D"color:#660">,</span><span style> </span><span style=3D"color:#008=
">int</span><span style=3D"color:#660">(</span><span style=3D"color:#008">i=
nt</span><span style=3D"color:#660">)&gt;::</span><span style>value</span><=
/span><span style><br>

</span></div></code></div><div><br></div>I&#39;m not settled on has_member,=
 perhaps &quot;is_callable&quot; would be a better fit, but that&#39;s an u=
nimportant detail.</div><div><br>The idea being to test if there is a funct=
ion in T, named &quot;member&quot; which has a signature matching &quot;int=
 member(int)&quot;. I believe that this would be require special compile su=
pport since if T::member doesn&#39;t exist, it would of course normally be =
compiler error to write things like &amp;T::member.</div>

<div><br></div><div>The idea isn&#39;t quite fleshed out in my mind of how =
it could/should be implemented while still keeping with the spirit of C++, =
but I do feel that in general, the ability to test for the existence of a c=
lass member could be monumentally useful. It would allow things like:</div>

<div><br></div><div>* using static asserts to get better compiler errors wh=
en types are missing operators/member functions</div><div>* it would allow =
using enable_if to select a template specialization based on what a class s=
upports which I think has interesting potential</div>

<div><br></div><div>Thoughts, Criticisms and Improvements are all welcome :=
-)</div><span class=3D"HOEnZb"><font color=3D"#888888"><div><br></div><div>=
Evan</div></font></span></div><span class=3D"HOEnZb"><font color=3D"#888888=
">

<p></p>

-- <br>
=A0<br>
--- <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%2Bunsubscribe@isocpp.org" 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" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--089e0102f84a64837504e9644c38--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 23 Oct 2013 11:56:46 +0300
Raw View
--001a11c35c286a1a6704e964b21a
Content-Type: text/plain; charset=ISO-8859-1

On 23 October 2013 06:56, Evan Teran <evan.teran@gmail.com> wrote:

> I'm new to the forum so forgive me if this has been discussed in the past.
> I was  reading about new C++14 template constraints and other work with
> compile time reflection, and I thought that there may be a relatively
> simple mechanism which could be very useful in these categories.
>
> What I am thinking is something like this:
>
> std::has_member<&T::member, int(int)>::value
>
> I'm not settled on has_member, perhaps "is_callable" would be a better
> fit, but that's an unimportant detail.
>
> The idea being to test if there is a function in T, named "member" which
> has a signature matching "int member(int)". I believe that this would be
> require special compile support since if T::member doesn't exist, it would
> of course normally be compiler error to write things like &T::member.
>
> The idea isn't quite fleshed out in my mind of how it could/should be
> implemented while still keeping with the spirit of C++, but I do feel that
> in general, the ability to test for the existence of a class member could
> be monumentally useful. It would allow things like:
>
> * using static asserts to get better compiler errors when types are
> missing operators/member functions
> * it would allow using enable_if to select a template specialization based
> on what a class supports which I think has interesting potential
>
> Thoughts, Criticisms and Improvements are all welcome :-)
>

I have written custom traits for this sort of thing many times. The feature
itself would be
quite useful.

Concepts lite seems to cover it, I can write

template <class T> concept bool has_f_member()
{
  return requires(T x) {x.f();};
}

with the current concepts branch of gcc.

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--001a11c35c286a1a6704e964b21a
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 23 October 2013 06:56, Evan Teran <span dir=3D"ltr">&lt;<a href=
=3D"mailto:evan.teran@gmail.com" target=3D"_blank">evan.teran@gmail.com</a>=
&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">I&#39;m =
new to the forum so forgive me if this has been discussed in the past. I wa=
s =A0reading about new C++14 template constraints and other work with compi=
le time reflection, and I thought that there may be a relatively simple mec=
hanism which could be very useful in these categories.<div>
<br></div><div>What I am thinking is something like this:</div><div><br></d=
iv><div><div style=3D"background-color:rgb(250,250,250);border:1px solid rg=
b(187,187,187);word-wrap:break-word"><code><div><span style=3D"font-family:=
Arial,Helvetica,sans-serif;background-color:rgb(255,255,255)"><span style>s=
td</span><span style=3D"color:rgb(102,102,0)">::</span><span style>has_memb=
er</span><span style=3D"color:rgb(102,102,0)">&lt;&amp;</span><span style>T=
</span><span style=3D"color:rgb(102,102,0)">::</span><span style>member</sp=
an><span style=3D"color:rgb(102,102,0)">,</span><span style> </span><span s=
tyle=3D"color:rgb(0,0,136)">int</span><span style=3D"color:rgb(102,102,0)">=
(</span><span style=3D"color:rgb(0,0,136)">int</span><span style=3D"color:r=
gb(102,102,0)">)&gt;::</span><span style>value</span></span><span style><br=
>
</span></div></code></div><div><br></div>I&#39;m not settled on has_member,=
 perhaps &quot;is_callable&quot; would be a better fit, but that&#39;s an u=
nimportant detail.</div><div><br>The idea being to test if there is a funct=
ion in T, named &quot;member&quot; which has a signature matching &quot;int=
 member(int)&quot;. I believe that this would be require special compile su=
pport since if T::member doesn&#39;t exist, it would of course normally be =
compiler error to write things like &amp;T::member.</div>
<div><br></div><div>The idea isn&#39;t quite fleshed out in my mind of how =
it could/should be implemented while still keeping with the spirit of C++, =
but I do feel that in general, the ability to test for the existence of a c=
lass member could be monumentally useful. It would allow things like:</div>
<div><br></div><div>* using static asserts to get better compiler errors wh=
en types are missing operators/member functions</div><div>* it would allow =
using enable_if to select a template specialization based on what a class s=
upports which I think has interesting potential</div>
<div><br></div><div>Thoughts, Criticisms and Improvements are all welcome :=
-)</div></div></blockquote><div><br></div><div>I have written custom traits=
 for this sort of thing many times. The feature itself would be<br></div>
<div>quite useful.<br><br></div><div>Concepts lite seems to cover it, I can=
 write<br><br>template &lt;class T&gt; concept bool has_f_member()<br>{<br>=
=A0 return requires(T x) {x.f();};<br>}<br><br></div><div>with the current =
concepts branch of gcc.<br>
</div></div></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c35c286a1a6704e964b21a--

.


Author: "J. Daniel Garcia" <josedaniel.garcia@uc3m.es>
Date: Wed, 23 Oct 2013 10:59:07 +0200
Raw View
--047d7b10cb3336371f04e964bdd2
Content-Type: text/plain; charset=ISO-8859-1

That was the rationale behind my question.

Concepts lite covers the issue in generic contexts.

I was wondering if there might be any use case in non-generic contexts. I
think the answer should be no. But I am not quite sure.

--
  J. Daniel

On Wed, Oct 23, 2013 at 10:56 AM, Ville Voutilainen <
ville.voutilainen@gmail.com> wrote:

>
>
>
> On 23 October 2013 06:56, Evan Teran <evan.teran@gmail.com> wrote:
>
>> I'm new to the forum so forgive me if this has been discussed in the
>> past. I was  reading about new C++14 template constraints and other work
>> with compile time reflection, and I thought that there may be a relatively
>> simple mechanism which could be very useful in these categories.
>>
>> What I am thinking is something like this:
>>
>> std::has_member<&T::member, int(int)>::value
>>
>> I'm not settled on has_member, perhaps "is_callable" would be a better
>> fit, but that's an unimportant detail.
>>
>> The idea being to test if there is a function in T, named "member" which
>> has a signature matching "int member(int)". I believe that this would be
>> require special compile support since if T::member doesn't exist, it would
>> of course normally be compiler error to write things like &T::member.
>>
>> The idea isn't quite fleshed out in my mind of how it could/should be
>> implemented while still keeping with the spirit of C++, but I do feel that
>> in general, the ability to test for the existence of a class member could
>> be monumentally useful. It would allow things like:
>>
>> * using static asserts to get better compiler errors when types are
>> missing operators/member functions
>> * it would allow using enable_if to select a template specialization
>> based on what a class supports which I think has interesting potential
>>
>> Thoughts, Criticisms and Improvements are all welcome :-)
>>
>
> I have written custom traits for this sort of thing many times. The
> feature itself would be
>  quite useful.
>
> Concepts lite seems to cover it, I can write
>
> template <class T> concept bool has_f_member()
> {
>   return requires(T x) {x.f();};
> }
>
> with the current concepts branch of gcc.
>
> --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--047d7b10cb3336371f04e964bdd2
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">That was the rationale behind my question.<div><br></div><=
div>Concepts lite covers the issue in generic contexts.</div><div><br></div=
><div>I was wondering if there might be any use case in non-generic context=
s. I think the answer should be no. But I am not quite sure.</div>

<div class=3D"gmail_extra"><br clear=3D"all"><div><div dir=3D"ltr">--</div>=
</div><div>=A0 J. Daniel</div><br><div class=3D"gmail_quote">On Wed, Oct 23=
, 2013 at 10:56 AM, Ville Voutilainen <span dir=3D"ltr">&lt;<a href=3D"mail=
to:ville.voutilainen@gmail.com" target=3D"_blank">ville.voutilainen@gmail.c=
om</a>&gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br><div class=3D"gmail_ext=
ra"><br><br><div class=3D"gmail_quote"><div class=3D"im">On 23 October 2013=
 06:56, Evan Teran <span dir=3D"ltr">&lt;<a href=3D"mailto:evan.teran@gmail=
..com" target=3D"_blank">evan.teran@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">I&#39;m =
new to the forum so forgive me if this has been discussed in the past. I wa=
s =A0reading about new C++14 template constraints and other work with compi=
le time reflection, and I thought that there may be a relatively simple mec=
hanism which could be very useful in these categories.<div>


<br></div><div>What I am thinking is something like this:</div><div><br></d=
iv><div><div style=3D"background-color:rgb(250,250,250);border:1px solid rg=
b(187,187,187);word-wrap:break-word"><code><div><span style=3D"font-family:=
Arial,Helvetica,sans-serif;background-color:rgb(255,255,255)"><span>std</sp=
an><span style=3D"color:rgb(102,102,0)">::</span><span>has_member</span><sp=
an style=3D"color:rgb(102,102,0)">&lt;&amp;</span><span>T</span><span style=
=3D"color:rgb(102,102,0)">::</span><span>member</span><span style=3D"color:=
rgb(102,102,0)">,</span><span> </span><span style=3D"color:rgb(0,0,136)">in=
t</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:r=
gb(0,0,136)">int</span><span style=3D"color:rgb(102,102,0)">)&gt;::</span><=
span>value</span></span><span><br>


</span></div></code></div><div><br></div>I&#39;m not settled on has_member,=
 perhaps &quot;is_callable&quot; would be a better fit, but that&#39;s an u=
nimportant detail.</div><div><br>The idea being to test if there is a funct=
ion in T, named &quot;member&quot; which has a signature matching &quot;int=
 member(int)&quot;. I believe that this would be require special compile su=
pport since if T::member doesn&#39;t exist, it would of course normally be =
compiler error to write things like &amp;T::member.</div>


<div><br></div><div>The idea isn&#39;t quite fleshed out in my mind of how =
it could/should be implemented while still keeping with the spirit of C++, =
but I do feel that in general, the ability to test for the existence of a c=
lass member could be monumentally useful. It would allow things like:</div>


<div><br></div><div>* using static asserts to get better compiler errors wh=
en types are missing operators/member functions</div><div>* it would allow =
using enable_if to select a template specialization based on what a class s=
upports which I think has interesting potential</div>


<div><br></div><div>Thoughts, Criticisms and Improvements are all welcome :=
-)</div></div></blockquote><div><br></div></div><div>I have written custom =
traits for this sort of thing many times. The feature itself would be<br>

</div>
<div>quite useful.<br><br></div><div>Concepts lite seems to cover it, I can=
 write<br><br>template &lt;class T&gt; concept bool has_f_member()<br>{<br>=
=A0 return requires(T x) {x.f();};<br>}<br><br></div><div>with the current =
concepts branch of gcc.<br>


</div></div></div></div><div class=3D"HOEnZb"><div class=3D"h5">

<p></p>

-- <br>
=A0<br>
--- <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%2Bunsubscribe@isocpp.org" 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" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--047d7b10cb3336371f04e964bdd2--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 23 Oct 2013 12:10:15 +0300
Raw View
--089e0149cda2a8c04504e964e28e
Content-Type: text/plain; charset=ISO-8859-1

On 23 October 2013 11:59, J. Daniel Garcia <josedaniel.garcia@uc3m.es>wrote:

> That was the rationale behind my question.
>
> Concepts lite covers the issue in generic contexts.
>
> I was wondering if there might be any use case in non-generic contexts. I
> think the answer should be no. But I am not quite sure.
>
>
>
Well, concepts lite probably covers it for non-generic contexts as well. :)
I suppose I could write the
'requires' into a non-template. Not sure though, since that ICEs the
implementation. :D

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--089e0149cda2a8c04504e964e28e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 23 October 2013 11:59, J. Daniel Garcia <span dir=3D"ltr">&lt;<a=
 href=3D"mailto:josedaniel.garcia@uc3m.es" target=3D"_blank">josedaniel.gar=
cia@uc3m.es</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">That was the rationale behi=
nd my question.<div><br></div><div>Concepts lite covers the issue in generi=
c contexts.</div>
<div><br></div><div>I was wondering if there might be any use case in non-g=
eneric contexts. I think the answer should be no. But I am not quite sure.<=
/div>

<div class=3D"gmail_extra"><br><br></div></div></blockquote><div><br></div>=
<div>Well, concepts lite probably covers it for non-generic contexts as wel=
l. :) I suppose I could write the<br></div><div>&#39;requires&#39; into a n=
on-template. Not sure though, since that ICEs the implementation. :D<br>
</div></div><br></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--089e0149cda2a8c04504e964e28e--

.


Author: Evan Teran <evan.teran@gmail.com>
Date: Wed, 23 Oct 2013 09:36:47 -0700 (PDT)
Raw View
------=_Part_250_25211723.1382546207237
Content-Type: text/plain; charset=ISO-8859-1

Yes, it seems that Concepts lite covers the use cases I was thinking of
very well.

Now that I know more about it, i am looking forward to playing with it in
C+14!

Thanks for the feedback.

Evan



On Wednesday, October 23, 2013 5:10:15 AM UTC-4, Ville Voutilainen wrote:
>
>
>
>
> On 23 October 2013 11:59, J. Daniel Garcia <josedani...@uc3m.es<javascript:>
> > wrote:
>
>> That was the rationale behind my question.
>>
>> Concepts lite covers the issue in generic contexts.
>>
>> I was wondering if there might be any use case in non-generic contexts. I
>> think the answer should be no. But I am not quite sure.
>>
>>
>>
> Well, concepts lite probably covers it for non-generic contexts as well.
> :) I suppose I could write the
> 'requires' into a non-template. Not sure though, since that ICEs the
> implementation. :D
>
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_250_25211723.1382546207237
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Yes, it seems that Concepts lite covers the use cases I wa=
s thinking of very well.<div><br></div><div>Now that I know more about it, =
i am looking forward to playing with it in C+14!</div><div><br></div><div>T=
hanks for the feedback.</div><div><br></div><div>Evan</div><div><br></div><=
div><br><br>On Wednesday, October 23, 2013 5:10:15 AM UTC-4, Ville Voutilai=
nen 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"ltr"><br=
><div><br><br><div class=3D"gmail_quote">On 23 October 2013 11:59, J. Danie=
l Garcia <span dir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gd=
f-obfuscated-mailto=3D"l8yVqdL12WoJ">josedani...@uc3m.es</a>&gt;</span> wro=
te:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">That was the rationale behi=
nd my question.<div><br></div><div>Concepts lite covers the issue in generi=
c contexts.</div>
<div><br></div><div>I was wondering if there might be any use case in non-g=
eneric contexts. I think the answer should be no. But I am not quite sure.<=
/div>

<div><br><br></div></div></blockquote><div><br></div><div>Well, concepts li=
te probably covers it for non-generic contexts as well. :) I suppose I coul=
d write the<br></div><div>'requires' into a non-template. Not sure though, =
since that ICEs the implementation. :D<br>
</div></div><br></div></div>
</blockquote></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_250_25211723.1382546207237--

.


Author: Sebastian Gesemann <s.gesemann@gmail.com>
Date: Thu, 24 Oct 2013 10:38:39 +0200
Raw View
On Wed, Oct 23, 2013 at 5:56 AM, Evan Teran <evan.teran@gmail.com> wrote:
> I'm new to the forum so forgive me if this has been discussed in the past. I
> was  reading about new C++14 template constraints and other work with
> compile time reflection, and I thought that there may be a relatively simple
> mechanism which could be very useful in these categories.
>
> What I am thinking is something like this:
>
> std::has_member<&T::member, int(int)>::value

Just for completeness, I'd like to mention that "SFINAE" has gotten
better in C++11:

    template<class T>
    auto begin(T& x) -> decltype(x.begin())
    { return x.begin(); }

If there is no non-static member function T::begin, the return type
cannot be deduced and the template is simply ignored. So, this would
be a kind of "implicit constraining". There is no need to write a
requires clause or an enable_if for that:

    template<class T>
    requires(has_member<....>()) <-- kind of redundant
    auto begin(T& x) -> decltype(x.begin())
    { return x.begin(); }

Cheers!
SG

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.