Topic: array_ref - light-weight array
Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Wed, 11 Sep 2013 10:38:42 -0700 (PDT)
Raw View
------=_Part_503_8376088.1378921122883
Content-Type: text/plain; charset=ISO-8859-1
An idea came to my head to define a light-weight equivalent to std::array
where a reference to an array will be kept. This class will have the same
interface as std::array but there is no need to copy a whole ordinary array
that to create an object of this class. Something as
#include <iostream>
#include <cstdlib>
#include <ctime>
template <typename T, size_t N>
class array_ref
{
public:
array_ref( T ( &ra )[N] ) : ra( ra ) {}
T & front() { return ( ra[0] ); }
const T & front() const { return ( ra[0] ); }
// all other member functions of std::array
private:
T ( &ra )[N];
};
int _tmain()
{
const size_t N = 10;
int a[N];
std::srand( ( unsigned int )std::time( 0 ) );
std::generate_n( a, N, [=] { return ( std::rand() % N ); } );
array_ref<int, N> ra( a );
std::cout << "a[0] = " << a[0] << std::endl;
std::cout << "ra[0] = " << ra.front() << std::endl;
}
--
---
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_503_8376088.1378921122883
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>An idea came to my head to define a light-weight equi=
valent to std::array where a reference to an array will be kept. This =
class will have the same interface as std::array but there is no need to co=
py a whole ordinary array that to create an object of this class. Something=
as</div><div> </div><div>#include <iostream></div><div>#include=
<cstdlib></div><div>#include <ctime></div><div> </div><di=
v>template <typename T, size_t N></div><div> </div><div>class ar=
ray_ref<br>{<br>public:<br> array_ref( T ( &ra )[N] ) : ra( ra ) {=
}<br> T & front() { return ( ra[0] ); }<br> const T & fro=
nt() const { return ( ra[0] ); }<br> // all other member functions of =
std::array<br>private:<br> T ( &ra )[N];<br>};</div><div> </d=
iv><div>int _tmain()<br>{<br> const size_t N =3D 10;<br> &n=
bsp;int a[N];</div><div> </div><div> std::srand( ( unsigned=
int )std::time( 0 ) );</div><div> std::generate_n( a, N, [=3D] =
{ return ( std::rand() % N ); } );</div><div> </div><div> a=
rray_ref<int, N> ra( a );</div><div> </div><div> std:=
:cout << "a[0] =3D " << a[0] << std::endl;<br>  =
;std::cout << "ra[0] =3D " << ra.front() << std::endl;<br=
>}<br></div><font face=3D"Consolas" size=3D"2"><p> </p><div> </di=
v><font face=3D"Consolas" size=3D"2"><div> </div><p> </p></font><=
/font></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_503_8376088.1378921122883--
.
Author: "Billy O'Neal" <billy.oneal@gmail.com>
Date: Wed, 11 Sep 2013 10:53:10 -0700
Raw View
--089e0158a92ecdd8e504e61f4dd1
Content-Type: text/plain; charset=ISO-8859-1
Why not just pass the std::array by reference, and not create the built-in
array in the first place?
Billy O'Neal
https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor - BleepingComputer.com
On Wed, Sep 11, 2013 at 10:38 AM, Vlad from Moscow <vlad.moscow@mail.ru>wrote:
> An idea came to my head to define a light-weight equivalent to std::array
> where a reference to an array will be kept. This class will have the same
> interface as std::array but there is no need to copy a whole ordinary array
> that to create an object of this class. Something as
>
> #include <iostream>
> #include <cstdlib>
> #include <ctime>
>
> template <typename T, size_t N>
>
> class array_ref
> {
> public:
> array_ref( T ( &ra )[N] ) : ra( ra ) {}
> T & front() { return ( ra[0] ); }
> const T & front() const { return ( ra[0] ); }
> // all other member functions of std::array
> private:
> T ( &ra )[N];
> };
>
> int _tmain()
> {
> const size_t N = 10;
> int a[N];
>
> std::srand( ( unsigned int )std::time( 0 ) );
> std::generate_n( a, N, [=] { return ( std::rand() % N ); } );
>
> array_ref<int, N> ra( a );
>
> std::cout << "a[0] = " << a[0] << std::endl;
> std::cout << "ra[0] = " << ra.front() << std::endl;
> }
>
>
>
>
>
>
>
> --
>
> ---
> 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/.
--089e0158a92ecdd8e504e61f4dd1
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Why not just pass the std::array by reference, and not cre=
ate the built-in array in the first place?</div><div class=3D"gmail_extra">=
<br clear=3D"all"><div><div dir=3D"ltr"><div>Billy O'Neal</div><div><a =
href=3D"https://bitbucket.org/BillyONeal/" target=3D"_blank">https://github=
..com/BillyONeal/</a></div>
<div><a href=3D"http://stackoverflow.com/users/82320/billy-oneal" target=3D=
"_blank">http://stackoverflow.com/users/82320/billy-oneal</a></div><div>Mal=
ware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Wed, Sep 11, 2013 at 10:38 AM, Vlad f=
rom Moscow <span dir=3D"ltr"><<a href=3D"mailto:vlad.moscow@mail.ru" tar=
get=3D"_blank">vlad.moscow@mail.ru</a>></span> wrote:<br><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa=
dding-left:1ex">
<div dir=3D"ltr"><div>An idea came to my head to define a light-weight equi=
valent to std::array where=A0a reference to an array will be kept. This cla=
ss will have the same interface as std::array but there is no need to copy =
a whole ordinary array that to create an object of this class. Something as=
</div>
<div>=A0</div><div>#include <iostream></div><div>#include <cstdlib=
></div><div>#include <ctime></div><div>=A0</div><div>template <=
typename T, size_t N></div><div>=A0</div><div>class array_ref<br>{<br>pu=
blic:<br>
=A0array_ref( T ( &ra )[N] ) : ra( ra ) {}<br>=A0T & front() { retu=
rn ( ra[0] ); }<br>=A0const T & front() const { return ( ra[0] ); }<br>=
=A0// all other member functions of std::array<br>private:<br>=A0T ( &r=
a )[N];<br>
};</div><div>=A0</div><div>int _tmain()<br>{<br>=A0=A0const size_t N =3D 10=
;<br>=A0=A0int a[N];</div><div>=A0</div><div>=A0=A0std::srand( ( unsigned i=
nt )std::time( 0 ) );</div><div>=A0=A0std::generate_n( a, N, [=3D] { return=
( std::rand() % N ); } );</div>
<div>=A0</div><div>=A0=A0array_ref<int, N> ra( a );</div><div>=A0</di=
v><div>=A0=A0std::cout << "a[0] =3D " << a[0] <<=
; std::endl;<br>=A0=A0std::cout << "ra[0] =3D " << ra=
..front() << std::endl;<br>
}<span class=3D"HOEnZb"><font color=3D"#888888"><br></font></span></div><sp=
an class=3D"HOEnZb"><font color=3D"#888888"><font face=3D"Consolas"><p>=A0<=
/p><div>=A0</div><font face=3D"Consolas"><div>=A0</div><p>=A0</p></font></f=
ont></font></span></div>
<span class=3D"HOEnZb"><font color=3D"#888888">
<p></p>
-- <br>
=A0<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div>
<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--089e0158a92ecdd8e504e61f4dd1--
.
Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Wed, 11 Sep 2013 10:59:59 -0700 (PDT)
Raw View
------=_Part_591_1815812.1378922399558
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable
You can pass std::array by reference if you already have an object of type=
=20
std::array. And what to do if you have an ordinary array?
=20
=D3=D2=C5=C4=C1, 11 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 21:53:10 UTC+4 =D0=
=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Billy O'Neal=20
=CE=C1=D0=C9=D3=C1=CC:
> Why not just pass the std::array by reference, and not create the built-i=
n=20
> array in the first place?
>
> Billy O'Neal
> https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
> http://stackoverflow.com/users/82320/billy-oneal
> Malware Response Instructor - BleepingComputer.com
>
>
> On Wed, Sep 11, 2013 at 10:38 AM, Vlad from Moscow <vlad....@mail.ru<java=
script:>
> > wrote:
>
>> An idea came to my head to define a light-weight equivalent to std::arra=
y=20
>> where a reference to an array will be kept. This class will have the sam=
e=20
>> interface as std::array but there is no need to copy a whole ordinary ar=
ray=20
>> that to create an object of this class. Something as
>> =20
>> #include <iostream>
>> #include <cstdlib>
>> #include <ctime>
>> =20
>> template <typename T, size_t N>
>> =20
>> class array_ref
>> {
>> public:
>> array_ref( T ( &ra )[N] ) : ra( ra ) {}
>> T & front() { return ( ra[0] ); }
>> const T & front() const { return ( ra[0] ); }
>> // all other member functions of std::array
>> private:
>> T ( &ra )[N];
>> };
>> =20
>> int _tmain()
>> {
>> const size_t N =3D 10;
>> int a[N];
>> =20
>> std::srand( ( unsigned int )std::time( 0 ) );
>> std::generate_n( a, N, [=3D] { return ( std::rand() % N ); } );
>> =20
>> array_ref<int, N> ra( a );
>> =20
>> std::cout << "a[0] =3D " << a[0] << std::endl;
>> std::cout << "ra[0] =3D " << ra.front() << std::endl;
>> }
>>
>> =20
>> =20
>> =20
>>
>> =20
>> =20
>> --=20
>> =20
>> ---=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> 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/.
------=_Part_591_1815812.1378922399558
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>You can pass std::array by reference if you already h=
ave an object of type std::array. And what to do if you have an ordinary ar=
ray?</div><div> </div><div><br>=D3=D2=C5=C4=C1, 11 =D3=C5=CE=D4=D1=C2=
=D2=D1 2013 =C7., 21:53:10 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 =
Billy O'Neal =CE=C1=D0=C9=D3=C1=CC:</div><blockquote class=3D"gmail_quote" =
style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: r=
gb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div =
dir=3D"ltr">Why not just pass the std::array by reference, and not create t=
he built-in array in the first place?</div><div><br clear=3D"all"><div><div=
dir=3D"ltr"><div>Billy O'Neal</div><div><a href=3D"https://bitbucket.org/B=
illyONeal/" target=3D"_blank">https://github.com/BillyONeal/</a></div>
<div><a href=3D"http://stackoverflow.com/users/82320/billy-oneal" target=3D=
"_blank">http://stackoverflow.com/<wbr>users/82320/billy-oneal</a></div><di=
v>Malware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Wed, Sep 11, 2013 at 10:38 AM, Vlad f=
rom Moscow <span dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" =
gdf-obfuscated-mailto=3D"PyCi9OaE6EsJ">vlad....@mail.ru</a>></span> wrot=
e:<br><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex;=
padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-widt=
h: 1px; border-left-style: solid;">
<div dir=3D"ltr"><div>An idea came to my head to define a light-weight equi=
valent to std::array where a reference to an array will be kept. This =
class will have the same interface as std::array but there is no need to co=
py a whole ordinary array that to create an object of this class. Something=
as</div>
<div> </div><div>#include <iostream></div><div>#include <cstd=
lib></div><div>#include <ctime></div><div> </div><div>templat=
e <typename T, size_t N></div><div> </div><div>class array_ref<b=
r>{<br>public:<br>
array_ref( T ( &ra )[N] ) : ra( ra ) {}<br> T & front() =
{ return ( ra[0] ); }<br> const T & front() const { return ( ra[0]=
); }<br> // all other member functions of std::array<br>private:<br>&=
nbsp;T ( &ra )[N];<br>
};</div><div> </div><div>int _tmain()<br>{<br> const size_t=
N =3D 10;<br> int a[N];</div><div> </div><div> =
std::srand( ( unsigned int )std::time( 0 ) );</div><div> std::ge=
nerate_n( a, N, [=3D] { return ( std::rand() % N ); } );</div>
<div> </div><div> array_ref<int, N> ra( a );</div><di=
v> </div><div> std::cout << "a[0] =3D " << a[0]=
<< std::endl;<br> std::cout << "ra[0] =3D " <<=
; ra.front() << std::endl;<br>
}<span><font color=3D"#888888"><br></font></span></div><span><font color=3D=
"#888888"><font face=3D"Consolas"><p> </p><div> </div><font face=
=3D"Consolas"><div> </div><p> </p></font></font></font></span></d=
iv>
<span><font color=3D"#888888">
<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 e=
mail to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
PyCi9OaE6EsJ">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"PyCi9OaE6EsJ">std-pr...@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/<wbr>isocpp.or=
g/group/std-<wbr>proposals/</a>.<br>
</font></span></blockquote></div><br></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_591_1815812.1378922399558--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 11 Sep 2013 21:09:40 +0300
Raw View
--001a11c264a46fdd8004e61f8686
Content-Type: text/plain; charset=ISO-8859-1
On 11 September 2013 20:59, Vlad from Moscow <vlad.moscow@mail.ru> wrote:
> You can pass std::array by reference if you already have an object of type
> std::array. And what to do if you have an ordinary array?
>
http://open-std.org/JTC1/SC22/WG21/docs/papers/2012/n3334.html
--
---
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/.
--001a11c264a46fdd8004e61f8686
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 11 September 2013 20:59, Vlad from Moscow <span dir=3D"ltr"><=
<a href=3D"mailto:vlad.moscow@mail.ru" target=3D"_blank">vlad.moscow@mail.r=
u</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div>You=
can pass std::array by reference if you already have an object of type std=
::array. And what to do if you have an ordinary array?</div>
</div></blockquote><div><br><a href=3D"http://open-std.org/JTC1/SC22/WG21/d=
ocs/papers/2012/n3334.html">http://open-std.org/JTC1/SC22/WG21/docs/papers/=
2012/n3334.html</a><br></div></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--001a11c264a46fdd8004e61f8686--
.
Author: DeadMG <wolfeinstein@gmail.com>
Date: Wed, 11 Sep 2013 11:21:16 -0700 (PDT)
Raw View
------=_Part_106_30654450.1378923676357
Content-Type: text/plain; charset=ISO-8859-1
This has already been proposed a number of times. The Committee didn't show
particular interest.
--
---
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_106_30654450.1378923676357
Content-Type: text/html; charset=ISO-8859-1
<div dir="ltr">This has already been proposed a number of times. The Committee didn't show particular interest.</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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />
------=_Part_106_30654450.1378923676357--
.
Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Wed, 11 Sep 2013 11:34:57 -0700 (PDT)
Raw View
------=_Part_499_2317926.1378924497114
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable
My idea differs. I do not want that array_ref would be immutable.
=20
=D3=D2=C5=C4=C1, 11 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 22:09:40 UTC+4 =D0=
=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Ville Voutilainen=20
=CE=C1=D0=C9=D3=C1=CC:
>
>
>
> On 11 September 2013 20:59, Vlad from Moscow <vlad....@mail.ru<javascript=
:>
> > wrote:
>
>> You can pass std::array by reference if you already have an object of=20
>> type std::array. And what to do if you have an ordinary array?
>>
>
> http://open-std.org/JTC1/SC22/WG21/docs/papers/2012/n3334.html
>
--=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_499_2317926.1378924497114
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>My idea differs. I do not want that array_ref would b=
e immutable.</div><div> </div><div><br>=D3=D2=C5=C4=C1, 11 =D3=C5=CE=
=D4=D1=C2=D2=D1 2013 =C7., 22:09:40 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=
=C5=CC=D8 Ville Voutilainen =CE=C1=D0=C9=D3=C1=CC:</div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; bor=
der-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-sty=
le: solid;"><div dir=3D"ltr"><br><div><br><br><div class=3D"gmail_quote">On=
11 September 2013 20:59, Vlad from Moscow <span dir=3D"ltr"><<a href=3D=
"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"Ub_fF47sxacJ">vlad=
.....@mail.ru</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; paddi=
ng-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px=
; border-left-style: solid;"><div dir=3D"ltr"><div>You can pass std::array =
by reference if you already have an object of type std::array. And what to =
do if you have an ordinary array?</div>
</div></blockquote><div><br><a href=3D"http://open-std.org/JTC1/SC22/WG21/d=
ocs/papers/2012/n3334.html" target=3D"_blank">http://open-std.org/JTC1/SC22=
/<wbr>WG21/docs/papers/2012/n3334.<wbr>html</a><br></div></div></div></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_499_2317926.1378924497114--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 11 Sep 2013 21:35:36 +0300
Raw View
--001a11c3c70431313004e61fe3ba
Content-Type: text/plain; charset=ISO-8859-1
On 11 September 2013 21:21, DeadMG <wolfeinstein@gmail.com> wrote:
> This has already been proposed a number of times. The Committee didn't
> show particular interest.
>
>
>
>
The last vote I can find about array_ref was in Kona, that was 5 weakly
for, 4 neutral, 3 weakly for.
Not much opposition, but not much support either.
--
---
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/.
--001a11c3c70431313004e61fe3ba
Content-Type: text/html; charset=ISO-8859-1
<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 11 September 2013 21:21, DeadMG <span dir="ltr"><<a href="mailto:wolfeinstein@gmail.com" target="_blank">wolfeinstein@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This has already been proposed a number of times. The Committee didn't show particular interest.</div>
<div class="HOEnZb"><div class="h5">
<p></p>
<br><br></div></div></blockquote><div><br></div><div>The last vote I can find about array_ref was in Kona, that was 5 weakly for, 4 neutral, 3 weakly for.<br></div><div>Not much opposition, but not much support either. <br>
</div></div><br></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />
--001a11c3c70431313004e61fe3ba--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 11 Sep 2013 21:41:09 +0300
Raw View
--089e01493e42012c0604e61ff792
Content-Type: text/plain; charset=ISO-8859-1
On 11 September 2013 21:34, Vlad from Moscow <vlad.moscow@mail.ru> wrote:
> My idea differs. I do not want that array_ref would be immutable.
>
>
>
>
Well, then just consider the previous proposal as a FYI that you need to
refer to in a new
proposal. You may need to make a stronger case for the need for an
array_ref than
the previous proposal does.
--
---
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/.
--089e01493e42012c0604e61ff792
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 11 September 2013 21:34, Vlad from Moscow <span dir=3D"ltr"><=
<a href=3D"mailto:vlad.moscow@mail.ru" target=3D"_blank">vlad.moscow@mail.r=
u</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>My idea differs. I do =
not want that array_ref would be immutable.</div><div>=A0</div><div><br><br=
></div>
</div></blockquote><div><br></div><div>Well, then just consider the previou=
s proposal as a FYI that you need to refer to in a new<br>proposal. You may=
need to make a stronger case for the need for an array_ref than<br></div>
<div>the previous proposal does. <br></div></div><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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--089e01493e42012c0604e61ff792--
.
Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Wed, 11 Sep 2013 12:01:07 -0700 (PDT)
Raw View
------=_Part_4368_11580694.1378926067729
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable
At present my head is busy of thinking about the proposal for the two-sided=
=20
list.:)
=20
=D3=D2=C5=C4=C1, 11 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 22:41:09 UTC+4 =D0=
=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Ville Voutilainen=20
=CE=C1=D0=C9=D3=C1=CC:=20
>
> On 11 September 2013 21:34, Vlad from Moscow <vlad....@mail.ru<javascript=
:>
> > wrote:
>
>> My idea differs. I do not want that array_ref would be immutable.
>> =20
>>
>>
>>
> Well, then just consider the previous proposal as a FYI that you need to=
=20
> refer to in a new
> proposal. You may need to make a stronger case for the need for an=20
> array_ref than
> the previous proposal does.=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/.
------=_Part_4368_11580694.1378926067729
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>At present my head is busy of thinking about&nbs=
p;the proposal for the two-sided list.:)</div><div> </div><div><br>=D3=
=D2=C5=C4=C1, 11 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 22:41:09 UTC+4 =
=D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Ville Voutilainen =CE=C1=D0=C9=D3=C1=
=CC: </div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px =
0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border=
-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr"><div><br><div=
class=3D"gmail_quote">On 11 September 2013 21:34, Vlad from Moscow <span d=
ir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mai=
lto=3D"tM58KeFNRsQJ">vlad....@mail.ru</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; paddi=
ng-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px=
; border-left-style: solid;"><div dir=3D"ltr"><div>My idea differs. I do no=
t want that array_ref would be immutable.</div><div> </div><div><br><b=
r></div>
</div></blockquote><div><br></div><div>Well, then just consider the previou=
s proposal as a FYI that you need to refer to in a new<br>proposal. You may=
need to make a stronger case for the need for an array_ref than<br></div>
<div>the previous proposal does. <br></div></div><br></div></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_4368_11580694.1378926067729--
.
Author: David Krauss <potswa@gmail.com>
Date: Thu, 12 Sep 2013 01:33:19 -0700 (PDT)
Raw View
------=_Part_368_26682005.1378974799469
Content-Type: text/plain; charset=ISO-8859-1
On Thursday, September 12, 2013 1:59:59 AM UTC+8, Vlad from Moscow wrote:
>
> You can pass std::array by reference if you already have an object of type
> std::array. And what to do if you have an ordinary array?
>
Is it against the aliasing rules to reinterpret_cast< std::array< int, 5 >
& >( five_ints )? It's all just POD after all; I never even thought about
the risk before.
http://ideone.com/h66rfa
--
---
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_368_26682005.1378974799469
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Thursday, September 12, 2013 1:59:59 AM UTC+8, =
Vlad from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div di=
r=3D"ltr"><div>You can pass std::array by reference if you already have an =
object of type std::array. And what to do if you have an ordinary array?</d=
iv></div></blockquote><div><br>Is it against the aliasing rules to <span st=
yle=3D"font-family: courier new,monospace;">reinterpret_cast< std::array=
< int, 5 > & >( five_ints )</span>? It's all just POD after al=
l; I never even thought about the risk before.<br><br>http://ideone.com/h66=
rfa<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_368_26682005.1378974799469--
.
Author: Daryle Walker <darylew@gmail.com>
Date: Thu, 12 Sep 2013 07:43:19 -0700 (PDT)
Raw View
------=_Part_156_29828215.1378996999726
Content-Type: text/plain; charset=ISO-8859-1
On Thursday, September 12, 2013 4:33:19 AM UTC-4, David Krauss wrote:
>
> On Thursday, September 12, 2013 1:59:59 AM UTC+8, Vlad from Moscow wrote:
>>
>> You can pass std::array by reference if you already have an object of
>> type std::array. And what to do if you have an ordinary array?
>>
>
> Is it against the aliasing rules to reinterpret_cast< std::array< int, 5
> > & >( five_ints )? It's all just POD after all; I never even thought
> about the risk before.
>
> http://ideone.com/h66rfa
>
The precise attribute to do this transformation is standard-layout.
Instantiations of the std::array class template do qualify, but only when
the element type is standard-layout! (If the element type isn't S.L., then
corresponding versions of array can't be either.)
Daryle W.
--
---
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_156_29828215.1378996999726
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, September 12, 2013 4:33:19 AM UTC-4, David Kr=
auss wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0=
..8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left=
-width: 1px; border-left-style: solid;"><div dir=3D"ltr">On Thursday, Septe=
mber 12, 2013 1:59:59 AM UTC+8, Vlad from Moscow wrote:<blockquote class=3D=
"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border=
-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style:=
solid;"><div dir=3D"ltr"><div>You can pass std::array by reference if you =
already have an object of type std::array. And what to do if you have an or=
dinary array?</div></div></blockquote><div><br>Is it against the aliasing r=
ules to <span style=3D"font-family: courier new,monospace;">reinterpret_cas=
t< std::array< int, 5 > & >( five_ints )</span>? It's all j=
ust POD after all; I never even thought about the risk before.<br><br><a hr=
ef=3D"http://ideone.com/h66rfa" target=3D"_blank">http://ideone.com/h66rfa<=
/a></div></div></blockquote><div> </div><div>The precise attribute to =
do this transformation is standard-layout. Instantiations of the <fon=
t face=3D"courier new,monospace">std::array</font> class template do qualif=
y, but only when the element type is standard-layout! (If the el=
ement type isn't S.L., then corresponding versions of <font face=3D"courier=
new,monospace">array</font> can't be either.)</div><div> </div><div>D=
aryle W.</div><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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_156_29828215.1378996999726--
.
Author: Nevin Liber <nevin@eviloverlord.com>
Date: Thu, 12 Sep 2013 09:59:43 -0500
Raw View
--047d7bd770586721d404e630fff1
Content-Type: text/plain; charset=ISO-8859-1
On 12 September 2013 09:43, Daryle Walker <darylew@gmail.com> wrote:
>
> Is it against the aliasing rules to reinterpret_cast< std::array< int, 5
>> > & >( five_ints )? It's all just POD after all; I never even thought
>> about the risk before.
>>
>> http://ideone.com/h66rfa
>>
>
> The precise attribute to do this transformation is standard-layout.
> Instantiations of the std::array class template do qualify, but only when
> the element type is standard-layout! (If the element type isn't S.L., then
> corresponding versions of array can't be either.)
>
Could you quote the relevant part of the standard which allows this type
punning? I haven't yet found wording which would allow this (this is not
to say it isn't; rather, I just don't know that it is).
We don't want to violate n3690 1.8p6 The C++ object model:
"Two objects that are not bit-fields may have the same address if one is a
subobject
of the other, or if at least one is a base class subobject of zero size and
they are of different types; otherwise,
they shall have distinct addresses."
(The undefined behavior group is wrestling with what is and isn't allowed
in type punning.)
--
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/.
--047d7bd770586721d404e630fff1
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On 12 September 2013 09:43, Daryle Walker <span dir=3D"ltr=
"><<a href=3D"mailto:darylew@gmail.com" target=3D"_blank">darylew@gmail.=
com</a>></span> wrote:<br><div class=3D"gmail_extra"><div class=3D"gmail=
_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex=
;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir=3D"ltr"><div class=3D"im"><br><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left:1px solid rgb(=
204,204,204)"><div dir=3D"ltr"><div>Is it against the aliasing rules to <sp=
an style=3D"font-family:courier new,monospace">reinterpret_cast< std::ar=
ray< int, 5 > & >( five_ints )</span>? It's all just POD a=
fter all; I never even thought about the risk before.<br>
<br><a href=3D"http://ideone.com/h66rfa" target=3D"_blank">http://ideone.co=
m/h66rfa</a></div></div></blockquote><div>=A0</div></div><div>The precise a=
ttribute to do this transformation is standard-layout.=A0 Instantiations of=
the <font face=3D"courier new,monospace">std::array</font> class template =
do qualify, but only when the element type is=A0standard-layout!=A0 (If the=
element type isn't S.L., then corresponding versions of <font face=3D"=
courier new,monospace">array</font> can't be either.)<br>
</div></div></blockquote><div><br></div><div>Could you quote the relevant p=
art of the standard which allows this type punning?=A0 I haven't yet fo=
und wording which would allow this (this is not to say it isn't; rather=
, I just don't know that it is).<br>
<br></div><div>We don't want to violate n3690 1.8p6 The C++ object mode=
l:<br><br>"Two objects that are not bit-fields may have the same addre=
ss if one is a subobject<br>of the other, or if at least one is a base clas=
s subobject of zero size and they are of different types; otherwise,<br>
they shall have distinct addresses."<br></div><div><br></div><div>(The=
undefined behavior group is wrestling with what is and isn't allowed i=
n type punning.)<br></div></div>-- <br>=A0Nevin ":-)" Liber=A0 &l=
t;mailto:<a href=3D"mailto:nevin@eviloverlord.com" target=3D"_blank">nevin@=
eviloverlord.com</a>>=A0 (847) 691-1404
</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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--047d7bd770586721d404e630fff1--
.
Author: Daryle Walker <darylew@gmail.com>
Date: Thu, 12 Sep 2013 10:42:18 -0700 (PDT)
Raw View
------=_Part_955_28358291.1379007738785
Content-Type: text/plain; charset=ISO-8859-1
On Thursday, September 12, 2013 10:59:43 AM UTC-4, Nevin ":-)" Liber wrote:
>
> On 12 September 2013 09:43, Daryle Walker <dar...@gmail.com <javascript:>>wrote:
>
>> Is it against the aliasing rules to reinterpret_cast< std::array< int, 5
>>> > & >( five_ints )? It's all just POD after all; I never even thought
>>> about the risk before.
>>>
>>> http://ideone.com/h66rfa
>>>
>>
>> The precise attribute to do this transformation is standard-layout.
>> Instantiations of the std::array class template do qualify, but only
>> when the element type is standard-layout! (If the element type isn't S.L.,
>> then corresponding versions of array can't be either.)
>>
>
> Could you quote the relevant part of the standard which allows this type
> punning? I haven't yet found wording which would allow this (this is not
> to say it isn't; rather, I just don't know that it is).
>
An array's address can be translated to the address of its first element in
4.2.
The address of an object of a non-empty standard-layout class type can be
translated to the address of the first non-static data member in 9.2/19.
Standard-layout class types are described in 9(.0)/7-9. The only way
std::array, skipping perverse user-defined (partial) specializations, can
be disqualified from being standard-layout is if its element type isn't
standard-layout.
> We don't want to violate n3690 1.8p6 The C++ object model:
>
> "Two objects that are not bit-fields may have the same address if one is a
> subobject
> of the other, or if at least one is a base class subobject of zero size
> and they are of different types; otherwise,
> they shall have distinct addresses."
> (The undefined behavior group is wrestling with what is and isn't allowed
> in type punning.)
>
Daryle W.
--
---
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_955_28358291.1379007738785
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, September 12, 2013 10:59:43 AM UTC-4, Nevin "=
:-)" Liber wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); borde=
r-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr">On 12 Septem=
ber 2013 09:43, Daryle Walker <span dir=3D"ltr"><<a href=3D"javascript:"=
target=3D"_blank" gdf-obfuscated-mailto=3D"jzFAKqd0M-IJ">dar...@gmail.com<=
/a>></span> wrote:<br><div><div class=3D"gmail_quote"><blockquote class=
=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; bor=
der-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-sty=
le: solid;">
<div dir=3D"ltr"><div><blockquote class=3D"gmail_quote" style=3D"margin: 0p=
x 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); =
border-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr"><div>Is=
it against the aliasing rules to <span style=3D"font-family: courier new,m=
onospace;">reinterpret_cast< std::array< int, 5 > & >( five=
_ints )</span>? It's all just POD after all; I never even thought about the=
risk before.<br>
<br><a href=3D"http://ideone.com/h66rfa" target=3D"_blank">http://ideone.co=
m/h66rfa</a></div></div></blockquote><div> </div></div><div>The precis=
e attribute to do this transformation is standard-layout. Instantiati=
ons of the <font face=3D"courier new,monospace">std::array</font> class tem=
plate do qualify, but only when the element type is standard-layout!&n=
bsp; (If the element type isn't S.L., then corresponding versions of <font =
face=3D"courier new,monospace">array</font> can't be either.)
</div></div></blockquote><div> </div><div>Could you quote the relevant=
part of the standard which allows this type punning? I haven't yet f=
ound wording which would allow this (this is not to say it isn't; rather, I=
just don't know that it is).</div></div></div></div></blockquote><div>&nbs=
p;</div><div>An array's address can be translated to the address of its fir=
st element in 4.2.</div><div> </div><div>The address of an object of a=
non-empty standard-layout class type can be translated to the address of t=
he first non-static data member in 9.2/19.</div><div> </div><div>Stand=
ard-layout class types are described in 9(.0)/7-9. The only way <font=
face=3D"courier new,monospace">std::array</font>, skipping perverse user-d=
efined (partial) specializations, can be disqualified from being standard-l=
ayout is if its element type isn't standard-layout.</div><div> </div><=
blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; paddin=
g-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px;=
border-left-style: solid;"><div dir=3D"ltr"><div><div class=3D"gmail_quote=
"><div>We don't want to violate n3690 1.8p6 The C++ object model:<br><br>"T=
wo objects that are not bit-fields may have the same address if one is a su=
bobject<br>of the other, or if at least one is a base class subobject of ze=
ro size and they are of different types; otherwise,<br>
they shall have distinct addresses."<br></div><div>(The undefined behavior =
group is wrestling with what is and isn't allowed in type punning.)</div></=
div></div></div></blockquote><div> </div><div>Daryle W.</div><div>&nbs=
p;</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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_955_28358291.1379007738785--
.
Author: Martinho Fernandes <martinho.fernandes@gmail.com>
Date: Fri, 13 Sep 2013 10:31:03 +0200
Raw View
----_com.android.email_1956434677409030
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
What am I missing here? A =A0array does not have a `std::array` as its firs=
t no-static data member.
Martinho
-------- Original message --------
From: Daryle Walker <darylew@gmail.com>=20
Date: =20
To: std-proposals@isocpp.org=20
Subject: Re: [std-proposals] array_ref - light-weight array=20
=20
On Thursday, September 12, 2013 10:59:43 AM UTC-4, Nevin ":-)" Liber wrote:
On 12 September 2013 09:43, Daryle Walker <dar...@gmail.com> wrote:
Is it against the aliasing rules to reinterpret_cast< std::array< int, 5 > =
& >( five_ints )? It's all just POD after all; I never even thought about t=
he risk before.
http://ideone.com/h66rfa
=A0
The precise attribute to do this transformation is standard-layout.=A0 Inst=
antiations of the std::array class template do qualify, but only when the e=
lement type is=A0standard-layout!=A0 (If the element type isn't S.L., then =
corresponding versions of array can't be either.)
=A0
Could you quote the relevant part of the standard which allows this type pu=
nning?=A0 I haven't yet found wording which would allow this (this is not t=
o say it isn't; rather, I just don't know that it is).
=A0
An array's address can be translated to the address of its first element in=
4.2.
=A0
The address of an object of a non-empty standard-layout class type can be t=
ranslated to the address of the first non-static data member in 9.2/19.
=A0
Standard-layout class types are described in 9(.0)/7-9.=A0 The only way std=
::array, skipping perverse user-defined (partial) specializations, can be d=
isqualified from being standard-layout is if its element type isn't standar=
d-layout.
=A0
We don't want to violate n3690 1.8p6 The C++ object model:
"Two objects that are not bit-fields may have the same address if one is a =
subobject
of the other, or if at least one is a base class subobject of zero size and=
they are of different types; otherwise,
they shall have distinct addresses."
(The undefined behavior group is wrestling with what is and isn't allowed i=
n type punning.)
=A0
Daryle W.
=A0
--=20
=A0
---=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
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/.
----_com.android.email_1956434677409030
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset=
=3DUTF-8"></head><body ><div>What am I missing here? A array does not=
have a `std::array` as its first no-static data member.</div><div><br></di=
v><div><br></div>Martinho <br><br><br>-------- Original message --------<br=
>From: Daryle Walker <darylew@gmail.com> <br>Date: <br>To: std-propo=
sals@isocpp.org <br>Subject: Re: [std-proposals] array_ref - light-weight a=
rray <br> <br><br><div dir=3D"ltr">On Thursday, September 12, 2013 10:59:43=
AM UTC-4, Nevin ":-)" Liber wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(20=
4, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir=
=3D"ltr">On 12 September 2013 09:43, Daryle Walker <span dir=3D"ltr"><<a=
href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"jzFAKqd0M-=
IJ">dar...@gmail.com</a>></span> wrote:<br><div><div class=3D"gmail_quot=
e"><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; pa=
dding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: =
1px; border-left-style: solid;">
<div dir=3D"ltr"><div><blockquote class=3D"gmail_quote" style=3D"margin: 0p=
x 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); =
border-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr"><div>Is=
it against the aliasing rules to <span style=3D"font-family: courier new,m=
onospace;">reinterpret_cast< std::array< int, 5 > & >( five=
_ints )</span>? It's all just POD after all; I never even thought about the=
risk before.<br>
<br><a href=3D"http://ideone.com/h66rfa" target=3D"_blank">http://ideone.co=
m/h66rfa</a></div></div></blockquote><div> </div></div><div>The precis=
e attribute to do this transformation is standard-layout. Instantiati=
ons of the <font face=3D"courier new,monospace">std::array</font> class tem=
plate do qualify, but only when the element type is standard-layout!&n=
bsp; (If the element type isn't S.L., then corresponding versions of <font =
face=3D"courier new,monospace">array</font> can't be either.)
</div></div></blockquote><div> </div><div>Could you quote the relevant=
part of the standard which allows this type punning? I haven't yet f=
ound wording which would allow this (this is not to say it isn't; rather, I=
just don't know that it is).</div></div></div></div></blockquote><div>&nbs=
p;</div><div>An array's address can be translated to the address of its fir=
st element in 4.2.</div><div> </div><div>The address of an object of a=
non-empty standard-layout class type can be translated to the address of t=
he first non-static data member in 9.2/19.</div><div> </div><div>Stand=
ard-layout class types are described in 9(.0)/7-9. The only way <font=
face=3D"courier new,monospace">std::array</font>, skipping perverse user-d=
efined (partial) specializations, can be disqualified from being standard-l=
ayout is if its element type isn't standard-layout.</div><div> </div><=
blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; paddin=
g-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px;=
border-left-style: solid;"><div dir=3D"ltr"><div><div class=3D"gmail_quote=
"><div>We don't want to violate n3690 1.8p6 The C++ object model:<br><br>"T=
wo objects that are not bit-fields may have the same address if one is a su=
bobject<br>of the other, or if at least one is a base class subobject of ze=
ro size and they are of different types; otherwise,<br>
they shall have distinct addresses."<br></div><div>(The undefined behavior =
group is wrestling with what is and isn't allowed in type punning.)</div></=
div></div></div></blockquote><div> </div><div>Daryle W.</div><div>&nbs=
p;</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 e=
mail to std-proposals+unsubscribe@isocpp.org.<br>
To post to this group, send email to std-proposals@isocpp.org.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br>
</body>
<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
----_com.android.email_1956434677409030--
.
Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Sun, 15 Sep 2013 09:46:08 -0700 (PDT)
Raw View
------=_Part_2349_27551792.1379263568342
Content-Type: text/plain; charset=ISO-8859-1
>
> When I made my point that it was not a good idea to introduce
> std::dynarray as a new name ( I think it should be part of std::vector
> declaration), I was assured that we were going to use array_ref as in
> formal parameter declaration, and there would be no problem in mixing
> various array classes when calling a function. Now we've got:
>
std::vector,
std::dynarray,
std::array
std::valarray.
There is no way to declare elegantly a function that would accept more than
two of these classes at the same time, unless we use the pointer to the
first element (back to pointers), in which case the length should be passed
as a separate parameter.
--
---
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_27551792.1379263568342
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); borde=
r-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr"><div>When I =
made my point that it was not a good idea to introduce std::dynarray as a n=
ew name ( I think it should be part of std::vector declaration), I was assu=
red that we were going to use array_ref as in formal parameter declaration,=
and there would be no problem in mixing various array classes when calling=
a function. Now we've got:<br></div></div></blockquote><div>std::vector,</=
div><div>std::dynarray,</div><div>std::array</div><div>std::valarray.</div>=
<div> </div><div>There is no way to declare elegantly a function that =
would accept more than two of these classes at the same time, unless we&nbs=
p;use the pointer to the first element (back to pointers), in which case th=
e length should be passed as a separate parameter.</div><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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_2349_27551792.1379263568342--
.
Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sat, 21 Sep 2013 08:04:46 -0700 (PDT)
Raw View
------=_Part_301_13999823.1379775886579
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable
So does it meam that the following code is valid?
=20
int a[N];
=20
std::array<int, N> *pa =3D reinterpret_cast<std::array<int, N> *>( a );
std::array<int, N> &ra =3D reinterpret_cast<std::array<int, N> &>( a );
=20
=20
=DE=C5=D4=D7=C5=D2=C7, 12 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 21:42:18 UTC+=
4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Daryle Walker=20
=CE=C1=D0=C9=D3=C1=CC:
> On Thursday, September 12, 2013 10:59:43 AM UTC-4, Nevin ":-)" Liber wrot=
e:
>>
>> On 12 September 2013 09:43, Daryle Walker <dar...@gmail.com> wrote:
>>
>>> Is it against the aliasing rules to reinterpret_cast< std::array< int,=
=20
>>>> 5 > & >( five_ints )? It's all just POD after all; I never even=20
>>>> thought about the risk before.
>>>>
>>>> http://ideone.com/h66rfa
>>>>
>>> =20
>>> The precise attribute to do this transformation is standard-layout. =20
>>> Instantiations of the std::array class template do qualify, but only=20
>>> when the element type is standard-layout! (If the element type isn't S=
..L.,=20
>>> then corresponding versions of array can't be either.)=20
>>>
>> =20
>> Could you quote the relevant part of the standard which allows this type=
=20
>> punning? I haven't yet found wording which would allow this (this is no=
t=20
>> to say it isn't; rather, I just don't know that it is).
>>
> =20
> An array's address can be translated to the address of its first element=
=20
> in 4.2.
> =20
> The address of an object of a non-empty standard-layout class type can be=
=20
> translated to the address of the first non-static data member in 9.2/19.
> =20
> Standard-layout class types are described in 9(.0)/7-9. The only way=20
> std::array, skipping perverse user-defined (partial) specializations, can=
=20
> be disqualified from being standard-layout is if its element type isn't=
=20
> standard-layout.
> =20
>
>> We don't want to violate n3690 1.8p6 The C++ object model:
>>
>> "Two objects that are not bit-fields may have the same address if one is=
=20
>> a subobject
>> of the other, or if at least one is a base class subobject of zero size=
=20
>> and they are of different types; otherwise,
>> they shall have distinct addresses."
>> (The undefined behavior group is wrestling with what is and isn't allowe=
d=20
>> in type punning.)
>>
> =20
> Daryle W.
> =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/.
------=_Part_301_13999823.1379775886579
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>So does it meam that the following code is valid?</di=
v><div> </div><div>int a[N];</div><div> </div><div>std::array<=
int, N> *pa =3D reinterpret_cast<std::array<int, N> *>( a );=
</div><div>std::array<int, N> &ra =3D reinterpret_cast<std::ar=
ray<int, N> &>( a );</div><div> </div><div> </div><d=
iv><br>=DE=C5=D4=D7=C5=D2=C7, 12 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 2=
1:42:18 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Daryle Walker =CE=C1=D0=
=C9=D3=C1=CC:</div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0=
px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); bor=
der-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr">On Thursda=
y, September 12, 2013 10:59:43 AM UTC-4, Nevin ":-)" Liber wrote:<blockquot=
e class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1=
ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-l=
eft-style: solid;"><div dir=3D"ltr">On 12 September 2013 09:43, Daryle Walk=
er <span dir=3D"ltr"><<a>dar...@gmail.com</a>></span> wrote:<br><div>=
<div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margi=
n: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 2=
04); border-left-width: 1px; border-left-style: solid;">
<div dir=3D"ltr"><div><blockquote class=3D"gmail_quote" style=3D"margin: 0p=
x 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); =
border-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr"><div>Is=
it against the aliasing rules to <span style=3D"font-family: courier new,m=
onospace;">reinterpret_cast< std::array< int, 5 > & >( five=
_ints )</span>? It's all just POD after all; I never even thought about the=
risk before.<br>
<br><a href=3D"http://ideone.com/h66rfa" target=3D"_blank">http://ideone.co=
m/h66rfa</a></div></div></blockquote><div> </div></div><div>The precis=
e attribute to do this transformation is standard-layout. Instantiati=
ons of the <font face=3D"courier new,monospace">std::array</font> class tem=
plate do qualify, but only when the element type is standard-layout!&n=
bsp; (If the element type isn't S.L., then corresponding versions of <font =
face=3D"courier new,monospace">array</font> can't be either.)
</div></div></blockquote><div> </div><div>Could you quote the relevant=
part of the standard which allows this type punning? I haven't yet f=
ound wording which would allow this (this is not to say it isn't; rather, I=
just don't know that it is).</div></div></div></div></blockquote><div>&nbs=
p;</div><div>An array's address can be translated to the address of its fir=
st element in 4.2.</div><div> </div><div>The address of an object of a=
non-empty standard-layout class type can be translated to the address of t=
he first non-static data member in 9.2/19.</div><div> </div><div>Stand=
ard-layout class types are described in 9(.0)/7-9. The only way <font=
face=3D"courier new,monospace">std::array</font>, skipping perverse user-d=
efined (partial) specializations, can be disqualified from being standard-l=
ayout is if its element type isn't standard-layout.</div><div> </div><=
blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; paddin=
g-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px;=
border-left-style: solid;"><div dir=3D"ltr"><div><div class=3D"gmail_quote=
"><div>We don't want to violate n3690 1.8p6 The C++ object model:<br><br>"T=
wo objects that are not bit-fields may have the same address if one is a su=
bobject<br>of the other, or if at least one is a base class subobject of ze=
ro size and they are of different types; otherwise,<br>
they shall have distinct addresses."<br></div><div>(The undefined behavior =
group is wrestling with what is and isn't allowed in type punning.)</div></=
div></div></div></blockquote><div> </div><div>Daryle W.</div><div>&nbs=
p;</div></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_301_13999823.1379775886579--
.