Topic: Can dot operator be used to make a ".." range ?


Author: Cleiton Santoia <cleitonsantoia@gmail.com>
Date: Wed, 9 Aug 2017 16:44:12 -0700 (PDT)
Raw View
------=_Part_310_589371822.1502322252349
Content-Type: multipart/alternative;
 boundary="----=_Part_311_507617189.1502322252349"

------=_Part_311_507617189.1502322252349
Content-Type: text/plain; charset="UTF-8"

Can I do a double "." ?

struct iterator{

   struct first_leg {
     iterator& it_;
     first_leg(const iterator& it) : it_(it) {}
     Range operator.(const iterator &end) { return Range(it_, end); };
   }

   first_leg operator.() { return first_leg(*this); }
}

iterator a = c.begin();
iterator b = c.end()
Range x = a..b; // dot operator twice ?

for ( auto i : x ) {
// code...
}

BR
Cleiton

--
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/1aac57ca-a216-4553-bc8e-36580a24b2c5%40isocpp.org.

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

<div dir=3D"ltr">Can I do a double &quot;.&quot; ?=C2=A0<div><br></div><div=
><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); =
border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; w=
ord-wrap: break-word;"><code class=3D"prettyprint"><font face=3D"courier ne=
w, monospace"><div class=3D"subprettyprint"><font color=3D"#660066"><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> iterator</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0</span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> first_leg </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0iterator</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: #000;" class=3D"styled-by-prettify">it_</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></span></font><span style=3D"color: rgb(=
0, 0, 0);"><span style=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0=
 =C2=A0 =C2=A0first_leg</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(const=C2=A0</span></span><span class=3D"styled-by-prettify" s=
tyle=3D"color: rgb(0, 0, 0);">iterator</span><span class=3D"styled-by-prett=
ify" style=3D"color: rgb(102, 102, 0);">&amp;</span><span class=3D"styled-b=
y-prettify" style=3D"color: rgb(0, 0, 0);">=C2=A0</span><span class=3D"styl=
ed-by-prettify" style=3D"color: rgb(0, 0, 0);">it</span><span style=3D"colo=
r: rgb(102, 102, 0);">) : it_(it) {}</span></div><div class=3D"subprettypri=
nt"><font color=3D"#660066"><span style=3D"color: #000;" class=3D"styled-by=
-prettify">=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color: #606;" class=3D=
"styled-by-prettify">Range</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">operator</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">.(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">con=
st</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> iterato=
r </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">end</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #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: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pre=
ttify">Range</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(it_, end</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: #660;" class=3D"styled-by-prettif=
y">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><b=
r>=C2=A0 =C2=A0first_leg=C2=A0</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">operator</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">.() { return=C2=A0</span></font><span style=3D"color: rgb=
(0, 0, 0);">first_leg</span><span style=3D"color: rgb(0, 0, 0);">(*this);</=
span><span style=3D"color: rgb(102, 102, 0);">=C2=A0}</span></div></font><f=
ont face=3D"courier new, monospace"><div class=3D"subprettyprint"><font col=
or=3D"#660066"><span style=3D"color: #660;" class=3D"styled-by-prettify">}<=
br><br>iterator a =3D c.begin();<br>iterator b =3D c.end()<br>Range x =3D a=
...b;=C2=A0</span></font><span style=3D"color: rgb(102, 102, 0);">// dot ope=
rator twice ?</span><font color=3D"#660066"><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify"><br><br>for ( auto i : x ) {=C2=A0<br>// code...=
<br>}<br></span></font></div></font></code></div><br>BR</div><div>Cleiton</=
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/1aac57ca-a216-4553-bc8e-36580a24b2c5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/1aac57ca-a216-4553-bc8e-36580a24b2c5=
%40isocpp.org</a>.<br />

------=_Part_311_507617189.1502322252349--

------=_Part_310_589371822.1502322252349--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 9 Aug 2017 20:14:02 -0700 (PDT)
Raw View
------=_Part_467_763278222.1502334842515
Content-Type: multipart/alternative;
 boundary="----=_Part_468_94324532.1502334842515"

------=_Part_468_94324532.1502334842515
Content-Type: text/plain; charset="UTF-8"

If you're talking about Stroustrup's operator-dot proposal, no; `..` would
still be syntactic nonsense. The proposed `operator.` doesn't really
override the use of the `.` grammar. It overrides essentially *all*
operations that would access that type through a variable or reference to
an object.

--
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/4a554d98-4fac-4763-b791-37fd1f7e289c%40isocpp.org.

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

<div dir=3D"ltr">If you&#39;re talking about Stroustrup&#39;s operator-dot =
proposal, no; `..` would still be syntactic nonsense. The proposed `operato=
r.` doesn&#39;t really override the use of the `.` grammar. It overrides es=
sentially <i>all</i> operations that would access that type through a varia=
ble or reference to an object.<br></div>

<p></p>

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

------=_Part_468_94324532.1502334842515--

------=_Part_467_763278222.1502334842515--

.