Topic: Any plans to remove need for boilerplate code in


Author: nx02columbia@gmail.com
Date: Sat, 10 Nov 2012 17:22:10 -0800 (PST)
Raw View
------=_Part_143_1805399.1352596930535
Content-Type: text/plain; charset=ISO-8859-1

Hi,
Are there any plans to make something like this
struct my_struct
{
//....
bool operator ==() = default;  // causes the struct to be compared in a
tuple like way, first declared member variable first, if same then look at
second... would work only for "C++" code aka wont work on structs that have
raw pointer members
}
Also this would be nice

bool operator !=() = using operator ==;

Maybe = before default and using could be removed.

--




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

Hi, <br>Are there any plans to make something like this<br>struct my_struct=
<br>{<br>//....<br>bool operator =3D=3D() =3D default;&nbsp; // causes the =
struct to be compared in a tuple like way, first declared member variable f=
irst, if same then look at second... would work only for "C++" code aka won=
t work on structs that have raw pointer members<br>}<br>Also this would be =
nice<br><br>bool operator !=3D() =3D using operator =3D=3D;<br><br>Maybe =
=3D before default and using could be removed.<br>

<p></p>

-- <br />
&nbsp;<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_143_1805399.1352596930535--

.


Author: Xeo <hivemaster@hotmail.de>
Date: Sat, 10 Nov 2012 19:36:13 -0800 (PST)
Raw View
------=_Part_364_17148890.1352604973132
Content-Type: text/plain; charset=ISO-8859-1

Just a quick comment on one thing.

On Sunday, November 11, 2012 2:22:10 AM UTC+1, nx02co...@gmail.com wrote:
>
> would work only for "C++" code aka wont work on structs that have raw
> pointer members
>
Having raw pointers in C++ is perfectly fine, *as long as they don't own
anything*.

--




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

Just a quick comment on one thing.<br><br>On Sunday, November 11, 2012 2:22=
:10 AM UTC+1, nx02co...@gmail.com wrote:<blockquote class=3D"gmail_quote" s=
tyle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-le=
ft: 1ex;">would work only for "C++" code aka wont work on structs that have=
 raw pointer members<br></blockquote><div>Having raw pointers in C++ is per=
fectly fine, <i>as long as they don't own anything</i>.<br></div>

<p></p>

-- <br />
&nbsp;<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_364_17148890.1352604973132--

.


Author: nx02columbia@gmail.com
Date: Sat, 10 Nov 2012 20:13:19 -0800 (PST)
Raw View
------=_Part_92_12178042.1352607199632
Content-Type: text/plain; charset=ISO-8859-1



On Sunday, November 11, 2012 5:36:13 AM UTC+2, Xeo wrote:
>
> Just a quick comment on one thing.
>
> On Sunday, November 11, 2012 2:22:10 AM UTC+1, nx02co...@gmail.com wrote:
>>
>> would work only for "C++" code aka wont work on structs that have raw
>> pointer members
>>
> Having raw pointers in C++ is perfectly fine, *as long as they don't own
> anything*.
>
Ill elaborate:
problem is the following, if there is "declarative"  syntax for == there
must be one for <, <=...
now pointers have multiple problems when it comes to what is default :
- it is possible that p1<p2, but *p1>*p2
- for == is default comparison on pointers or on the pointed to, aka do you
care if they point to the same instance or if the instances are the same
-if one pointer is null how do you do < , >=... comparisons
one could argue that you can fix first 2 problems by having specializations
for  smart pointers, but still they dont solve third one. fact is that
empty std::string can be compared to other string... but if you have option
"not set" (nullptr) I dont see way around it

--




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

<br><br>On Sunday, November 11, 2012 5:36:13 AM UTC+2, Xeo wrote:<blockquot=
e class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: =
1px #ccc solid;padding-left: 1ex;">Just a quick comment on one thing.<br><b=
r>On Sunday, November 11, 2012 2:22:10 AM UTC+1, <a>nx02co...@gmail.com</a>=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8e=
x;border-left:1px #ccc solid;padding-left:1ex">would work only for "C++" co=
de aka wont work on structs that have raw pointer members<br></blockquote><=
div>Having raw pointers in C++ is perfectly fine, <i>as long as they don't =
own anything</i>.<br></div></blockquote><div>Ill elaborate:<br>problem is t=
he following, if there is "declarative"&nbsp; syntax for =3D=3D there must =
be one for &lt;, &lt;=3D...<br>now pointers have multiple problems when it =
comes to what is default :<br>- it is possible that p1&lt;p2, but *p1&gt;*p=
2<br>- for =3D=3D is default comparison on pointers or on the pointed to, a=
ka do you care if they point to the same instance or if the instances are t=
he same<br>-if one pointer is null how do you do &lt; , &gt;=3D... comparis=
ons<br>one could argue that you can fix first 2 problems by having speciali=
zations for&nbsp; smart pointers, but still they dont solve third one. fact=
 is that empty std::string can be compared to other string... but if you ha=
ve option "not set" (nullptr) I dont see way around it<br><br></div>

<p></p>

-- <br />
&nbsp;<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_92_12178042.1352607199632--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sat, 10 Nov 2012 20:27:06 -0800 (PST)
Raw View
------=_Part_1551_10708097.1352608026657
Content-Type: text/plain; charset=ISO-8859-1



On Saturday, November 10, 2012 8:13:19 PM UTC-8, nx02co...@gmail.com wrote:
>
>
>
> On Sunday, November 11, 2012 5:36:13 AM UTC+2, Xeo wrote:
>>
>> Just a quick comment on one thing.
>>
>> On Sunday, November 11, 2012 2:22:10 AM UTC+1, nx02co...@gmail.com wrote:
>>>
>>> would work only for "C++" code aka wont work on structs that have raw
>>> pointer members
>>>
>> Having raw pointers in C++ is perfectly fine, *as long as they don't own
>> anything*.
>>
> Ill elaborate:
> problem is the following, if there is "declarative"  syntax for == there
> must be one for <, <=...
> now pointers have multiple problems when it comes to what is default :
> - it is possible that p1<p2, but *p1>*p2
> - for == is default comparison on pointers or on the pointed to, aka do
> you care if they point to the same instance or if the instances are the same
> -if one pointer is null how do you do < , >=... comparisons
> one could argue that you can fix first 2 problems by having
> specializations for  smart pointers, but still they dont solve third one.
> fact is that empty std::string can be compared to other string... but if
> you have option "not set" (nullptr) I dont see way around it
>
>
I don't know. For this kind of thing, I'm trusting the compile-time
reflection study group to provide simple ways to solve this problem. So you
simply write:

bool operator ==(const T& rhs) const { return std::double_reflect_equals<T
>(*this,  rhs); }

Or something to that effect.

--




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

<br><br>On Saturday, November 10, 2012 8:13:19 PM UTC-8, nx02co...@gmail.co=
m wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0=
..8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><br><br>On Sunday, Nov=
ember 11, 2012 5:36:13 AM UTC+2, Xeo wrote:<blockquote class=3D"gmail_quote=
" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-le=
ft:1ex">Just a quick comment on one thing.<br><br>On Sunday, November 11, 2=
012 2:22:10 AM UTC+1, <a>nx02co...@gmail.com</a> wrote:<blockquote class=3D=
"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc soli=
d;padding-left:1ex">would work only for "C++" code aka wont work on structs=
 that have raw pointer members<br></blockquote><div>Having raw pointers in =
C++ is perfectly fine, <i>as long as they don't own anything</i>.<br></div>=
</blockquote><div>Ill elaborate:<br>problem is the following, if there is "=
declarative"&nbsp; syntax for =3D=3D there must be one for &lt;, &lt;=3D...=
<br>now pointers have multiple problems when it comes to what is default :<=
br>- it is possible that p1&lt;p2, but *p1&gt;*p2<br>- for =3D=3D is defaul=
t comparison on pointers or on the pointed to, aka do you care if they poin=
t to the same instance or if the instances are the same<br>-if one pointer =
is null how do you do &lt; , &gt;=3D... comparisons<br>one could argue that=
 you can fix first 2 problems by having specializations for&nbsp; smart poi=
nters, but still they dont solve third one. fact is that empty std::string =
can be compared to other string... but if you have option "not set" (nullpt=
r) I dont see way around it<br><br></div></blockquote><div><br>I don't know=
.. For this kind of thing, I'm trusting the compile-time reflection study gr=
oup to provide simple ways to solve this problem. So you simply write:<br><=
br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250)=
; border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px;=
 word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprett=
yprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">bool</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">operator</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">=3D=3D(</span><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">const</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> rhs</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">const=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">return</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">double_reflect_equals</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">T</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&gt;(*</span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">this</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> &n=
bsp;rhs</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code></di=
v><br>Or something to that effect.<br></div>

<p></p>

-- <br />
&nbsp;<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_1551_10708097.1352608026657--

.


Author: nx02columbia@gmail.com
Date: Sat, 10 Nov 2012 20:53:31 -0800 (PST)
Raw View
------=_Part_321_29080149.1352609611604
Content-Type: text/plain; charset=ISO-8859-1

tbh i prefer "codeless" declerative syntax. For the same reason why Herb
prefers for_each over for()... it makes clear what code does more quickly
(in Herbs example you know there is no break, in this case when you have
seen once operator /*...*/ = default or    operator = /*...*/ using  in the
future youll  know *what* it does, aka  you can quickly learn to move
"abstraction level" above from  *how *it is being done to *what *is being
done).
That being said there needs to be a uniform way of doing things and if CTR
group does 10 things it would be ugly to make exception from their style
for this one.
For example IIRC std::to_string is not templated despite the fact that
std::string is typedef of basic_string. For me that is example of things
not fitting nicely.

On Sunday, November 11, 2012 6:27:07 AM UTC+2, Nicol Bolas wrote:
>
>
>
> On Saturday, November 10, 2012 8:13:19 PM UTC-8, nx02co...@gmail.comwrote:
>>
>>
>>
>> On Sunday, November 11, 2012 5:36:13 AM UTC+2, Xeo wrote:
>>>
>>> Just a quick comment on one thing.
>>>
>>> On Sunday, November 11, 2012 2:22:10 AM UTC+1, nx02co...@gmail.comwrote:
>>>>
>>>> would work only for "C++" code aka wont work on structs that have raw
>>>> pointer members
>>>>
>>> Having raw pointers in C++ is perfectly fine, *as long as they don't
>>> own anything*.
>>>
>> Ill elaborate:
>> problem is the following, if there is "declarative"  syntax for == there
>> must be one for <, <=...
>> now pointers have multiple problems when it comes to what is default :
>> - it is possible that p1<p2, but *p1>*p2
>> - for == is default comparison on pointers or on the pointed to, aka do
>> you care if they point to the same instance or if the instances are the same
>> -if one pointer is null how do you do < , >=... comparisons
>> one could argue that you can fix first 2 problems by having
>> specializations for  smart pointers, but still they dont solve third one.
>> fact is that empty std::string can be compared to other string... but if
>> you have option "not set" (nullptr) I dont see way around it
>>
>>
> I don't know. For this kind of thing, I'm trusting the compile-time
> reflection study group to provide simple ways to solve this problem. So you
> simply write:
>
> bool operator ==(const T& rhs) const { return std::double_reflect_equals<T
> >(*this,  rhs); }
>
> Or something to that effect.
>

--




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

tbh i prefer "codeless" declerative syntax. For the same reason why Herb pr=
efers for_each over for()... it makes clear what code does more quickly (in=
 Herbs example you know there is no break, in this case when you have seen =
once operator /*...*/ =3D default or&nbsp;&nbsp;&nbsp; operator =3D /*...*/=
 using&nbsp; in the future youll&nbsp; know <i>what</i> it does, aka&nbsp; =
you can quickly learn to move "abstraction level" above from&nbsp; <i>how <=
/i>it is being done to <i>what </i>is being done).<br>That being said there=
 needs to be a uniform way of doing things and if CTR group does 10 things =
it would be ugly to make exception from their style for this one. <br>For e=
xample IIRC std::to_string is not templated despite the fact that std::stri=
ng is typedef of basic_string. For me that is example of things not fitting=
 nicely. <br><br>On Sunday, November 11, 2012 6:27:07 AM UTC+2, Nicol Bolas=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.=
8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><br><br>On Saturday, No=
vember 10, 2012 8:13:19 PM UTC-8, <a>nx02co...@gmail.com</a> wrote:<blockqu=
ote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1=
px #ccc solid;padding-left:1ex"><br><br>On Sunday, November 11, 2012 5:36:1=
3 AM UTC+2, Xeo wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;m=
argin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">Just a quick =
comment on one thing.<br><br>On Sunday, November 11, 2012 2:22:10 AM UTC+1,=
 <a>nx02co...@gmail.com</a> wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"=
>would work only for "C++" code aka wont work on structs that have raw poin=
ter members<br></blockquote><div>Having raw pointers in C++ is perfectly fi=
ne, <i>as long as they don't own anything</i>.<br></div></blockquote><div>I=
ll elaborate:<br>problem is the following, if there is "declarative"&nbsp; =
syntax for =3D=3D there must be one for &lt;, &lt;=3D...<br>now pointers ha=
ve multiple problems when it comes to what is default :<br>- it is possible=
 that p1&lt;p2, but *p1&gt;*p2<br>- for =3D=3D is default comparison on poi=
nters or on the pointed to, aka do you care if they point to the same insta=
nce or if the instances are the same<br>-if one pointer is null how do you =
do &lt; , &gt;=3D... comparisons<br>one could argue that you can fix first =
2 problems by having specializations for&nbsp; smart pointers, but still th=
ey dont solve third one. fact is that empty std::string can be compared to =
other string... but if you have option "not set" (nullptr) I dont see way a=
round it<br><br></div></blockquote><div><br>I don't know. For this kind of =
thing, I'm trusting the compile-time reflection study group to provide simp=
le ways to solve this problem. So you simply write:<br><br><div style=3D"ba=
ckground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:=
solid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"colo=
r:#008">bool</span><span style=3D"color:#000"> </span><span style=3D"color:=
#008">operator</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#660">=3D=3D(</span><span style=3D"color:#008">const</span><span style=3D=
"color:#000"> T</span><span style=3D"color:#660">&amp;</span><span style=3D=
"color:#000"> rhs</span><span style=3D"color:#660">)</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#008">const</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#660">{</span><span style=3D"color:#=
000"> </span><span style=3D"color:#008">return</span><span style=3D"color:#=
000"> std</span><span style=3D"color:#660">::</span><span style=3D"color:#0=
00">double_reflect_equals</span><span style=3D"color:#660">&lt;</span><span=
 style=3D"color:#000">T</span><span style=3D"color:#660">&gt;(<wbr>*</span>=
<span style=3D"color:#008">this</span><span style=3D"color:#660">,</span><s=
pan style=3D"color:#000"> &nbsp;rhs</span><span style=3D"color:#660">);</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#660">}</span><s=
pan style=3D"color:#000"><br></span></div></code></div><br>Or something to =
that effect.<br></div></blockquote>

<p></p>

-- <br />
&nbsp;<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_321_29080149.1352609611604--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sat, 10 Nov 2012 22:25:20 -0800 (PST)
Raw View
------=_Part_1684_12513746.1352615120701
Content-Type: text/plain; charset=ISO-8859-1

"= default" syntax wasn't added for that reason. It wasn't added to make
auto-generated copy constructors; it was added because it allowed you to
force the compiler to generate what it would have before. You *can't*replicate the behavior of "= default". A class that has a defaulted copy
constructor may be trivially copyable, while a class that has a
user-provided one, even if it does the *exact same thing*, isn't.

It also happens to have nice visual properties and ease of understanding
while it's doing that. But the main purpose was to tell the compiler that,
"I know your rules say you won't auto-generate the copy constructor, but I
want you to do that now anyway".

Considering how relatively infrequently one wants to write a type that has
comparisons (there are types you want to compare, it's just not most of the
types you write), it just seems to me that it's better to let the
reflection study group do their job and provide it as a library feature. I
just don't feel it is important enough to rise to the level where we want
compilers to write that code.

Also, using the "= default" syntax makes it slightly confusing, compared to
the standard meaning. "default" doesn't just mean that the compiler
generates the function. It's only defined for functions that the compiler
would have automatically generated code for; the reason you need it is to
override times when the C++ rules would forbid generating one. Now you're
using it in a circumstance where the compiler would *never* have
automatically generated code for it. Something like "= generate" would show
that it's different from "default", since there is no actual default
version.

On Saturday, November 10, 2012 8:53:31 PM UTC-8, nx02co...@gmail.com wrote:
>
> tbh i prefer "codeless" declerative syntax. For the same reason why Herb
> prefers for_each over for()... it makes clear what code does more quickly
> (in Herbs example you know there is no break, in this case when you have
> seen once operator /*...*/ = default or    operator = /*...*/ using  in the
> future youll  know *what* it does, aka  you can quickly learn to move
> "abstraction level" above from  *how *it is being done to *what *is being
> done).
> That being said there needs to be a uniform way of doing things and if CTR
> group does 10 things it would be ugly to make exception from their style
> for this one.
> For example IIRC std::to_string is not templated despite the fact that
> std::string is typedef of basic_string. For me that is example of things
> not fitting nicely.
>
> On Sunday, November 11, 2012 6:27:07 AM UTC+2, Nicol Bolas wrote:
>>
>>
>>
>> On Saturday, November 10, 2012 8:13:19 PM UTC-8, nx02co...@gmail.comwrote:
>>>
>>>
>>>
>>> On Sunday, November 11, 2012 5:36:13 AM UTC+2, Xeo wrote:
>>>>
>>>> Just a quick comment on one thing.
>>>>
>>>> On Sunday, November 11, 2012 2:22:10 AM UTC+1, nx02co...@gmail.comwrote:
>>>>>
>>>>> would work only for "C++" code aka wont work on structs that have raw
>>>>> pointer members
>>>>>
>>>> Having raw pointers in C++ is perfectly fine, *as long as they don't
>>>> own anything*.
>>>>
>>> Ill elaborate:
>>> problem is the following, if there is "declarative"  syntax for == there
>>> must be one for <, <=...
>>> now pointers have multiple problems when it comes to what is default :
>>> - it is possible that p1<p2, but *p1>*p2
>>> - for == is default comparison on pointers or on the pointed to, aka do
>>> you care if they point to the same instance or if the instances are the same
>>> -if one pointer is null how do you do < , >=... comparisons
>>> one could argue that you can fix first 2 problems by having
>>> specializations for  smart pointers, but still they dont solve third one.
>>> fact is that empty std::string can be compared to other string... but if
>>> you have option "not set" (nullptr) I dont see way around it
>>>
>>>
>> I don't know. For this kind of thing, I'm trusting the compile-time
>> reflection study group to provide simple ways to solve this problem. So you
>> simply write:
>>
>> bool operator ==(const T& rhs) const { return std::double_reflect_equals<
>> T>(*this,  rhs); }
>>
>> Or something to that effect.
>>
>

--




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

"=3D default" syntax wasn't added for that reason. It wasn't added to make =
auto-generated copy constructors; it was added because it allowed you to fo=
rce the compiler to generate what it would have before. You <i>can't</i> re=
plicate the behavior of "=3D default". A class that has a defaulted copy co=
nstructor may be trivially copyable, while a class that has a user-provided=
 one, even if it does the <i>exact same thing</i>, isn't.<br><br>It also ha=
ppens to have nice visual properties and ease of understanding while it's d=
oing that. But the main purpose was to tell the compiler that, "I know your=
 rules say you won't auto-generate the copy constructor, but I want you to =
do that now anyway".<br><br>Considering how relatively infrequently one wan=
ts to write a type that has comparisons (there are types you want to compar=
e, it's just not most of the types you write), it just seems to me that it'=
s better to let the reflection study group do their job and provide it as a=
 library feature. I just don't feel it is important enough to rise to the l=
evel where we want compilers to write that code.<br><br>Also, using the "=
=3D default" syntax makes it slightly confusing, compared to the standard m=
eaning. "default" doesn't just mean that the compiler generates the functio=
n. It's only defined for functions that the compiler would have automatical=
ly generated code for; the reason you need it is to override times when the=
 C++ rules would forbid generating one. Now you're using it in a circumstan=
ce where the compiler would <i>never</i> have automatically generated code =
for it. Something like "=3D generate" would show that it's different from "=
default", since there is no actual default version.<br><br>On Saturday, Nov=
ember 10, 2012 8:53:31 PM UTC-8, nx02co...@gmail.com wrote:<blockquote clas=
s=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #c=
cc solid;padding-left: 1ex;">tbh i prefer "codeless" declerative syntax. Fo=
r the same reason why Herb prefers for_each over for()... it makes clear wh=
at code does more quickly (in Herbs example you know there is no break, in =
this case when you have seen once operator /*...*/ =3D default or&nbsp;&nbs=
p;&nbsp; operator =3D /*...*/ using&nbsp; in the future youll&nbsp; know <i=
>what</i> it does, aka&nbsp; you can quickly learn to move "abstraction lev=
el" above from&nbsp; <i>how </i>it is being done to <i>what </i>is being do=
ne).<br>That being said there needs to be a uniform way of doing things and=
 if CTR group does 10 things it would be ugly to make exception from their =
style for this one. <br>For example IIRC std::to_string is not templated de=
spite the fact that std::string is typedef of basic_string. For me that is =
example of things not fitting nicely. <br><br>On Sunday, November 11, 2012 =
6:27:07 AM UTC+2, Nicol Bolas wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"=
><br><br>On Saturday, November 10, 2012 8:13:19 PM UTC-8, <a>nx02co...@gmai=
l.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-=
left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><br><br>On Sunday, =
November 11, 2012 5:36:13 AM UTC+2, Xeo wrote:<blockquote class=3D"gmail_qu=
ote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding=
-left:1ex">Just a quick comment on one thing.<br><br>On Sunday, November 11=
, 2012 2:22:10 AM UTC+1, <a>nx02co...@gmail.com</a> wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc s=
olid;padding-left:1ex">would work only for "C++" code aka wont work on stru=
cts that have raw pointer members<br></blockquote><div>Having raw pointers =
in C++ is perfectly fine, <i>as long as they don't own anything</i>.<br></d=
iv></blockquote><div>Ill elaborate:<br>problem is the following, if there i=
s "declarative"&nbsp; syntax for =3D=3D there must be one for &lt;, &lt;=3D=
....<br>now pointers have multiple problems when it comes to what is default=
 :<br>- it is possible that p1&lt;p2, but *p1&gt;*p2<br>- for =3D=3D is def=
ault comparison on pointers or on the pointed to, aka do you care if they p=
oint to the same instance or if the instances are the same<br>-if one point=
er is null how do you do &lt; , &gt;=3D... comparisons<br>one could argue t=
hat you can fix first 2 problems by having specializations for&nbsp; smart =
pointers, but still they dont solve third one. fact is that empty std::stri=
ng can be compared to other string... but if you have option "not set" (nul=
lptr) I dont see way around it<br><br></div></blockquote><div><br>I don't k=
now. For this kind of thing, I'm trusting the compile-time reflection study=
 group to provide simple ways to solve this problem. So you simply write:<b=
r><br><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,=
187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><d=
iv><span style=3D"color:#008">bool</span><span style=3D"color:#000"> </span=
><span style=3D"color:#008">operator</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#660">=3D=3D(</span><span style=3D"color:#008">cons=
t</span><span style=3D"color:#000"> T</span><span style=3D"color:#660">&amp=
;</span><span style=3D"color:#000"> rhs</span><span style=3D"color:#660">)<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#008">const</=
span><span style=3D"color:#000"> </span><span style=3D"color:#660">{</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#008">return</span>=
<span style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><=
span style=3D"color:#000">double_reflect_equals</span><span style=3D"color:=
#660">&lt;</span><span style=3D"color:#000">T</span><span style=3D"color:#6=
60">&gt;(<wbr>*</span><span style=3D"color:#008">this</span><span style=3D"=
color:#660">,</span><span style=3D"color:#000"> &nbsp;rhs</span><span style=
=3D"color:#660">);</span><span style=3D"color:#000"> </span><span style=3D"=
color:#660">}</span><span style=3D"color:#000"><br></span></div></code></di=
v><br>Or something to that effect.<br></div></blockquote></blockquote>

<p></p>

-- <br />
&nbsp;<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_1684_12513746.1352615120701--

.