Topic: Allow multi-parameter overloads of operator[]
Author: daryl.vandenbrink@maptek.com.au
Date: Thu, 2 Oct 2014 20:38:32 -0700 (PDT)
Raw View
------=_Part_265_1814131028.1412307512747
Content-Type: text/plain; charset=UTF-8
The title is fairly self-explanatory. It would remove one excuse for
overloading the comma operator and make multi-dimensional array access more
efficient than what is achieved by using proxy classes.
--
---
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_265_1814131028.1412307512747
Content-Type: text/html; charset=UTF-8
<div dir="ltr">The title is fairly self-explanatory. It would remove one excuse for overloading the comma operator and make multi-dimensional array access more efficient than what is achieved by using proxy classes.<br></div>
<p></p>
-- <br />
<br />
--- <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 email to <a href="mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href="mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />
------=_Part_265_1814131028.1412307512747--
.
Author: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@gmail.com>
Date: Fri, 3 Oct 2014 12:55:47 +0200
Raw View
2014-10-03 5:38 GMT+02:00 <daryl.vandenbrink@maptek.com.au>:
> The title is fairly self-explanatory. It would remove one excuse for
> overloading the comma operator and make multi-dimensional array access more
> efficient than what is achieved by using proxy classes.
Could you please elaborate on this? I don't think that the title alone
is self-explanatory. I would like to get a better understanding of
your suggested changes of the Standard.
- Daniel
--
---
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/.
.
Author: David Krauss <potswa@gmail.com>
Date: Fri, 3 Oct 2014 20:18:54 +0800
Raw View
--Apple-Mail=_6EE5315A-F1B4-49AE-A952-09C269078468
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1
On 2014-10-03, at 6:55 PM, Daniel Kr=FCgler <daniel.kruegler@gmail.com> wro=
te:
> Could you please elaborate on this? I don't think that the title alone
> is self-explanatory. I would like to get a better understanding of
> your suggested changes of the Standard.
The problem is the comma operator.
One solution would be to parse it as an operator when all the overloads fou=
nd by name lookup have exactly one parameter, otherwise parse an argument l=
ist.
Deprecate the operator parse, let folks migrate. Proper migration can be ve=
rified by adding a void operator [] () =3D delete; declaration. Knock it ou=
t in the following standard revision.
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
--Apple-Mail=_6EE5315A-F1B4-49AE-A952-09C269078468
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;10–03, at 6:55 PM, Daniel Kr=FCgler <<a href=3D"mailto:danie=
l.kruegler@gmail.com">daniel.kruegler@gmail.com</a>> wrote:</div><br cla=
ss=3D"Apple-interchange-newline"><blockquote type=3D"cite">Could you please=
elaborate on this? I don't think that the title alone<br>is self-explanato=
ry. I would like to get a better understanding of<br>your suggested changes=
of the Standard.<br></blockquote><div><br></div><div>The problem is the co=
mma operator.</div><div><br></div><div>One solution would be to parse it as=
an operator when all the overloads found by name lookup have exactly one p=
arameter, otherwise parse an argument list.</div><div><br></div><div>Deprec=
ate the operator parse, let folks migrate. Proper migration can be verified=
by adding a <font face=3D"Courier">void operator [] () =3D delete;</f=
ont> declaration. Knock it out in the following standard revision.</div></d=
iv></body></html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;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 />
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 />
--Apple-Mail=_6EE5315A-F1B4-49AE-A952-09C269078468--
.
Author: Vittorio Romeo <vittorio.romeo@outlook.com>
Date: Fri, 3 Oct 2014 15:16:16 +0200
Raw View
--_4f5e9e41-1186-4d15-b750-e7498cf92390_
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
I guess that what he wants is something like this:
Vittorio Romeohttp://vittorioromeo.info
From: potswa@gmail.com
Subject: Re: [std-proposals] Allow multi-parameter overloads of operator[]
Date: Fri, 3 Oct 2014 20:18:54 +0800
To: std-proposals@isocpp.org
On 2014-10-03, at 6:55 PM, Daniel Kr=FCgler <daniel.kruegler@gmail.com> wro=
te:Could you please elaborate on this? I don't think that the title alone
is self-explanatory. I would like to get a better understanding of
your suggested changes of the Standard.
The problem is the comma operator.
One solution would be to parse it as an operator when all the overloads fou=
nd by name lookup have exactly one parameter, otherwise parse an argument l=
ist.
Deprecate the operator parse, let folks migrate. Proper migration can be ve=
rified by adding a void operator [] () =3D delete; declaration. Knock it ou=
t in the following standard revision.
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
=20
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
--_4f5e9e41-1186-4d15-b750-e7498cf92390_
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<style><!--
..hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class=3D'hmmessage'><div dir=3D'ltr'>I guess that what he wants is so=
mething like this:<br><br>Vittorio Romeo<div><a href=3D"http://vittoriorome=
o.info" target=3D"_blank">http://vittorioromeo.info</a></div><br><br><div><=
hr id=3D"stopSpelling">From: potswa@gmail.com<br>Subject: Re: [std-proposal=
s] Allow multi-parameter overloads of operator[]<br>Date: Fri, 3 Oct 2014 2=
0:18:54 +0800<br>To: std-proposals@isocpp.org<br><br><br><div><div>On 2014&=
ndash;10–03, at 6:55 PM, Daniel Kr=FCgler <<a href=3D"mailto:danie=
l.kruegler@gmail.com">daniel.kruegler@gmail.com</a>> wrote:</div><br cla=
ss=3D"ecxApple-interchange-newline"><blockquote>Could you please elaborate =
on this? I don't think that the title alone<br>is self-explanatory. I would=
like to get a better understanding of<br>your suggested changes of the Sta=
ndard.<br></blockquote><div><br></div><div>The problem is the comma operato=
r.</div><div><br></div><div>One solution would be to parse it as an operato=
r when all the overloads found by name lookup have exactly one parameter, o=
therwise parse an argument list.</div><div><br></div><div>Deprecate the ope=
rator parse, let folks migrate. Proper migration can be verified by adding =
a <font face=3D"Courier">void operator [] () =3D delete;</font> declar=
ation. Knock it out in the following standard revision.</div></div>
<BR>
-- <br>
<br>
--- <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>
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></body>
</html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;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 />
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 />
--_4f5e9e41-1186-4d15-b750-e7498cf92390_--
.
Author: Vittorio Romeo <vittorio.romeo.vee@gmail.com>
Date: Fri, 3 Oct 2014 06:18:27 -0700 (PDT)
Raw View
------=_Part_7_855271690.1412342307848
Content-Type: text/plain; charset=UTF-8
(Sorry for the double post, I misclicked.)
struct MultiDimArray
{
auto& operator[](std::size_t mX, std::size_t mY) // currently not valid
{
// ...
}
};
MultiDimArray mda;
mda[1, 5] = 10;
I agree with this suggestion, it would be a nice addition to the language.
--
---
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_7_855271690.1412342307848
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">(Sorry for the double post, I misclicked.)<br><br><div cla=
ss=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap=
: break-word; background-color: rgb(250, 250, 250);"><code class=3D"prettyp=
rint"><div class=3D"subprettyprint"><font color=3D"#660066"><span style=3D"=
color: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;"=
class=3D"styled-by-prettify">MultiDimArray</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> <br></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;" cl=
ass=3D"styled-by-prettify">auto</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&</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: #000;" class=3D"styled-by-prettify">st=
d</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">size_t mX</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">size_t mY</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"style=
d-by-prettify">// currently not valid</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br> </span><span styl=
e=3D"color: #800;" class=3D"styled-by-prettify">// ...</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></span><span 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: #606;" cl=
ass=3D"styled-by-prettify">MultiDimArray</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> mda</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>mda</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">[</span><span style=3D"color: #066;" class=3D"styled-by-prettif=
y">1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #066;" class=3D"styled-by-prettify">5</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">]</span><span style=3D"color: #00=
0;" 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"sty=
led-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pr=
ettify">10</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n></font></div></code></div><br>I agree with this suggestion, it would be a=
nice addition to the language.</div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;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 />
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_7_855271690.1412342307848--
.
Author: =?UTF-8?B?QWd1c3TDrW4gSy1iYWxsbyBCZXJnw6k=?= <kaballo86@hotmail.com>
Date: Fri, 3 Oct 2014 11:07:12 -0300
Raw View
On 03/10/2014 10:18 a.m., Vittorio Romeo wrote:
> (Sorry for the double post, I misclicked.)
>
> |
> structMultiDimArray
> {
> auto&operator[](std::size_t mX,std::size_t mY)// currently not valid
> {
> // ...
> }
> };
>
> MultiDimArraymda;
> mda[1,5]=3D10;
> |
>
> I agree with this suggestion, it would be a nice addition to the language=
..
This would be inconsistent with the way builtin arrays work. I would=20
expect the syntax to call that overloaded subscript operator to be=20
`mda[1][5]` instead. The other alternative, to change the way array=20
indexing works, would be a breaking change and a needless=20
incompatibility with C, so I think it would have a much lesser change of=20
success.
Until a proposal of the sort makes it into the language, consider the=20
following alternative:
struct mda_index { std::size_t x; std::size_t y; };
struct multi_dim_array {
auto& operator[](mda_index i) const { /*...*/ }
};
multi_dim_array mda;
mda[{1, 5}] =3D 10;
Regards,
--=20
Agust=C3=ADn K-ballo Berg=C3=A9.-
http://talesofcpp.fusionfenix.com
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
.
Author: Felipe Magno de Almeida <felipe.m.almeida@gmail.com>
Date: Fri, 3 Oct 2014 11:23:24 -0300
Raw View
Hello,
On Fri, Oct 3, 2014 at 11:07 AM, Agust=C3=ADn K-ballo Berg=C3=A9
<kaballo86@hotmail.com> wrote:
> On 03/10/2014 10:18 a.m., Vittorio Romeo wrote:
>>
>> (Sorry for the double post, I misclicked.)
>>
>> |
>> structMultiDimArray
>> {
>> auto&operator[](std::size_t mX,std::size_t mY)// currently not valid
>> {
>> // ...
>> }
>> };
>>
>> MultiDimArraymda;
>> mda[1,5]=3D10;
>> |
>>
>> I agree with this suggestion, it would be a nice addition to the languag=
e.
>
>
> This would be inconsistent with the way builtin arrays work.
And what would be the problem with that? People don't use the
subscript operator just for arrays. Whoever wants syntax consistency
with arrays can do that already returning a proxy.
> I would expect the syntax to call that overloaded subscript operator
> to be `mda[1][5]` instead. The other alternative, to change the way
> array indexing works, would be a breaking change and a needless
> incompatibility with C, so I think it would have a much lesser change
> of success.
That would be even worse because we would have two ways to
accomplish the same syntax. And having multiple arguments inside
the subscript operator would be *very* useful for EDSLs.
[snip]
> Regards,
> --
> Agust=C3=ADn K-ballo Berg=C3=A9.-
> http://talesofcpp.fusionfenix.com
Best regards,
--=20
Felipe Magno de Almeida
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
.
Author: =?UTF-8?B?QWd1c3TDrW4gSy1iYWxsbyBCZXJnw6k=?= <kaballo86@hotmail.com>
Date: Fri, 3 Oct 2014 11:43:15 -0300
Raw View
On 03/10/2014 11:23 a.m., Felipe Magno de Almeida wrote:
> Hello,
>
> On Fri, Oct 3, 2014 at 11:07 AM, Agust=C3=ADn K-ballo Berg=C3=A9
> <kaballo86@hotmail.com> wrote:
>> On 03/10/2014 10:18 a.m., Vittorio Romeo wrote:
>>>
>>> (Sorry for the double post, I misclicked.)
>>>
>>> |
>>> structMultiDimArray
>>> {
>>> auto&operator[](std::size_t mX,std::size_t mY)// currently not valid
>>> {
>>> // ...
>>> }
>>> };
>>>
>>> MultiDimArraymda;
>>> mda[1,5]=3D10;
>>> |
>>>
>>> I agree with this suggestion, it would be a nice addition to the langua=
ge.
>>
>>
>> This would be inconsistent with the way builtin arrays work.
>
> And what would be the problem with that? People don't use the
> subscript operator just for arrays. Whoever wants syntax consistency
> with arrays can do that already returning a proxy.
Teachability (new gotchas).
>> I would expect the syntax to call that overloaded subscript operator
>> to be `mda[1][5]` instead. The other alternative, to change the way
>> array indexing works, would be a breaking change and a needless
>> incompatibility with C, so I think it would have a much lesser change
>> of success.
>
> That would be even worse because we would have two ways to
> accomplish the same syntax.
We already have lots of ways of accomplishing the same syntax (and not=20
two are exactly the same). If, on the other hand, you are referring to=20
more than one syntax with the same effect (array[1][5] and array[1,5]),=20
I agree, I am not suggesting that.
> And having multiple arguments inside
> the subscript operator would be *very* useful for EDSLs.
I cannot take this argument seriously. People writing EDSLs better know=20
what they are dealing with, users of the subscript operator need not to.=20
I don't think it would be reasonable to complicate the language for=20
everyone for no apparent benefit other than simplifying an already=20
complex use case (that would remain complex) for a minority.
Regards,
--=20
Agust=C3=ADn K-ballo Berg=C3=A9.-
http://talesofcpp.fusionfenix.com
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
.
Author: Douglas Boffey <douglas.boffey@gmail.com>
Date: Fri, 3 Oct 2014 07:49:02 -0700 (PDT)
Raw View
------=_Part_5499_1474961650.1412347743012
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
This would be a good proposal if it weren=E2=80=99t for the poor comma sema=
ntics=20
inherited from C (and probably from its predecessors=E2=80=94I don=E2=80=99=
t know B or=20
BCPL, so I cannot tell).
Given, as has already been mentioned, that this proposal would be a=20
breaking proposal, I don=E2=80=99t believe that it would have a chance of b=
eing=20
accepted;)
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_5499_1474961650.1412347743012
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">This would be a good proposal if it weren=E2=80=99t for th=
e poor comma semantics inherited from C (and probably from its predecessors=
=E2=80=94I don=E2=80=99t know B or BCPL, so I cannot tell).<br><br>Given, a=
s has already been mentioned, that this proposal would be a breaking propos=
al, I don=E2=80=99t believe that it would have a chance of being accepted;)=
<br></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;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 />
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_5499_1474961650.1412347743012--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Fri, 03 Oct 2014 07:50:01 -0700
Raw View
On Friday 03 October 2014 11:07:12 Agust=EDn K-ballo Berg=E9 wrote:
> Until a proposal of the sort makes it into the language, consider the=20
> following alternative:
>=20
> struct mda_index { std::size_t x; std::size_t y; };
>=20
> struct multi_dim_array {
> auto& operator[](mda_index i) const { /*...*/ }
> };
>=20
> multi_dim_array mda;
> mda[{1, 5}] =3D 10;
Simpler: use operator().
--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
.
Author: Matthew Woehlke <mw_triad@users.sourceforge.net>
Date: Fri, 03 Oct 2014 11:18:01 -0400
Raw View
On 2014-10-03 10:07, Agust=C3=ADn K-ballo Berg=C3=A9 wrote:
> Until a proposal of the sort makes it into the language, consider the
> following alternative:
>=20
> struct mda_index { std::size_t x; std::size_t y; };
Is this even necessary? Or could you just use an initializer_list? Or
maybe std::array?
> struct multi_dim_array {
> auto& operator[](mda_index i) const { /*...*/ }
> };
>=20
> multi_dim_array mda;
> mda[{1, 5}] =3D 10;
--=20
Matthew
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
.
Author: =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim@gmail.com>
Date: Fri, 3 Oct 2014 20:07:12 +0200
Raw View
--089e0153688a2ee5a40504889a36
Content-Type: text/plain; charset=UTF-8
I think this idea needs a demonstrative (aka real-world) use-case.
Otherwise, using the call operator seems enough to me.
--
---
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/.
--089e0153688a2ee5a40504889a36
Content-Type: text/html; charset=UTF-8
<div dir="ltr"><div class="gmail_extra">I think this idea needs a demonstrative (aka real-world) use-case.</div><div class="gmail_extra">Otherwise, using the call operator seems enough to me.</div></div>
<p></p>
-- <br />
<br />
--- <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 email to <a href="mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href="mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />
--089e0153688a2ee5a40504889a36--
.
Author: David Krauss <potswa@gmail.com>
Date: Sat, 4 Oct 2014 05:17:52 +0800
Raw View
--Apple-Mail=_A4EFBA02-7880-49E2-9470-D8B681F5884E
Content-Type: text/plain; charset=ISO-8859-1
On 2014-10-03, at 10:49 PM, Douglas Boffey <douglas.boffey@gmail.com> wrote:
> Given, as has already been mentioned, that this proposal would be a breaking proposal, I don't believe that it would have a chance of being accepted;)
I described a non-breaking strategy in the third post.
By the way, this is EWG 88.
--
---
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/.
--Apple-Mail=_A4EFBA02-7880-49E2-9470-D8B681F5884E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;10–03, at 10:49 PM, Douglas Boffey <<a href=3D"mailto:dougla=
s.boffey@gmail.com">douglas.boffey@gmail.com</a>> wrote:</div><br class=
=3D"Apple-interchange-newline"><blockquote type=3D"cite"><span style=3D"fon=
t-family: Helvetica; font-size: 12px; font-style: normal; font-variant: nor=
mal; font-weight: normal; letter-spacing: normal; line-height: normal; orph=
ans: auto; text-align: start; text-indent: 0px; text-transform: none; white=
-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width:=
0px; float: none; display: inline !important;">Given, as has already been =
mentioned, that this proposal would be a breaking proposal, I don’t b=
elieve that it would have a chance of being accepted;)</span></blockquote><=
/div><br><div>I described a non-breaking strategy in the third post.</div><=
div><br></div><div>By the way, this is <a href=3D"http://wg21.cmeerw.n=
et/ewg/issue88">EWG 88</a>.</div><div><br></div></body></html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;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 />
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 />
--Apple-Mail=_A4EFBA02-7880-49E2-9470-D8B681F5884E--
.
Author: Myriachan <myriachan@gmail.com>
Date: Fri, 3 Oct 2014 21:18:29 -0700 (PDT)
Raw View
------=_Part_5105_1045128044.1412396309701
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Friday, October 3, 2014 2:18:04 PM UTC-7, David Krauss wrote:
>
> On 2014=E2=80=9310=E2=80=9303, at 10:49 PM, Douglas Boffey <douglas...@gm=
ail.com=20
> <javascript:>> wrote:
>
> Given, as has already been mentioned, that this proposal would be a=20
> breaking proposal, I don=E2=80=99t believe that it would have a chance of=
being=20
> accepted;)
>
> I described a non-breaking strategy in the third post.
>
> By the way, this is EWG 88 <http://wg21.cmeerw.net/ewg/issue88>.
>
>
Is there a reason why keeping existing multidimensional element access=20
syntax would be a problem?
template <typename T, std::size_t X, std::size_t Y>
class MyArray
{
public:
inline T &operator [](std::size_t x, std::size_t y)
{
return m_array[(x * Y) + y];
}
private:
T m_array[X * Y];
};
int main()
{
MyArray<int, 4, 9> array;
array[2][6] =3D 5;
return 0;
}
This could even be extended to variable arguments. I mean, you could even=
=20
*define* the syntax as being a std::tuple move chain.
But you could also just implement this as objects that return from operator=
=20
[].
Melissa
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_5105_1045128044.1412396309701
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Friday, October 3, 2014 2:18:04 PM UTC-7, David Krauss =
wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div style=3D"word-wrap:=
break-word"><div><div>On 2014=E2=80=9310=E2=80=9303, at 10:49 PM, Douglas B=
offey <<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=
=3D"pmlKffIQrq4J" onmousedown=3D"this.href=3D'javascript:';return true;" on=
click=3D"this.href=3D'javascript:';return true;">douglas...@gmail.com</a>&g=
t; wrote:</div><blockquote type=3D"cite"><span style=3D"font-family:Helveti=
ca;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;=
letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;t=
ext-transform:none;white-space:normal;word-spacing:0px;float:none;display:i=
nline!important">Given, as has already been mentioned, that this proposal w=
ould be a breaking proposal, I don=E2=80=99t believe that it would have a c=
hance of being accepted;)</span></blockquote></div><div>I described a non-b=
reaking strategy in the third post.</div><div><br></div><div>By the way, th=
is is <a href=3D"http://wg21.cmeerw.net/ewg/issue88" target=3D"_blank"=
onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fwg2=
1.cmeerw.net%2Fewg%2Fissue88\46sa\75D\46sntz\0751\46usg\75AFQjCNFY85khJVQoj=
bpzbG6TAT9GtzPkiQ';return true;" onclick=3D"this.href=3D'http://www.google.=
com/url?q\75http%3A%2F%2Fwg21.cmeerw.net%2Fewg%2Fissue88\46sa\75D\46sntz\07=
51\46usg\75AFQjCNFY85khJVQojbpzbG6TAT9GtzPkiQ';return true;">EWG 88</a>.</d=
iv><div><br></div></div></blockquote><div><br>Is there a reason why keeping=
existing multidimensional element access syntax would be a problem?<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; w=
ord-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyp=
rint"><span style=3D"color: #008;" class=3D"styled-by-prettify">template</s=
pan><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: #008;" class=3D"styled-by-prettify">typename</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,</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"styl=
ed-by-prettify">size_t X</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">size_t Y<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">></span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">MyArray</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></span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">public</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br> </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">inline</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> T </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&a=
mp;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">operato=
r</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">[](</span><span st=
yle=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">size_t x</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">size_t y</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">return</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> m_array</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">[(</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">x </span><span style=3D"color: #660;" class=3D"styled-by-prettify">*<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> Y</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=
: #660;" class=3D"styled-by-prettify">+</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> y</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">];</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-b=
y-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">private</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&n=
bsp; T m_array</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">[</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">X </span><span style=3D"color: #660;" class=3D"styled-by-prettify">*</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> Y</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">];</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><br></span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> main</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">()</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nb=
sp; </span><span style=3D"color: #606;" class=3D"styled-by-prettify"=
>MyArray</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #066;" class=3D"styled-by-prettify">4</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">9</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">></span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
array</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &n=
bsp; array</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
[</span><span style=3D"color: #066;" class=3D"styled-by-prettify">2</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">][</span><span sty=
le=3D"color: #066;" class=3D"styled-by-prettify">6</span><span style=3D"col=
or: #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"sty=
led-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pr=
ettify">5</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">re=
turn</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"c=
olor: #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></div></code></div><br>This could eve=
n be extended to variable arguments. I mean, you could even <i>define=
</i> the syntax as being a <span style=3D"font-family: courier new,monospac=
e;">std::tuple</span> move chain.<br><br>But you could also just implement =
this as objects that return from <span style=3D"font-family: courier new,mo=
nospace;">operator []</span>.<br><br>Melissa<br></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;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 />
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_5105_1045128044.1412396309701--
.
Author: David Krauss <potswa@gmail.com>
Date: Sat, 4 Oct 2014 13:28:03 +0800
Raw View
--Apple-Mail=_CD830600-8190-4D3B-B184-5F4D009FE56A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1
On 2014-10-04, at 12:18 PM, Myriachan <myriachan@gmail.com> wrote:
> On Friday, October 3, 2014 2:18:04 PM UTC-7, David Krauss wrote:
> On 2014-10-03, at 10:49 PM, Douglas Boffey <douglas...@gmail.com> wrote:
>> Given, as has already been mentioned, that this proposal would be a brea=
king proposal, I don't believe that it would have a chance of being accepte=
d;)
>=20
> I described a non-breaking strategy in the third post.
>=20
> By the way, this is EWG 88.
>=20
>=20
> Is there a reason why keeping existing multidimensional element access sy=
ntax would be a problem?
I guess that could work, using a process akin to the drill-down behavior of=
operator->. If the next [expr] wouldn't work as a separate operator, expr =
gets added to the overload arguments. However, it would be very tricky, bec=
ause a pointer is allowed to appear inside the brackets when the LHS (outsi=
de the brackets) is convertible to integer type.
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
--Apple-Mail=_CD830600-8190-4D3B-B184-5F4D009FE56A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;10–04, at 12:18 PM, Myriachan <<a href=3D"mailto:myriachan@g=
mail.com">myriachan@gmail.com</a>> wrote:</div><br class=3D"Apple-interc=
hange-newline"><blockquote type=3D"cite"><div dir=3D"ltr">On Friday, Octobe=
r 3, 2014 2:18:04 PM UTC-7, David Krauss wrote:<blockquote class=3D"gmail_q=
uote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;pad=
ding-left: 1ex;"><div style=3D"word-wrap:break-word"><div><div>On 2014&ndas=
h;10–03, at 10:49 PM, Douglas Boffey <<a href=3D"javascript:" targ=
et=3D"_blank" gdf-obfuscated-mailto=3D"pmlKffIQrq4J" onmousedown=3D"this.hr=
ef=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';retur=
n true;">douglas...@gmail.com</a>> wrote:</div><blockquote type=3D"cite"=
><span style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font=
-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal=
;text-align:start;text-indent:0px;text-transform:none;white-space:normal;wo=
rd-spacing:0px;float:none;display:inline!important">Given, as has already b=
een mentioned, that this proposal would be a breaking proposal, I don&rsquo=
;t believe that it would have a chance of being accepted;)</span></blockquo=
te></div><div>I described a non-breaking strategy in the third post.</div><=
div><br></div><div>By the way, this is <a href=3D"http://wg21.cmeerw.n=
et/ewg/issue88" target=3D"_blank" onmousedown=3D"this.href=3D'http://www.go=
ogle.com/url?q\75http%3A%2F%2Fwg21.cmeerw.net%2Fewg%2Fissue88\46sa\75D\46sn=
tz\0751\46usg\75AFQjCNFY85khJVQojbpzbG6TAT9GtzPkiQ';return true;" onclick=
=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fwg21.cmeerw.net=
%2Fewg%2Fissue88\46sa\75D\46sntz\0751\46usg\75AFQjCNFY85khJVQojbpzbG6TAT9Gt=
zPkiQ';return true;">EWG 88</a>.</div><div><br></div></div></blockquote><di=
v><br>Is there a reason why keeping existing multidimensional element acces=
s syntax would be a problem?<br></div></div></blockquote></div><br><div>I g=
uess that could work, using a process akin to the drill-down behavior of <f=
ont face=3D"Courier">operator-></font>. If the next <font face=3D"Courie=
r">[expr]</font> wouldn’t work as a separate operator, <font face=3D"=
Courier">expr</font> gets added to the overload arguments. However, it woul=
d be very tricky, because a pointer is allowed to appear inside the bracket=
s when the LHS (outside the brackets) is convertible to integer type.</div>=
<div><br></div></body></html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;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 />
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 />
--Apple-Mail=_CD830600-8190-4D3B-B184-5F4D009FE56A--
.
Author: daryl.vandenbrink@maptek.com.au
Date: Fri, 3 Oct 2014 23:39:42 -0700 (PDT)
Raw View
------=_Part_4671_1713630512.1412404782281
Content-Type: text/plain; charset=UTF-8
Yes, that's exactly what I want.
On Friday, 3 October 2014 22:48:27 UTC+9:30, Vittorio Romeo wrote:
>
> (Sorry for the double post, I misclicked.)
>
> struct MultiDimArray
> {
> auto& operator[](std::size_t mX, std::size_t mY) // currently not
> valid
> {
> // ...
> }
> };
>
> MultiDimArray mda;
> mda[1, 5] = 10;
>
> I agree with this suggestion, it would be a nice addition to the language.
>
--
---
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_4671_1713630512.1412404782281
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Yes, that's exactly what I want.<br><br>On Friday, 3 Octob=
er 2014 22:48:27 UTC+9:30, Vittorio Romeo wrote:<blockquote class=3D"gmail=
_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;p=
adding-left: 1ex;"><div dir=3D"ltr">(Sorry for the double post, I misclicke=
d.)<br><br><div style=3D"border:1px solid rgb(187,187,187);word-wrap:break-=
word;background-color:rgb(250,250,250)"><code><div><font color=3D"#660066">=
<span style=3D"color:#008">struct</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#606">MultiDimArray</span><span style=3D"color:#000"> =
<br></span><span style=3D"color:#660">{</span><span style=3D"color:#000"><b=
r> </span><span style=3D"color:#008">auto</span><span style=3D=
"color:#660">&</span><span style=3D"color:#000"> </span><span style=3D"=
color:#008">operator</span><span style=3D"color:#660">[](</span><span style=
=3D"color:#000">std</span><span style=3D"color:#660">::</span><span style=
=3D"color:#000">size_t mX</span><span style=3D"color:#660">,</span><span st=
yle=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span sty=
le=3D"color:#000">size_t mY</span><span style=3D"color:#660">)</span><span =
style=3D"color:#000"> </span><span style=3D"color:#800">// currently not va=
lid</span><span style=3D"color:#000"><br> </span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"><br> =
</span><span style=3D"color:#800">// ...</span><span style=3D"color=
:#000"><br> </span><span style=3D"color:#660">}</span><span st=
yle=3D"color:#000"><br></span><span style=3D"color:#660">};</span><span sty=
le=3D"color:#000"><br><br></span><span style=3D"color:#606">MultiDimArray</=
span><span style=3D"color:#000"> mda</span><span style=3D"color:#660">;</sp=
an><span style=3D"color:#000"><br>mda</span><span style=3D"color:#660">[</s=
pan><span style=3D"color:#066">1</span><span style=3D"color:#660">,</span><=
span style=3D"color:#000"> </span><span style=3D"color:#066">5</span><span =
style=3D"color:#660">]</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span style=3D=
"color:#066">10</span><span style=3D"color:#660">;</span><span style=3D"col=
or:#000"><br></span></font></div></code></div><br>I agree with this suggest=
ion, it would be a nice addition to the language.</div></blockquote></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;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 />
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_4671_1713630512.1412404782281--
.
Author: Bengt Gustafsson <bengt.gustafsson@beamways.com>
Date: Sat, 4 Oct 2014 01:39:49 -0700 (PDT)
Raw View
------=_Part_62_1887128239.1412411989064
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
There is no particular problem with using () instead of [] for=20
multi-dimensional access except that the convention in C++ seems to be that=
=20
() indicates function invokation whereas [] indicates array access. This=20
comes from C but has been augmented in C++ with operator() and operator[]=
=20
overloading respectively. Forcing the use of () for array access because of=
=20
a wart inherited from C does not seem like a good decision to me.
I agree with David that there is no code breaking issue using his proposed=
=20
parsing rule.
However when reading EWG88 it does not discuss this parsing rule but=20
instead they discuss whether there is enough code that actually uses a=20
comma inside a [] to prevent allowing multiple arguments. Given the risk=20
aversive history of the committe it is likely that the suggestion will be=
=20
turned down on these grounds. Adding Davids parsing rule
to the proposal could thereby be worthwhile, as it would significantly=20
increase the chances of getting the proposal adopted, I think.
Looking at plain "C" arrays I can not see anything that prevents the same=
=20
rule to be used to allow multi-dimensional arrays using comma separated=20
dimension expressions in the declaration and comma separated expressions at=
=20
usage. There are however a few issues:
- How about the unknown size case? Should this be allowed, and if so with=
=20
what syntax?
- Should it be possible to get a row/column out of the array using an=20
under-defined operator? Or is this reserved for the current N-d arrays with=
=20
separate [] for each dimension?
- Would it be a good idea to introduce a way to indicate which way the=20
storage is indexed (row/column major). I have no idea on syntax for this=20
but I know there have been numerous requests.
(Note that these points are for C arrays only, they will all be quite easy=
=20
to accomplish for classes with [] overloads).
Den l=C3=B6rdagen den 4:e oktober 2014 kl. 07:28:30 UTC+2 skrev David Kraus=
s:
>
>
> On 2014=E2=80=9310=E2=80=9304, at 12:18 PM, Myriachan <myri...@gmail.com =
<javascript:>>=20
> wrote:
>
> On Friday, October 3, 2014 2:18:04 PM UTC-7, David Krauss wrote:
>>
>> On 2014=E2=80=9310=E2=80=9303, at 10:49 PM, Douglas Boffey <douglas...@g=
mail.com> wrote:
>>
>> Given, as has already been mentioned, that this proposal would be a=20
>> breaking proposal, I don=E2=80=99t believe that it would have a chance o=
f being=20
>> accepted;)
>>
>> I described a non-breaking strategy in the third post.
>>
>> By the way, this is EWG 88 <http://wg21.cmeerw.net/ewg/issue88>.
>>
>>
> Is there a reason why keeping existing multidimensional element access=20
> syntax would be a problem?
>
>
> I guess that could work, using a process akin to the drill-down behavior=
=20
> of operator->. If the next [expr] wouldn=E2=80=99t work as a separate ope=
rator,=20
> expr gets added to the overload arguments. However, it would be very=20
> tricky, because a pointer is allowed to appear inside the brackets when t=
he=20
> LHS (outside the brackets) is convertible to integer type.
>
>
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_62_1887128239.1412411989064
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">There is no particular problem with using () instead of []=
for multi-dimensional access except that the convention in C++ seems to be=
that () indicates function invokation whereas [] indicates array access. T=
his comes from C but has been augmented in C++ with operator() and operator=
[] overloading respectively. Forcing the use of () for array access because=
of a wart inherited from C does not seem like a good decision to me.<div><=
br></div><div>I agree with David that there is no code breaking issue using=
his proposed parsing rule.</div><div><br></div><div>However when reading E=
WG88 it does not discuss this parsing rule but instead they discuss whether=
there is enough code that actually uses a comma inside a [] to prevent all=
owing multiple arguments. Given the risk aversive history of the committe i=
t is likely that the suggestion will be turned down on these grounds. Addin=
g Davids parsing rule</div><div>to the proposal could thereby be worthwhile=
, as it would significantly increase the chances of getting the proposal ad=
opted, I think.</div><div><br></div><div>Looking at plain "C" arrays I can =
not see anything that prevents the same rule to be used to allow multi-dime=
nsional arrays using comma separated dimension expressions in the declarati=
on and comma separated expressions at usage. There are however a few issues=
:</div><div><br></div><div>- How about the unknown size case? Should this b=
e allowed, and if so with what syntax?</div><div><br></div><div>- Should it=
be possible to get a row/column out of the array using an under-defined op=
erator? Or is this reserved for the current N-d arrays with separate [] for=
each dimension?</div><div><br></div><div>- Would it be a good idea to intr=
oduce a way to indicate which way the storage is indexed (row/column major)=
.. I have no idea on syntax for this but I know there have been numerous req=
uests.</div><div><br></div><div>(Note that these points are for C arrays on=
ly, they will all be quite easy to accomplish for classes with [] overloads=
).<br><br>Den l=C3=B6rdagen den 4:e oktober 2014 kl. 07:28:30 UTC+2 skrev D=
avid Krauss:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div style=3D"word=
-wrap:break-word"><br><div><div>On 2014=E2=80=9310=E2=80=9304, at 12:18 PM,=
Myriachan <<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mai=
lto=3D"E-xd5uJ4bhYJ" onmousedown=3D"this.href=3D'javascript:';return true;"=
onclick=3D"this.href=3D'javascript:';return true;">myri...@gmail.com</a>&g=
t; wrote:</div><br><blockquote type=3D"cite"><div dir=3D"ltr">On Friday, Oc=
tober 3, 2014 2:18:04 PM UTC-7, David Krauss wrote:<blockquote class=3D"gma=
il_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;pa=
dding-left:1ex"><div style=3D"word-wrap:break-word"><div><div>On 2014=E2=80=
=9310=E2=80=9303, at 10:49 PM, Douglas Boffey <<a>douglas...@gmail.com</=
a>> wrote:</div><blockquote type=3D"cite"><span style=3D"font-family:Hel=
vetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:nor=
mal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0=
px;text-transform:none;white-space:normal;word-spacing:0px;float:none;displ=
ay:inline!important">Given, as has already been mentioned, that this propos=
al would be a breaking proposal, I don=E2=80=99t believe that it would have=
a chance of being accepted;)</span></blockquote></div><div>I described a n=
on-breaking strategy in the third post.</div><div><br></div><div>By the way=
, this is <a href=3D"http://wg21.cmeerw.net/ewg/issue88" target=3D"_bl=
ank" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2=
Fwg21.cmeerw.net%2Fewg%2Fissue88\46sa\75D\46sntz\0751\46usg\75AFQjCNFY85khJ=
VQojbpzbG6TAT9GtzPkiQ';return true;" onclick=3D"this.href=3D'http://www.goo=
gle.com/url?q\75http%3A%2F%2Fwg21.cmeerw.net%2Fewg%2Fissue88\46sa\75D\46snt=
z\0751\46usg\75AFQjCNFY85khJVQojbpzbG6TAT9GtzPkiQ';return true;">EWG 88</a>=
..</div><div><br></div></div></blockquote><div><br>Is there a reason why kee=
ping existing multidimensional element access syntax would be a problem?<br=
></div></div></blockquote></div><br><div>I guess that could work, using a p=
rocess akin to the drill-down behavior of <font face=3D"Courier">operator-&=
gt;</font>. If the next <font face=3D"Courier">[expr]</font> wouldn=E2=80=
=99t work as a separate operator, <font face=3D"Courier">expr</font> gets a=
dded to the overload arguments. However, it would be very tricky, because a=
pointer is allowed to appear inside the brackets when the LHS (outside the=
brackets) is convertible to integer type.</div><div><br></div></div></bloc=
kquote></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;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 />
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_62_1887128239.1412411989064--
.