Topic: array with a lower bound different from 0?
Author: Francis ANDRE <francis.andre.kampbell@orange.fr>
Date: Wed, 08 Jul 2015 17:44:17 +0200
Raw View
Hi
I am wondering if there is a place where the array type with a lower
bound different from 0 -- as for example: int foo[4..12]; -- has been
discussed. Thanks for pointing me any references.
FA
--
---
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: Nevin Liber <nevin@eviloverlord.com>
Date: Wed, 8 Jul 2015 11:10:06 -0500
Raw View
--001a11c3bad8a360bf051a5f61df
Content-Type: text/plain; charset=UTF-8
On 8 July 2015 at 10:44, Francis ANDRE <francis.andre.kampbell@orange.fr>
wrote:
> Hi
>
> I am wondering if there is a place where the array type with a lower bound
> different from 0 -- as for example: int foo[4..12]; -- has been discussed.
> Thanks for pointing me any references.
Any particular reason you cannot write a class to do this?
--
Nevin ":-)" Liber <mailto:nevin@eviloverlord.com> (847) 691-1404
--
---
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/.
--001a11c3bad8a360bf051a5f61df
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On 8=
July 2015 at 10:44, Francis ANDRE <span dir=3D"ltr"><<a href=3D"mailto:=
francis.andre.kampbell@orange.fr" target=3D"_blank">francis.andre.kampbell@=
orange.fr</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
I am wondering if there is a place where the array type with a lower bound =
different from 0 -- as for example:=C2=A0 int foo[4..12]; -- has been discu=
ssed. Thanks for pointing=C2=A0 me any references.</blockquote><div><br></d=
iv><div>Any particular reason you cannot write a class to do this?</div></d=
iv>-- <br><div class=3D"gmail_signature">=C2=A0Nevin ":-)" Liber=
=C2=A0 <mailto:<a href=3D"mailto:nevin@eviloverlord.com" target=3D"_blan=
k">nevin@eviloverlord.com</a>>=C2=A0 (847) 691-1404</div>
</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 />
--001a11c3bad8a360bf051a5f61df--
.
Author: Francis ANDRE <francis.andre.kampbell@orange.fr>
Date: Thu, 09 Jul 2015 00:09:07 +0200
Raw View
This is a multi-part message in MIME format.
--------------060107050702090900070204
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 08/07/2015 18:10, Nevin Liber a =C3=A9crit :
> On 8 July 2015 at 10:44, Francis ANDRE=20
> <francis.andre.kampbell@orange.fr=20
> <mailto:francis.andre.kampbell@orange.fr>> wrote:
>
> Hi
>
> I am wondering if there is a place where the array type with a
> lower bound different from 0 -- as for example: int foo[4..12]; --
> has been discussed. Thanks for pointing me any references.
>
>
> Any particular reason you cannot write a class to do this?
First, most of 3rd level languages like Algol, PL/1, Pascal and Ada=20
are providing multidimensional arrays. The definition of an array in=20
C++ is a reminiscence of the array in C where it is just a=20
implementation view of a sequence of object allocated at offset 0 in=20
memory. I would consider such feature as a clean abstraction of the=20
array concept.
Second, because the syntax of template multi dimentional array=20
definition and reference is ugly and as you know, syntax matters. That's=20
why C++ is successful in providing the proper syntax sugar to a clean=20
abstraction with the overloading operator feature for example.
Compare
Array<Array<Array<int, 1, 4>, 5, 10>, 11, 22> space; space[11][5][1] =3D 64=
;
with
int space[ 11..22, 5..10, 1..4]; space[11, 5, 1] =3D 64;
And third and most important, because the order of dimensions are=20
reversed in this specific template case which is error prone and counter=20
intuitive. (the template show above is similar to the STL std::array=20
template class, but with a lower and upper bounds)
> --=20
> Nevin ":-)" Liber <mailto:nevin@eviloverlord.com=20
> <mailto:nevin@eviloverlord.com>> (847) 691-1404
> --=20
>
> ---
> You received this message because you are subscribed to the Google=20
> Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send=20
> an email to std-proposals+unsubscribe@isocpp.org=20
> <mailto:std-proposals+unsubscribe@isocpp.org>.
> To post to this group, send email to std-proposals@isocpp.org=20
> <mailto:std-proposals@isocpp.org>.
> Visit this group at=20
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
--=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/.
--------------060107050702090900070204
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<br>
<br>
<div class=3D"moz-cite-prefix">Le 08/07/2015 18:10, Nevin Liber a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:CAGg_6+MJpPcfttK8BQXiVYsMcdhpbScxtpsNVxVmWdoyAsRNdw@mail.gmail.=
com"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra">
<div class=3D"gmail_quote">On 8 July 2015 at 10:44, Francis
ANDRE <span dir=3D"ltr"><<a moz-do-not-send=3D"true"
href=3D"mailto:francis.andre.kampbell@orange.fr"
target=3D"_blank">francis.andre.kampbell@orange.fr</a>><=
/span>
wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
I am wondering if there is a place where the array type
with a lower bound different from 0 -- as for example:=C2=A0
int foo[4..12]; -- has been discussed. Thanks for
pointing=C2=A0 me any references.</blockquote>
<div><br>
</div>
<div>Any particular reason you cannot write a class to do
this?</div>
</div>
</div>
</div>
</blockquote>
=C2=A0First, most of 3rd level languages like Algol, PL/1, Pascal and A=
da
are providing=C2=A0 multidimensional arrays. The definition of an array
in C++ is a reminiscence of the array in C where it is just a
implementation view of a sequence of object allocated at offset 0 in
memory. I would consider such feature as a clean abstraction of the
array concept.<br>
<br>
<br>
Second, because the syntax of template multi dimentional array
definition and reference is ugly and as you know, syntax matters.
That's why C++ is successful in providing the proper syntax sugar to
a clean abstraction with the overloading operator feature for
example.<br>
<br>
Compare<br>
Array<Array<Array<int, 1, 4>, 5, 10>, 11, 22>=C2=A0=
=C2=A0=C2=A0
space; space[11][5][1] =3D 64;<br>
<br>
with <br>
int space[ 11..22, 5..10, 1..4]; space[11, 5, 1] =3D 64;<br>
<br>
And third and most important, because the order of dimensions are
reversed in this specific template case which is error prone and
counter intuitive. (the template show above is similar to the STL
std::array template class, but with a lower and upper bounds) <br>
<br>
<blockquote
cite=3D"mid:CAGg_6+MJpPcfttK8BQXiVYsMcdhpbScxtpsNVxVmWdoyAsRNdw@mail.gmail.=
com"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra">-- <br>
<div class=3D"gmail_signature">=C2=A0Nevin ":-)" Liber=C2=A0 <=
mailto:<a
moz-do-not-send=3D"true"
href=3D"mailto:nevin@eviloverlord.com" target=3D"_blank">nevi=
n@eviloverlord.com</a>>=C2=A0
(847) 691-1404</div>
</div>
</div>
-- <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 moz-do-not-send=3D"true"
href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+=
unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a moz-do-not-send=3D"true"
href=3D"mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</=
a>.<br>
Visit this group at <a moz-do-not-send=3D"true"
href=3D"http://groups.google.com/a/isocpp.org/group/std-proposals/"=
>http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br>
</blockquote>
<br>
</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 />
--------------060107050702090900070204--
.
Author: David Krauss <potswa@gmail.com>
Date: Thu, 9 Jul 2015 10:45:08 +0800
Raw View
--Apple-Mail=_840AECBB-CA70-4530-AF46-0D6E785C333A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
> On 2015=E2=80=9307=E2=80=9309, at 6:09 AM, Francis ANDRE <francis.andre.k=
ampbell@orange.fr> wrote:
>=20
> Second, because the syntax of template multi dimentional array definition=
and reference is ugly and as you know, syntax matters. That's why C++ is s=
uccessful in providing the proper syntax sugar to a clean abstraction with =
the overloading operator feature for example.
>=20
> Compare
> Array<Array<Array<int, 1, 4>, 5, 10>, 11, 22> space; space[11][5][1] =
=3D 64;
>=20
> with=20
> int space[ 11..22, 5..10, 1..4]; space[11, 5, 1] =3D 64;
C++03 is that limited, but template parameter packs and brace initializatio=
n allow you to do
Array< int, 11, 22 5, 10, 1, 4, > space;
space[{ 11, 5, 1 }] =3D 64;
It would be nicer to have Array< int, { 11, 22 }, { 5, 10 }, { 1, 4 } > spa=
ce, but we=E2=80=99ll have to wait a little longer for non-scalar template =
non-type parameters. Actually, you could already do Array< int, Range< 11, =
22 >, Range< 5, 10 >, Range< 1, 4 > > space.
However, array_view (N4512 <http://open-std.org/jtc1/sc22/wg21/docs/papers/=
2015/n4512.html>) might just take already care of all of this.
By the way, C arrays don=E2=80=99t have many proponents in the C++ communit=
y, because they inconsistently apply value and reference semantics. Proposa=
ls to extend C arrays in general face an uphill battle.
--=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=_840AECBB-CA70-4530-AF46-0D6E785C333A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9307=
=E2=80=9309, at 6:09 AM, Francis ANDRE <<a href=3D"mailto:francis.andre.=
kampbell@orange.fr" class=3D"">francis.andre.kampbell@orange.fr</a>> wro=
te:</div><br class=3D"Apple-interchange-newline"><div class=3D""><span styl=
e=3D"font-family: Helvetica; font-size: 12px; font-style: normal; font-vari=
ant: normal; font-weight: normal; letter-spacing: normal; line-height: norm=
al; orphans: auto; text-align: start; text-indent: 0px; text-transform: non=
e; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-strok=
e-width: 0px; background-color: rgb(255, 255, 255); float: none; display: i=
nline !important;" class=3D"">Second, because the syntax of template multi =
dimentional array definition and reference is ugly and as you know, syntax =
matters. That's why C++ is successful in providing the proper syntax sugar =
to a clean abstraction with the overloading operator feature for example.</=
span><br style=3D"font-family: Helvetica; font-size: 12px; font-style: norm=
al; font-variant: normal; font-weight: normal; letter-spacing: normal; line=
-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-t=
ransform: none; white-space: normal; widows: auto; word-spacing: 0px; -webk=
it-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class=3D"=
"><br style=3D"font-family: Helvetica; font-size: 12px; font-style: normal;=
font-variant: normal; font-weight: normal; letter-spacing: normal; line-he=
ight: normal; orphans: auto; text-align: start; text-indent: 0px; text-tran=
sform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-=
text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class=3D""><=
span style=3D"font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; line-hei=
ght: normal; orphans: auto; text-align: start; text-indent: 0px; text-trans=
form: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-t=
ext-stroke-width: 0px; background-color: rgb(255, 255, 255); float: none; d=
isplay: inline !important;" class=3D"">Compare</span><br style=3D"font-fami=
ly: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; f=
ont-weight: normal; letter-spacing: normal; line-height: normal; orphans: a=
uto; text-align: start; text-indent: 0px; text-transform: none; white-space=
: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
background-color: rgb(255, 255, 255);" class=3D""><span style=3D"font-famil=
y: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; fo=
nt-weight: normal; letter-spacing: normal; line-height: normal; orphans: au=
to; text-align: start; text-indent: 0px; text-transform: none; white-space:=
normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; b=
ackground-color: rgb(255, 255, 255); float: none; display: inline !importan=
t;" class=3D"">Array<Array<Array<int, 1, 4>, 5, 10>, 11, 22&=
gt; space; space[11][5][1] =3D 64;</span><br 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; background-color: rgb(255, 255, 255);" class=3D""><br style=3D"font-f=
amily: Helvetica; font-size: 12px; font-style: normal; font-variant: normal=
; font-weight: normal; letter-spacing: normal; line-height: normal; orphans=
: auto; text-align: start; text-indent: 0px; text-transform: none; white-sp=
ace: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0p=
x; background-color: rgb(255, 255, 255);" class=3D""><span style=3D"font-fa=
mily: Helvetica; font-size: 12px; font-style: normal; font-variant: normal;=
font-weight: normal; letter-spacing: normal; line-height: normal; orphans:=
auto; text-align: start; text-indent: 0px; text-transform: none; white-spa=
ce: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px=
; background-color: rgb(255, 255, 255); float: none; display: inline !impor=
tant;" class=3D"">with<span class=3D"Apple-converted-space"> </span></=
span><br style=3D"font-family: Helvetica; font-size: 12px; font-style: norm=
al; font-variant: normal; font-weight: normal; letter-spacing: normal; line=
-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-t=
ransform: none; white-space: normal; widows: auto; word-spacing: 0px; -webk=
it-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class=3D"=
"><span style=3D"font-family: Helvetica; font-size: 12px; font-style: norma=
l; font-variant: normal; font-weight: normal; letter-spacing: normal; line-=
height: normal; orphans: auto; text-align: start; text-indent: 0px; text-tr=
ansform: none; white-space: normal; widows: auto; word-spacing: 0px; -webki=
t-text-stroke-width: 0px; background-color: rgb(255, 255, 255); float: none=
; display: inline !important;" class=3D"">int space[ 11..22, 5..10, 1..4]; =
space[11, 5, 1] =3D 64;</span><br style=3D"font-family: Helvetica; font-siz=
e: 12px; font-style: normal; font-variant: normal; font-weight: normal; let=
ter-spacing: normal; line-height: normal; orphans: auto; text-align: start;=
text-indent: 0px; text-transform: none; white-space: normal; widows: auto;=
word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(2=
55, 255, 255);" class=3D""></div></blockquote></div><br class=3D""><div cla=
ss=3D"">C++03 is that limited, but template parameter packs and brace initi=
alization allow you to do</div><div class=3D""><br class=3D""></div><div cl=
ass=3D""><font face=3D"Courier" class=3D"">Array< int,</font><span style=
=3D"font-family: Courier;" class=3D""> </span><span style=3D"font-fami=
ly: Courier;" class=3D"">11, 22</span><span style=3D"font-family: Courier;"=
class=3D""> </span><span style=3D"font-family: Courier;" class=3D"">5=
, 10,</span><span style=3D"font-family: Courier;" class=3D""> </span><=
span style=3D"font-family: Courier;" class=3D"">1, 4, > space;</span></d=
iv><div class=3D""><font face=3D"Courier" class=3D"">space[{ 11, 5, 1 }] =
=3D 64;</font></div><div class=3D""><br class=3D""></div><div class=3D"">It=
would be nicer to have <span style=3D"font-family: Courier;" class=3D=
"">Array< int</span><span style=3D"font-family: Courier;" class=3D"">, {=
11, 22 }</span><span style=3D"font-family: Courier;" class=3D"">, { 5, 10 =
}</span><span style=3D"font-family: Courier;" class=3D"">, { 1, 4 } > sp=
ace</span>, but we=E2=80=99ll have to wait a little longer for non-scalar t=
emplate non-type parameters. Actually, you could already do <span styl=
e=3D"font-family: Courier;" class=3D"">Array< int</span><span style=3D"f=
ont-family: Courier;" class=3D"">, Range< 11, 22 ></span><span style=
=3D"font-family: Courier;" class=3D"">, Range< 5, 10 ></span><span st=
yle=3D"font-family: Courier;" class=3D"">, Range< 1, 4 > > space</=
span>.</div><div class=3D""><br class=3D""></div><div class=3D"">However,&n=
bsp;<font face=3D"Courier" class=3D"">array_view</font> (<a href=3D"http://=
open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4512.html" class=3D"">N4512</=
a>) might just take already care of all of this.</div><div class=3D""><br c=
lass=3D""></div><div class=3D"">By the way, C arrays don=E2=80=99t have man=
y proponents in the C++ community, because they inconsistently apply value =
and reference semantics. Proposals to extend C arrays in general face an up=
hill battle.</div><div class=3D""><br class=3D""></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=_840AECBB-CA70-4530-AF46-0D6E785C333A--
.
Author: Myriachan <myriachan@gmail.com>
Date: Wed, 8 Jul 2015 20:07:48 -0700 (PDT)
Raw View
------=_Part_26_582730501.1436411268221
Content-Type: multipart/alternative;
boundary="----=_Part_27_1628217727.1436411268222"
------=_Part_27_1628217727.1436411268222
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Wednesday, July 8, 2015 at 3:09:35 PM UTC-7, Francis Andre wrote:
>
> =20
>
> Le 08/07/2015 18:10, Nevin Liber a =C3=A9crit :
> =20
> On 8 July 2015 at 10:44, Francis ANDRE <francis.and...@orange.fr=20
> <javascript:>> wrote:
>
>> Hi
>>
>> I am wondering if there is a place where the array type with a lower=20
>> bound different from 0 -- as for example: int foo[4..12]; -- has been=
=20
>> discussed. Thanks for pointing me any references.
>
>
> Any particular reason you cannot write a class to do this?
> =20
> First, most of 3rd level languages like Algol, PL/1, Pascal and Ada are=
=20
> providing multidimensional arrays. The definition of an array in C++ is =
a=20
> reminiscence of the array in C where it is just a implementation view of =
a=20
> sequence of object allocated at offset 0 in memory. I would consider such=
=20
> feature as a clean abstraction of the array concept.
>
>
That's because C++ arrays are no different. x[y] in the Standard is=20
defined as *(x + y); this is why strange things like 3["meow"] =3D=3D 'w' a=
re=20
valid. (This is actually something that can't be simulated with a class,=
=20
because you can't overload operator [] as a nonmember function. Not that=
=20
it often matters.)
=20
>
> Second, because the syntax of template multi dimentional array definition=
=20
> and reference is ugly and as you know, syntax matters. That's why C++ is=
=20
> successful in providing the proper syntax sugar to a clean abstraction wi=
th=20
> the overloading operator feature for example.
>
> Compare
> Array<Array<Array<int, 1, 4>, 5, 10>, 11, 22> space; space[11][5][1] =
=3D=20
> 64;
>
> with=20
> int space[ 11..22, 5..10, 1..4]; space[11, 5, 1] =3D 64;
>
> And third and most important, because the order of dimensions are reverse=
d=20
> in this specific template case which is error prone and counter intuitive=
..=20
> (the template show above is similar to the STL std::array template class,=
=20
> but with a lower and upper bounds)=20
>
>
The syntax space[11, 5, 1] won't work because , in that context is=20
interpreted as the comma operator. It'd break too much existing code to=20
define , to be a multidimensional specifier. What's wrong with the syntax=
=20
space[11][5][1]? Or space[{11, 5, 1}] if your array class's operator []=20
takes something like std::tuple. If you really don't like either, there is=
=20
also space(11, 5, 1), though many C++ programmers would object to=20
function-call syntax for arrays on principle.
std::array doesn't support it, but multidimensional arrays with bounds that=
=20
don't start with 0 are straightforward to implement by using variadic=20
templates. You can do something like:
Array<int, 11, 22, 5, 10, 1, 4> space;
// or
Array<int, Dim<11, 22>, Dim<5, 10>, Dim<1, 4>> space;
Then once again, these can support one of space[11][5][1], space[{11, 5, 1}=
]=20
or space(11, 5, 1) for accessing members. (Note that supporting syntax=20
like space[11][5][1] on class objects for dimensions > 2 can be less=20
performant depending upon implementation, but it isn't slower by much. The=
=20
other two syntaxes have no such inefficiencies.)
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_27_1628217727.1436411268222
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Wednesday, July 8, 2015 at 3:09:35 PM UTC-7, Francis Andre wrote:<blockq=
uote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-lef=
t: 1px #ccc solid;padding-left: 1ex;">
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<br>
<br>
<div>Le 08/07/2015 18:10, Nevin Liber a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div>
<div class=3D"gmail_quote">On 8 July 2015 at 10:44, Francis
ANDRE <span dir=3D"ltr"><<a href=3D"javascript:" target=3D"_=
blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:';re=
turn true;" onclick=3D"this.href=3D'javascript:';return true;">fran=
cis.and...@orange.fr</a>></span>
wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
I am wondering if there is a place where the array type
with a lower bound different from 0 -- as for example:=C2=A0
int foo[4..12]; -- has been discussed. Thanks for
pointing=C2=A0 me any references.</blockquote>
<div><br>
</div>
<div>Any particular reason you cannot write a class to do
this?</div>
</div>
</div>
</div>
</blockquote>
=C2=A0First, most of 3rd level languages like Algol, PL/1, Pascal and A=
da
are providing=C2=A0 multidimensional arrays. The definition of an array
in C++ is a reminiscence of the array in C where it is just a
implementation view of a sequence of object allocated at offset 0 in
memory. I would consider such feature as a clean abstraction of the
array concept.<br>
<br></div></blockquote><div><br>That's because C++ arrays are no di=
fferent.=C2=A0 <span style=3D"font-family: courier new,monospace;">x[y]</sp=
an> in the Standard is defined as <span style=3D"font-family: courier new,m=
onospace;">*(x + y)</span>; this is why strange things like <span style=3D"=
font-family: courier new,monospace;">3["meow"] =3D=3D 'w'=
</span> are valid.=C2=A0 (This is actually something that can't be simu=
lated with a class, because you can't overload <span style=3D"font-fami=
ly: courier new,monospace;">operator []</span> as a nonmember function.=C2=
=A0 Not that it often matters.)<br>=C2=A0</div><blockquote class=3D"gmail_q=
uote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;pad=
ding-left: 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#000000">
<br>
Second, because the syntax of template multi dimentional array
definition and reference is ugly and as you know, syntax matters.
That's why C++ is successful in providing the proper syntax sugar t=
o
a clean abstraction with the overloading operator feature for
example.<br>
<br>
Compare<br>
Array<Array<Array<int, 1, 4>, 5, 10>, 11, 22>=C2=A0=
=C2=A0=C2=A0
space; space[11][5][1] =3D 64;<br>
<br>
with <br>
int space[ 11..22, 5..10, 1..4]; space[11, 5, 1] =3D 64;<br>
<br>
And third and most important, because the order of dimensions are
reversed in this specific template case which is error prone and
counter intuitive. (the template show above is similar to the STL
std::array template class, but with a lower and upper bounds) <br>
<br></div></blockquote><div><br>The syntax <span style=3D"font-family: =
courier new,monospace;">space[11, 5, 1]</span> won't work because <span=
style=3D"font-family: courier new,monospace;">,</span> in that context is =
interpreted as the comma operator.=C2=A0 It'd break too much existing c=
ode to define <span style=3D"font-family: courier new,monospace;">,</span> =
to be a multidimensional specifier.=C2=A0 What's wrong with the syntax =
<span style=3D"font-family: courier new,monospace;">space[11][5][1]</span>?=
=C2=A0 Or <span style=3D"font-family: courier new,monospace;">space[{11, 5,=
1}]</span> if your array class's <span style=3D"font-family: courier n=
ew,monospace;">operator []</span> takes something like <span style=3D"font-=
family: courier new,monospace;">std::tuple</span>.=C2=A0 If you really don&=
#39;t like either, there is also <span style=3D"font-family: courier new,mo=
nospace;">space(11, 5, 1)</span>, though many C++ programmers would object =
to function-call syntax for arrays on principle.<br><br><span style=3D"font=
-family: courier new,monospace;">std::array</span> doesn't support it, =
but multidimensional arrays with bounds that don't start with <span sty=
le=3D"font-family: courier new,monospace;">0</span> are straightforward to =
implement by using variadic templates.=C2=A0 You can do something like:<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"subpret=
typrint"><span style=3D"color: #606;" class=3D"styled-by-prettify">Array</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;=
" class=3D"styled-by-prettify">11</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">22</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: #066;" class=3D"styled-by-prettify">5</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: #066;" =
class=3D"styled-by-prettify">10</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">,</span><span style=3D"color: #000;" 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">4</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">></span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> space</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: #800;" class=3D"st=
yled-by-prettify">// or</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br></span><span style=3D"color: #606;" class=3D"styled-by-pre=
ttify">Array</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
"><</span><span style=3D"color: #008;" class=3D"styled-by-prettify">int<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Dim</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #0=
66;" class=3D"styled-by-prettify">11</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pr=
ettify">22</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
>,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">Dim</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span styl=
e=3D"color: #066;" class=3D"styled-by-prettify">5</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D=
"styled-by-prettify">10</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">>,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">D=
im</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</sp=
an><span style=3D"color: #066;" class=3D"styled-by-prettify">1</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: #0=
66;" class=3D"styled-by-prettify">4</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">>></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> space</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">;</span></div></code></div><br><br>Then once again, the=
se can support one of <span style=3D"font-family: courier new,monospace;">s=
pace[11][5][1]</span>, <span style=3D"font-family: courier new,monospace;">=
space[{11, 5, 1}]</span> or <span style=3D"font-family: courier new,monospa=
ce;">space(11, 5, 1)</span> for accessing members.=C2=A0 (Note that support=
ing syntax like <span style=3D"font-family: courier new,monospace;">space[1=
1][5][1]</span> on class objects for dimensions > 2 can be less performa=
nt depending upon implementation, but it isn't slower by much.=C2=A0 Th=
e other two syntaxes have no such inefficiencies.)<br><br>Melissa<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_27_1628217727.1436411268222--
------=_Part_26_582730501.1436411268221--
.
Author: Francis ANDRE <francis.andre.kampbell@orange.fr>
Date: Fri, 10 Jul 2015 09:47:03 +0200
Raw View
This is a multi-part message in MIME format.
--------------030706060601010007000405
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 09/07/2015 05:07, Myriachan a =C3=A9crit :
> On Wednesday, July 8, 2015 at 3:09:35 PM UTC-7, Francis Andre wrote:
>
>
>
> Le 08/07/2015 18:10, Nevin Liber a =C3=A9crit :
>> On 8 July 2015 at 10:44, Francis ANDRE <francis.and...@orange.fr
>> <javascript:>> wrote:
>>
>> Hi
>>
>> I am wondering if there is a place where the array type with
>> a lower bound different from 0 -- as for example: int
>> foo[4..12]; -- has been discussed. Thanks for pointing me
>> any references.
>>
>>
>> Any particular reason you cannot write a class to do this?
> First, most of 3rd level languages like Algol, PL/1, Pascal and
> Ada are providing multidimensional arrays. The definition of an
> array in C++ is a reminiscence of the array in C where it is just
> a implementation view of a sequence of object allocated at offset
> 0 in memory. I would consider such feature as a clean abstraction
> of the array concept.
>
>
> That's because C++ arrays are no different. x[y] in the Standard is=20
> defined as *(x + y); this is why strange things like 3["meow"] =3D=3D 'w'=
=20
> are valid. (This is actually something that can't be simulated with a=20
> class, because you can't overload operator [] as a nonmember=20
> function. Not that it often matters.)
>
>
> Second, because the syntax of template multi dimentional array
> definition and reference is ugly and as you know, syntax matters.
> That's why C++ is successful in providing the proper syntax sugar
> to a clean abstraction with the overloading operator feature for
> example.
>
> Compare
> Array<Array<Array<int, 1, 4>, 5, 10>, 11, 22> space;
> space[11][5][1] =3D 64;
>
> with
> int space[ 11..22, 5..10, 1..4]; space[11, 5, 1] =3D 64;
>
> And third and most important, because the order of dimensions are
> reversed in this specific template case which is error prone and
> counter intuitive. (the template show above is similar to the STL
> std::array template class, but with a lower and upper bounds)
>
>
> The syntax space[11, 5, 1] won't work because , in that context is=20
> interpreted as the comma operator. It'd break too much existing code=20
> to define , to be a multidimensional specifier.
Which code does it break too much? Do you mean that space[11, 5, 1] has=20
been used thoroughly to acces the space[1] of a mono dimension array?=20
Really?
> What's wrong with the syntax space[11][5][1]? Or space[{11, 5, 1}] if=20
> your array class's operator [] takes something like std::tuple. If you=20
> really don't like either, there is also space(11, 5, 1), though many=20
> C++ programmers would object to function-call syntax for arrays on=20
> principle.
That's exactly the point: the closer notation to the natural array=20
reference is: space[11, 5, 1]. Why not allowing the operator[] to have=20
more than one parameter and solve the space[11, 5, 1] notation to the=20
operator[] (int i, int j, int k)?
>
> std::array doesn't support it, but multidimensional arrays with bounds=20
> that don't start with 0 are straightforward to implement by using=20
> variadic templates. You can do something like:
>
> |
> Array<int,11,22,5,10,1,4>space;
> // or
> Array<int,Dim<11,22>,Dim<5,10>,Dim<1,4>>space;
> |
>
OK that's works, but again I would prefer this syntax :int space[=20
11..22, 5..10, 1..4] because the template case does not work with=20
shared libraries, which is a no go solution in many case.
>
> Then once again, these can support one of space[11][5][1], space[{11,=20
> 5, 1}] or space(11, 5, 1) for accessing members. (Note that supporting=20
> syntax like space[11][5][1] on class objects for dimensions > 2 can be=20
> less performant depending upon implementation, but it isn't slower by=20
> much. The other two syntaxes have no such inefficiencies.)
>
> Melissa
> --=20
>
> ---
> You received this message because you are subscribed to the Google=20
> Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send=20
> an email to std-proposals+unsubscribe@isocpp.org=20
> <mailto:std-proposals+unsubscribe@isocpp.org>.
> To post to this group, send email to std-proposals@isocpp.org=20
> <mailto:std-proposals@isocpp.org>.
> Visit this group at=20
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
--=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/.
--------------030706060601010007000405
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<br>
<br>
<div class=3D"moz-cite-prefix">Le 09/07/2015 05:07, Myriachan a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:bedc1c76-1026-41b7-a358-95f4d4536e05@isocpp.org"
type=3D"cite">On Wednesday, July 8, 2015 at 3:09:35 PM UTC-7,
Francis Andre wrote:
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div bgcolor=3D"#FFFFFF" text=3D"#000000"> <br>
<br>
<div>Le 08/07/2015 18:10, Nevin Liber a =C3=A9crit=C2=A0:<br>
</div>
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div>
<div class=3D"gmail_quote">On 8 July 2015 at 10:44,
Francis ANDRE <span dir=3D"ltr"><<a
moz-do-not-send=3D"true" href=3D"javascript:"
target=3D"_blank" rel=3D"nofollow"
onmousedown=3D"this.href=3D'javascript:';return true;=
"
onclick=3D"this.href=3D'javascript:';return true;">fr=
ancis.and...@orange.fr</a>></span>
wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br=
>
<br>
I am wondering if there is a place where the array
type with a lower bound different from 0 -- as for
example:=C2=A0 int foo[4..12]; -- has been discussed.
Thanks for pointing=C2=A0 me any references.</blockquot=
e>
<div><br>
</div>
<div>Any particular reason you cannot write a class to
do this?</div>
</div>
</div>
</div>
</blockquote>
=C2=A0First, most of 3rd level languages like Algol, PL/1, Pascal
and Ada are providing=C2=A0 multidimensional arrays. The definiti=
on
of an array in C++ is a reminiscence of the array in C where
it is just a implementation view of a sequence of object
allocated at offset 0 in memory. I would consider such feature
as a clean abstraction of the array concept.<br>
<br>
</div>
</blockquote>
<div><br>
That's because C++ arrays are no different.=C2=A0 <span
style=3D"font-family: courier new,monospace;">x[y]</span> in the
Standard is defined as <span style=3D"font-family: courier
new,monospace;">*(x + y)</span>; this is why strange things
like <span style=3D"font-family: courier new,monospace;">3["meow"]
=3D=3D 'w'</span> are valid.=C2=A0 (This is actually something th=
at
can't be simulated with a class, because you can't overload <span
style=3D"font-family: courier new,monospace;">operator []</span>
as a nonmember function.=C2=A0 Not that it often matters.)<br>
=C2=A0</div>
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div bgcolor=3D"#FFFFFF" text=3D"#000000"> <br>
Second, because the syntax of template multi dimentional array
definition and reference is ugly and as you know, syntax
matters. That's why C++ is successful in providing the proper
syntax sugar to a clean abstraction with the overloading
operator feature for example.<br>
<br>
Compare<br>
Array<Array<Array<int, 1, 4>, 5, 10>, 11,
22>=C2=A0=C2=A0=C2=A0 space; space[11][5][1] =3D 64;<br>
<br>
with <br>
int space[ 11..22, 5..10, 1..4]; space[11, 5, 1] =3D 64;<br>
<br>
And third and most important, because the order of dimensions
are reversed in this specific template case which is error
prone and counter intuitive. (the template show above is
similar to the STL std::array template class, but with a lower
and upper bounds) <br>
<br>
</div>
</blockquote>
<div><br>
The syntax <span style=3D"font-family: courier new,monospace;">spac=
e[11,
5, 1]</span> won't work because <span style=3D"font-family:
courier new,monospace;">,</span> in that context is
interpreted as the comma operator.=C2=A0 It'd break too much existi=
ng
code to define <span style=3D"font-family: courier
new,monospace;">,</span> to be a multidimensional specifier.=C2=
=A0
</div>
</blockquote>
Which code does it break too much? Do you mean that space[11, 5, 1]
has been used thoroughly to acces the space[1]=C2=A0 of a mono dimensio=
n
array? Really?<br>
<blockquote
cite=3D"mid:bedc1c76-1026-41b7-a358-95f4d4536e05@isocpp.org"
type=3D"cite">
<div>What's wrong with the syntax <span style=3D"font-family:
courier new,monospace;">space[11][5][1]</span>?=C2=A0 Or <span
style=3D"font-family: courier new,monospace;">space[{11, 5, 1}]</=
span>
if your array class's <span style=3D"font-family: courier
new,monospace;">operator []</span> takes something like <span
style=3D"font-family: courier new,monospace;">std::tuple</span>.=
=C2=A0
If you really don't like either, there is also <span
style=3D"font-family: courier new,monospace;">space(11, 5, 1)</sp=
an>,
though many C++ programmers would object to function-call syntax
for arrays on principle.<br>
</div>
</blockquote>
That's exactly the point: the closer notation to the natural array
reference=C2=A0 is: space[11, 5, 1]. Why not allowing the operator[] to
have more than one parameter and solve the space[11, 5, 1] notation
to the operator[] (int i, int j, int k)?<br>
<blockquote
cite=3D"mid:bedc1c76-1026-41b7-a358-95f4d4536e05@isocpp.org"
type=3D"cite">
<div><br>
<span style=3D"font-family: courier new,monospace;">std::array</spa=
n>
doesn't support it, but multidimensional arrays with bounds that
don't start with <span style=3D"font-family: courier
new,monospace;">0</span> are straightforward to implement by
using variadic templates.=C2=A0 You can do something like:<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"subprettyprint"><span style=3D"color: #606;"
class=3D"styled-by-prettify">Array</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #008;" class=3D"styled-by-prettify">int</sp=
an><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: #066;" class=3D"styled-by-prettify">11</spa=
n><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: #066;" class=3D"styled-by-prettify">22</spa=
n><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: #066;" class=3D"styled-by-prettify">5</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: #066;" class=3D"styled-by-prettify">10</spa=
n><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: #066;" class=3D"styled-by-prettify">1</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: #066;" class=3D"styled-by-prettify">4</span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify">></s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify"> space<=
/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: #800;"
class=3D"styled-by-prettify">// or</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #606;"
class=3D"styled-by-prettify">Array</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #008;" class=3D"styled-by-prettify">int</sp=
an><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: #606;" class=3D"styled-by-prettify">Dim</sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #066;" class=3D"styled-by-prettify">11</spa=
n><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: #066;" class=3D"styled-by-prettify">22</spa=
n><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: #606;" class=3D"styled-by-prettify">Dim</sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #066;" class=3D"styled-by-prettify">5</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: #066;" class=3D"styled-by-prettify">10</spa=
n><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: #606;" class=3D"styled-by-prettify">Dim</sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #066;" class=3D"styled-by-prettify">1</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: #066;" class=3D"styled-by-prettify">4</span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify">>>=
;</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> space<=
/span><span
style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
></div>
</code></div>
<br>
</div>
</blockquote>
OK that's works, but again I would prefer this syntax :int space[
11..22, 5..10, 1..4] because=C2=A0 the template case does not work=C2=
=A0 with
shared libraries, which is a no go solution in many case.<br>
<blockquote
cite=3D"mid:bedc1c76-1026-41b7-a358-95f4d4536e05@isocpp.org"
type=3D"cite">
<div><br>
Then once again, these can support one of <span
style=3D"font-family: courier new,monospace;">space[11][5][1]</sp=
an>,
<span style=3D"font-family: courier new,monospace;">space[{11, 5,
1}]</span> or <span style=3D"font-family: courier
new,monospace;">space(11, 5, 1)</span> for accessing members.=C2=
=A0
(Note that supporting syntax like <span style=3D"font-family:
courier new,monospace;">space[11][5][1]</span> on class
objects for dimensions > 2 can be less performant depending
upon implementation, but it isn't slower by much.=C2=A0 The other t=
wo
syntaxes have no such inefficiencies.)<br>
<br>
Melissa<br>
</div>
-- <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 moz-do-not-send=3D"true"
href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+=
unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a moz-do-not-send=3D"true"
href=3D"mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</=
a>.<br>
Visit this group at <a moz-do-not-send=3D"true"
href=3D"http://groups.google.com/a/isocpp.org/group/std-proposals/"=
>http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br>
</blockquote>
<br>
</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 />
--------------030706060601010007000405--
.
Author: Patrice Roy <patricer@gmail.com>
Date: Fri, 10 Jul 2015 08:00:06 -0400
Raw View
--089e0115e882e53a59051a841c92
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Given this:
That's exactly the point: the closer notation to the natural array
> reference is: space[11, 5, 1]. Why not allowing the operator[] to have
> more than one parameter and solve the space[11, 5, 1] notation to the
> operator[] (int i, int j, int k)?
>
What do you suggest when someone uses a user-defined type and overloads the
comma operator?
2015-07-10 3:47 GMT-04:00 Francis ANDRE <francis.andre.kampbell@orange.fr>:
>
>
> Le 09/07/2015 05:07, Myriachan a =C3=A9crit :
>
> On Wednesday, July 8, 2015 at 3:09:35 PM UTC-7, Francis Andre wrote:
>>
>>
>>
>> Le 08/07/2015 18:10, Nevin Liber a =C3=A9crit :
>>
>> On 8 July 2015 at 10:44, Francis ANDRE <francis.and...@orange.fr> wrote=
:
>>
>>> Hi
>>>
>>> I am wondering if there is a place where the array type with a lower
>>> bound different from 0 -- as for example: int foo[4..12]; -- has been
>>> discussed. Thanks for pointing me any references.
>>
>>
>> Any particular reason you cannot write a class to do this?
>>
>> First, most of 3rd level languages like Algol, PL/1, Pascal and Ada are
>> providing multidimensional arrays. The definition of an array in C++ is=
a
>> reminiscence of the array in C where it is just a implementation view of=
a
>> sequence of object allocated at offset 0 in memory. I would consider suc=
h
>> feature as a clean abstraction of the array concept.
>>
>>
> That's because C++ arrays are no different. x[y] in the Standard is
> defined as *(x + y); this is why strange things like 3["meow"] =3D=3D 'w'=
are
> valid. (This is actually something that can't be simulated with a class,
> because you can't overload operator [] as a nonmember function. Not that
> it often matters.)
>
>
>>
>> Second, because the syntax of template multi dimentional array definitio=
n
>> and reference is ugly and as you know, syntax matters. That's why C++ is
>> successful in providing the proper syntax sugar to a clean abstraction w=
ith
>> the overloading operator feature for example.
>>
>> Compare
>> Array<Array<Array<int, 1, 4>, 5, 10>, 11, 22> space; space[11][5][1] =
=3D
>> 64;
>>
>> with
>> int space[ 11..22, 5..10, 1..4]; space[11, 5, 1] =3D 64;
>>
>> And third and most important, because the order of dimensions are
>> reversed in this specific template case which is error prone and counter
>> intuitive. (the template show above is similar to the STL std::array
>> template class, but with a lower and upper bounds)
>>
>>
> The syntax space[11, 5, 1] won't work because , in that context is
> interpreted as the comma operator. It'd break too much existing code to
> define , to be a multidimensional specifier.
>
> Which code does it break too much? Do you mean that space[11, 5, 1] has
> been used thoroughly to acces the space[1] of a mono dimension array?
> Really?
>
> What's wrong with the syntax space[11][5][1]? Or space[{11, 5, 1}] if
> your array class's operator [] takes something like std::tuple. If you
> really don't like either, there is also space(11, 5, 1), though many C++
> programmers would object to function-call syntax for arrays on principle.
>
> That's exactly the point: the closer notation to the natural array
> reference is: space[11, 5, 1]. Why not allowing the operator[] to have
> more than one parameter and solve the space[11, 5, 1] notation to the
> operator[] (int i, int j, int k)?
>
>
> std::array doesn't support it, but multidimensional arrays with bounds
> that don't start with 0 are straightforward to implement by using
> variadic templates. You can do something like:
>
> Array<int, 11, 22, 5, 10, 1, 4> space;
> // or
> Array<int, Dim<11, 22>, Dim<5, 10>, Dim<1, 4>> space;
>
> OK that's works, but again I would prefer this syntax :int space[
> 11..22, 5..10, 1..4] because the template case does not work with share=
d
> libraries, which is a no go solution in many case.
>
>
> Then once again, these can support one of space[11][5][1], space[{11, 5,
> 1}] or space(11, 5, 1) for accessing members. (Note that supporting
> syntax like space[11][5][1] on class objects for dimensions > 2 can be
> less performant depending upon implementation, but it isn't slower by
> much. The other two syntaxes have no such inefficiencies.)
>
> Melissa
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>
--=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/.
--089e0115e882e53a59051a841c92
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Given this:<br><br><blockquote style=3D"margin:0px 0p=
x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class=
=3D"gmail_quote">That's exactly the point: the closer notation to the n=
atural array
reference=C2=A0 is: space[11, 5, 1]. Why not allowing the operator[] to
have more than one parameter and solve the space[11, 5, 1] notation
to the operator[] (int i, int j, int k)?<span class=3D"im"><br></span><=
/blockquote><br></div>What do you suggest when someone uses a user-defined =
type and overloads the comma operator?<br></div><div class=3D"gmail_extra">=
<br><div class=3D"gmail_quote">2015-07-10 3:47 GMT-04:00 Francis ANDRE <spa=
n dir=3D"ltr"><<a href=3D"mailto:francis.andre.kampbell@orange.fr" targe=
t=3D"_blank">francis.andre.kampbell@orange.fr</a>></span>:<br><blockquot=
e class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc sol=
id;padding-left:1ex">
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000"><span class=3D"">
<br>
<br>
<div>Le 09/07/2015 05:07, Myriachan a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote type=3D"cite">On Wednesday, July 8, 2015 at 3:09:35 PM UTC-=
7,
Francis Andre wrote:
<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex=
;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor=3D"#FFFFFF" text=3D"#000000"> <br>
<br>
<div>Le 08/07/2015 18:10, Nevin Liber a =C3=A9crit=C2=A0:<br>
</div>
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div>
<div class=3D"gmail_quote">On 8 July 2015 at 10:44,
Francis ANDRE <span dir=3D"ltr"><<a rel=3D"nofollow">f=
rancis.and...@orange.fr</a>></span>
wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .=
8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
I am wondering if there is a place where the array
type with a lower bound different from 0 -- as for
example:=C2=A0 int foo[4..12]; -- has been discussed.
Thanks for pointing=C2=A0 me any references.</blockquot=
e>
<div><br>
</div>
<div>Any particular reason you cannot write a class to
do this?</div>
</div>
</div>
</div>
</blockquote>
=C2=A0First, most of 3rd level languages like Algol, PL/1, Pascal
and Ada are providing=C2=A0 multidimensional arrays. The definiti=
on
of an array in C++ is a reminiscence of the array in C where
it is just a implementation view of a sequence of object
allocated at offset 0 in memory. I would consider such feature
as a clean abstraction of the array concept.<br>
<br>
</div>
</blockquote>
<div><br>
That's because C++ arrays are no different.=C2=A0 <span style=
=3D"font-family:courier new,monospace">x[y]</span> in the
Standard is defined as <span style=3D"font-family:courier new,monos=
pace">*(x + y)</span>; this is why strange things
like <span style=3D"font-family:courier new,monospace">3["meow=
"]
=3D=3D 'w'</span> are valid.=C2=A0 (This is actually some=
thing that
can't be simulated with a class, because you can't overload=
<span style=3D"font-family:courier new,monospace">operator []</span>
as a nonmember function.=C2=A0 Not that it often matters.)<br>
=C2=A0</div>
<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex=
;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor=3D"#FFFFFF" text=3D"#000000"> <br>
Second, because the syntax of template multi dimentional array
definition and reference is ugly and as you know, syntax
matters. That's why C++ is successful in providing the proper
syntax sugar to a clean abstraction with the overloading
operator feature for example.<br>
<br>
Compare<br>
Array<Array<Array<int, 1, 4>, 5, 10>, 11,
22>=C2=A0=C2=A0=C2=A0 space; space[11][5][1] =3D 64;<br>
<br>
with <br>
int space[ 11..22, 5..10, 1..4]; space[11, 5, 1] =3D 64;<br>
<br>
And third and most important, because the order of dimensions
are reversed in this specific template case which is error
prone and counter intuitive. (the template show above is
similar to the STL std::array template class, but with a lower
and upper bounds) <br>
<br>
</div>
</blockquote>
<div><br>
The syntax <span style=3D"font-family:courier new,monospace">space[=
11,
5, 1]</span> won't work because <span style=3D"font-family:co=
urier new,monospace">,</span> in that context is
interpreted as the comma operator.=C2=A0 It'd break too much ex=
isting
code to define <span style=3D"font-family:courier new,monospace">,<=
/span> to be a multidimensional specifier.=C2=A0
</div>
</blockquote></span>
Which code does it break too much? Do you mean that space[11, 5, 1]
has been used thoroughly to acces the space[1]=C2=A0 of a mono dimensio=
n
array? Really?<span class=3D""><br>
<blockquote type=3D"cite">
<div>What's wrong with the syntax <span style=3D"font-family:cour=
ier new,monospace">space[11][5][1]</span>?=C2=A0 Or <span style=3D"font-fam=
ily:courier new,monospace">space[{11, 5, 1}]</span>
if your array class's <span style=3D"font-family:courier new,mo=
nospace">operator []</span> takes something like <span style=3D"font-family=
:courier new,monospace">std::tuple</span>.=C2=A0
If you really don't like either, there is also <span style=3D"f=
ont-family:courier new,monospace">space(11, 5, 1)</span>,
though many C++ programmers would object to function-call syntax
for arrays on principle.<br>
</div>
</blockquote></span>
That's exactly the point: the closer notation to the natural array
reference=C2=A0 is: space[11, 5, 1]. Why not allowing the operator[] to
have more than one parameter and solve the space[11, 5, 1] notation
to the operator[] (int i, int j, int k)?<span class=3D""><br>
<blockquote type=3D"cite">
<div><br>
<span style=3D"font-family:courier new,monospace">std::array</span>
doesn't support it, but multidimensional arrays with bounds tha=
t
don't start with <span style=3D"font-family:courier new,monospa=
ce">0</span> are straightforward to implement by
using variadic templates.=C2=A0 You can do something like:<br>
<br>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(18=
7,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code>
<div><span style=3D"color:#606">Array</span><span style=3D"colo=
r:#660"><</span><span style=3D"color:#008">int</span><span style=3D"colo=
r:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#06=
6">11</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
</span><span style=3D"color:#066">22</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#066">5</span><s=
pan style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#066">10</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#066">1</span><span style=3D"c=
olor:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:=
#066">4</span><span style=3D"color:#660">></span><span style=3D"color:#0=
00"> space</span><span style=3D"color:#660">;</span><span style=3D"color:#0=
00"><br>
</span><span style=3D"color:#800">// or</span><span style=3D"=
color:#000"><br>
</span><span style=3D"color:#606">Array</span><span style=3D"=
color:#660"><</span><span style=3D"color:#008">int</span><span style=3D"=
color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color=
:#606">Dim</span><span style=3D"color:#660"><</span><span style=3D"color=
:#066">11</span><span style=3D"color:#660">,</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#066">22</span><span style=3D"color:#660">&=
gt;,</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Di=
m</span><span style=3D"color:#660"><</span><span style=3D"color:#066">5<=
/span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span=
><span style=3D"color:#066">10</span><span style=3D"color:#660">>,</span=
><span style=3D"color:#000"> </span><span style=3D"color:#606">Dim</span><s=
pan style=3D"color:#660"><</span><span style=3D"color:#066">1</span><spa=
n style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#066">4</span><span style=3D"color:#660">>></span><span s=
tyle=3D"color:#000"> space</span><span style=3D"color:#660">;</span></div>
</code></div>
<br>
</div>
</blockquote></span>
OK that's works, but again I would prefer this syntax :int space[
11..22, 5..10, 1..4] because=C2=A0 the template case does not work=C2=
=A0 with
shared libraries, which is a no go solution in many case.<span class=3D=
""><br>
<blockquote type=3D"cite">
<div><br>
Then once again, these can support one of <span style=3D"font-famil=
y:courier new,monospace">space[11][5][1]</span>,
<span style=3D"font-family:courier new,monospace">space[{11, 5,
1}]</span> or <span style=3D"font-family:courier new,monospace">s=
pace(11, 5, 1)</span> for accessing members.=C2=A0
(Note that supporting syntax like <span style=3D"font-family:courie=
r new,monospace">space[11][5][1]</span> on class
objects for dimensions > 2 can be less performant depending
upon implementation, but it isn't slower by much.=C2=A0 The oth=
er two
syntaxes have no such inefficiencies.)<br>
<br>
Melissa<br>
</div>
-- <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=3D"mailto:std-proposals+unsubscribe@isocpp.o=
rg" target=3D"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@=
isocpp.org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/=
group/std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.o=
rg/group/std-proposals/</a>.<br>
</blockquote>
<br>
</span></div><div class=3D"HOEnZb"><div class=3D"h5">
<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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>
<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 />
--089e0115e882e53a59051a841c92--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 10 Jul 2015 15:20:49 +0300
Raw View
On 10 July 2015 at 15:00, Patrice Roy <patricer@gmail.com> wrote:
> Given this:
>
>> That's exactly the point: the closer notation to the natural array
>> reference is: space[11, 5, 1]. Why not allowing the operator[] to have more
>> than one parameter and solve the space[11, 5, 1] notation to the operator[]
>> (int i, int j, int k)?
>
>
> What do you suggest when someone uses a user-defined type and overloads the
> comma operator?
Just FYI, this is http://cplusplus.github.io/EWG/ewg-active.html#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/.
.
Author: Patrice Roy <patricer@gmail.com>
Date: Fri, 10 Jul 2015 08:43:51 -0400
Raw View
--089e0158b5e460f1e8051a84b95c
Content-Type: text/plain; charset=UTF-8
Thanks; I had not seen that one pass by :)
2015-07-10 8:20 GMT-04:00 Ville Voutilainen <ville.voutilainen@gmail.com>:
> On 10 July 2015 at 15:00, Patrice Roy <patricer@gmail.com> wrote:
> > Given this:
> >
> >> That's exactly the point: the closer notation to the natural array
> >> reference is: space[11, 5, 1]. Why not allowing the operator[] to have
> more
> >> than one parameter and solve the space[11, 5, 1] notation to the
> operator[]
> >> (int i, int j, int k)?
> >
> >
> > What do you suggest when someone uses a user-defined type and overloads
> the
> > comma operator?
>
>
> Just FYI, this is http://cplusplus.github.io/EWG/ewg-active.html#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/.
>
--
---
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/.
--089e0158b5e460f1e8051a84b95c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Thanks; I had not seen that one pass by :)<br></div><div c=
lass=3D"gmail_extra"><br><div class=3D"gmail_quote">2015-07-10 8:20 GMT-04:=
00 Ville Voutilainen <span dir=3D"ltr"><<a href=3D"mailto:ville.voutilai=
nen@gmail.com" target=3D"_blank">ville.voutilainen@gmail.com</a>></span>=
:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex"><span class=3D"">On 10 July 2015 at 15:=
00, Patrice Roy <<a href=3D"mailto:patricer@gmail.com">patricer@gmail.co=
m</a>> wrote:<br>
> Given this:<br>
><br>
>> That's exactly the point: the closer notation to the natural a=
rray<br>
>> reference=C2=A0 is: space[11, 5, 1]. Why not allowing the operator=
[] to have more<br>
>> than one parameter and solve the space[11, 5, 1] notation to the o=
perator[]<br>
>> (int i, int j, int k)?<br>
><br>
><br>
> What do you suggest when someone uses a user-defined type and overload=
s the<br>
> comma operator?<br>
<br>
<br>
</span>Just FYI, this is <a href=3D"http://cplusplus.github.io/EWG/ewg-acti=
ve.html#88" rel=3D"noreferrer" target=3D"_blank">http://cplusplus.github.io=
/EWG/ewg-active.html#88</a><br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
--<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%2Bunsubscribe@isocpp.org">std-propo=
sals+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/" rel=3D"noreferrer" target=3D"_blank">http://groups.google.c=
om/a/isocpp.org/group/std-proposals/</a>.<br>
</div></div></blockquote></div><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 />
--089e0158b5e460f1e8051a84b95c--
.
Author: Jesse Perla <jesseperla@gmail.com>
Date: Fri, 10 Jul 2015 10:40:39 -0700 (PDT)
Raw View
------=_Part_2348_1841468391.1436550039363
Content-Type: multipart/alternative;
boundary="----=_Part_2349_2077145682.1436550039363"
------=_Part_2349_2077145682.1436550039363
Content-Type: text/plain; charset=UTF-8
See boost::multi_array, which I believe has something called index_bases()
to specify the first element.
I am not sure how many people use it, and it doesn't seem to be discussed
in newer multi_array libraries. I suspect people have come to accept 0
lower bounds except under strange circumstances, at which you can use your
own class like this.
--
---
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_2349_2077145682.1436550039363
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><font color=3D"#000000" face=3D"monospace" size=3D"3">See =
boost::multi_array, which I believe has something called index_bases() to=
=C2=A0specify=C2=A0the first element.</font><br><div><br></div><div>I am no=
t sure how many people use it, and it doesn't seem to be discussed in n=
ewer multi_array libraries. =C2=A0I suspect =C2=A0people have come to accep=
t 0 lower bounds except under strange circumstances, at which you can use y=
our own class like this.</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_2349_2077145682.1436550039363--
------=_Part_2348_1841468391.1436550039363--
.