Topic: Token based access to private members in reflection
Author: inkwizytoryankes@gmail.com
Date: Thu, 12 Mar 2015 15:46:29 -0700 (PDT)
Raw View
------=_Part_23_680815646.1426200389606
Content-Type: multipart/alternative;
boundary="----=_Part_24_675691106.1426200389606"
------=_Part_24_675691106.1426200389606
Content-Type: text/plain; charset=UTF-8
I have idea of system that could be used of handling private data in
reflection.
First one, we add new template
template<typename T>
class private_access_token
{
using type = /* undefined */;
friend T;
};
And we add to `class_member::pointer` (like from n4113) new default
parameter:
template<typename T, size_t I, token = void>
struct pointer
{
private: //this line depend if I'th member is private
constexpr static SomeType T::* value = /* something */;
friend T;
};
template<typename T, size_t I>
struct pointer<T, I, typename private_access_token<T>::type >
{
public: //always public with token
constexpr static SomeType T::* value = /* something */;
friend T;
};
Thanks to that, class implementation can have control over private access
and allow sharing it to third party libraries without exposing private
fields to the wild.
Some class designer could even allow every one using it by exposing type
form token:
class A
{
int a;
public:
using PrivateToken = private_access_token<A>::type;
};
class B
{
int a;
int b;
public:
std::string to_string() { return third_party_func<private_access_token<B
>::type>(this); }
};
Do you think that could be good solution for that?
--
---
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_24_675691106.1426200389606
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I have idea of system that could be used of handling priva=
te data in reflection.<br><br>First one, we add new template<br><div class=
=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-colo=
r: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: b=
reak-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span=
style=3D"color: #008;" class=3D"styled-by-prettify">template</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">></span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">class</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> private_access_token<br></span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"><br> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> type </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"style=
d-by-prettify">/* undefined */</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br> </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">friend</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r></span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div=
></code></div><br><br>And we add to `class_member::pointer` (like from n411=
3) new default parameter:<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"prettypri=
nt"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">template</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify"><</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> size_t I<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> token </span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> pointer<br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">private</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: #800;" class=3D"styled-by-prettify">//this line depend=
if I'th member is private</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">constexpr</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">static</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify=
">SomeType</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::*</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> value </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #800;" class=3D"styled-by-prettify">/* something */</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">friend</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">template</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify"><</span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">typename</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> size_t I</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">></span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> pointer</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">T</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> I</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> private_ac=
cess_token</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
<</span><span style=3D"color: #000;" class=3D"styled-by-prettify">T</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">>::</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">type </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">public</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: #800;" class=3D"styled-by-pret=
tify">//always public with token</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br> </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">constexpr</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">static</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by=
-prettify">SomeType</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>::*</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> value=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #800;" class=3D"styled-by-prettify">/* something */</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br> </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">friend</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br><br></span></div></code></div><br><br><br>Thanks to=
that, class implementation can have control over private access and allow =
sharing it to third party libraries without exposing private fields to the =
wild.<br>Some class designer could even allow every one using it by exposin=
g type form token:<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"><di=
v class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-=
prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> A<br></span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbs=
p; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">public</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br> </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" c=
lass=3D"styled-by-prettify">PrivateToken</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> private_access_token</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">A</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">>::</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">type</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> B<br></span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br> </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br> </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> b</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">publ=
ic</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br> =
std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">string</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> to_string</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">()</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">return</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> third_party_func</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">private_access_token</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">B</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">>::</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">type</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">>(</span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>this</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"><br><br></span></div></code></div><br><br>Do =
you think that could be good solution for that?<br><br><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_24_675691106.1426200389606--
------=_Part_23_680815646.1426200389606--
.
Author: Cleiton Santoia <cleitonsantoia@gmail.com>
Date: Thu, 12 Mar 2015 16:22:15 -0700 (PDT)
Raw View
------=_Part_92_390065066.1426202535546
Content-Type: multipart/alternative;
boundary="----=_Part_93_1703473618.1426202535547"
------=_Part_93_1703473618.1426202535547
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
In this document http://random.m-ou.se/reflectionfeedbackurbana.html yo=
u=20
will find :
Opt-in to unsafe reflection from the class under reflection:
SFFNASA543102
Em quinta-feira, 12 de mar=C3=A7o de 2015 19:46:29 UTC-3, inkwizyt...@gmail=
..com=20
escreveu:
>
> I have idea of system that could be used of handling private data in=20
> reflection.
>
> First one, we add new template
> template<typename T>
> class private_access_token
> {
> using type =3D /* undefined */;
> friend T;
> };
>
>
> And we add to `class_member::pointer` (like from n4113) new default=20
> parameter:
> template<typename T, size_t I, token =3D void>
> struct pointer
> {
> private: //this line depend if I'th member is private
> constexpr static SomeType T::* value =3D /* something */;
> friend T;
> };
>
> template<typename T, size_t I>
> struct pointer<T, I, typename private_access_token<T>::type >
> {
> public: //always public with token
> constexpr static SomeType T::* value =3D /* something */;
> friend T;
> };
>
>
>
>
> Thanks to that, class implementation can have control over private access=
=20
> and allow sharing it to third party libraries without exposing private=20
> fields to the wild.
> Some class designer could even allow every one using it by exposing type=
=20
> form token:
> class A
> {
> int a;
> public:
> using PrivateToken =3D private_access_token<A>::type;
> };
>
> class B
> {
> int a;
> int b;
> public:
> std::string to_string() { return third_party_func<private_access_toke=
n
> <B>::type>(this); }
> };
>
>
>
> Do you think that could be good solution for that?
>
>
>
--=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_93_1703473618.1426202535547
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><br></div><div><br></div><div><br></div><div> &=
nbsp; In this document <a href=3D"http://random.m-ou.se/reflectionfeed=
backurbana.html">http://random.m-ou.se/reflectionfeedbackurbana.html</a>&nb=
sp;you will find :<br></div><div><br></div><div><br></div><div><p style=3D"=
margin-left: 4pc; margin-right: 3pc; color: rgb(0, 0, 0); font-family: sans=
-serif; font-size: small; line-height: 18.2000007629395px;">Opt-in to unsaf=
e reflection from the class under reflection:</p><table style=3D"margin-lef=
t: auto; margin-right: auto; border-collapse: collapse; color: rgb(0, 0, 0)=
; font-family: sans-serif; font-size: small; line-height: 18.2000007629395p=
x;"><thead><tr class=3D"header"><th align=3D"left" style=3D"text-align: cen=
ter; font-weight: bold; border: 1px solid rgb(211, 211, 211); padding: 4pt;=
background: rgb(238, 238, 238);">SF</th><th align=3D"left" style=3D"text-a=
lign: center; font-weight: bold; border: 1px solid rgb(211, 211, 211); padd=
ing: 4pt; background: rgb(238, 238, 238);">F</th><th align=3D"left" style=
=3D"text-align: center; font-weight: bold; border: 1px solid rgb(211, 211, =
211); padding: 4pt; background: rgb(238, 238, 238);">N</th><th align=3D"lef=
t" style=3D"text-align: center; font-weight: bold; border: 1px solid rgb(21=
1, 211, 211); padding: 4pt; background: rgb(238, 238, 238);">A</th><th alig=
n=3D"left" style=3D"text-align: center; font-weight: bold; border: 1px soli=
d rgb(211, 211, 211); padding: 4pt; background: rgb(238, 238, 238);">SA</th=
></tr></thead><tbody><tr class=3D"odd"><td align=3D"left" style=3D"border: =
1px solid rgb(211, 211, 211); padding: 4pt;">5</td><td align=3D"left" style=
=3D"border: 1px solid rgb(211, 211, 211); padding: 4pt;">4</td><td align=3D=
"left" style=3D"border: 1px solid rgb(211, 211, 211); padding: 4pt;">3</td>=
<td align=3D"left" style=3D"border: 1px solid rgb(211, 211, 211); padding: =
4pt;">10</td><td align=3D"left" style=3D"border: 1px solid rgb(211, 211, 21=
1); padding: 4pt;">2<br><br></td></tr></tbody></table></div><div><br></div>=
<div><br>Em quinta-feira, 12 de mar=C3=A7o de 2015 19:46:29 UTC-3, inkwizyt=
....@gmail.com escreveu:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div d=
ir=3D"ltr">I have idea of system that could be used of handling private dat=
a in reflection.<br><br>First one, we add new template<br><div style=3D"bac=
kground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:s=
olid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color=
:#008">template</span><span style=3D"color:#660"><</span><span style=3D"=
color:#008">typename</span><span style=3D"color:#000"> T</span><span style=
=3D"color:#660">></span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">class</span><span style=3D"color:#000"> private_access_tok=
en<br></span><span style=3D"color:#660">{</span><span style=3D"color:#000">=
<br> </span><span style=3D"color:#008">using</span><span style=
=3D"color:#000"> type </span><span style=3D"color:#660">=3D</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#800">/* undefined */</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#000"><br> &n=
bsp; </span><span style=3D"color:#008">friend</span><span style=3D"color:#0=
00"> T</span><span style=3D"color:#660">;</span><span style=3D"color:#000">=
<br></span><span style=3D"color:#660">};</span><span style=3D"color:#000"><=
br></span></div></code></div><br><br>And we add to `class_member::pointer` =
(like from n4113) new default parameter:<br><div style=3D"background-color:=
rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-wi=
dth:1px;word-wrap:break-word"><code><div><span style=3D"color:#008">templat=
e</span><span style=3D"color:#660"><</span><span style=3D"color:#008">ty=
pename</span><span style=3D"color:#000"> T</span><span style=3D"color:#660"=
>,</span><span style=3D"color:#000"> size_t I</span><span style=3D"color:#6=
60">,</span><span style=3D"color:#000"> token </span><span style=3D"color:#=
660">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#008=
">void</span><span style=3D"color:#660">></span><span style=3D"color:#00=
0"><br></span><span style=3D"color:#008">struct</span><span style=3D"color:=
#000"> pointer<br></span><span style=3D"color:#660">{</span><span style=3D"=
color:#000"><br></span><span style=3D"color:#008">private</span><span style=
=3D"color:#660">:</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#800">//this line depend if I'th member is private</span><span style=
=3D"color:#000"><br> </span><span style=3D"color:#008">constex=
pr</span><span style=3D"color:#000"> </span><span style=3D"color:#008">stat=
ic</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Some=
Type</span><span style=3D"color:#000"> T</span><span style=3D"color:#660">:=
:*</span><span style=3D"color:#000"> value </span><span style=3D"color:#660=
">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#800">/=
* something */</span><span style=3D"color:#660">;</span><span style=3D"colo=
r:#000"><br> </span><span style=3D"color:#008">friend</span><s=
pan style=3D"color:#000"> T</span><span style=3D"color:#660">;</span><span =
style=3D"color:#000"><br></span><span style=3D"color:#660">};</span><span s=
tyle=3D"color:#000"><br><br></span><span style=3D"color:#008">template</spa=
n><span style=3D"color:#660"><</span><span style=3D"color:#008">typename=
</span><span style=3D"color:#000"> T</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> size_t I</span><span style=3D"color:#660">&g=
t;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">s=
truct</span><span style=3D"color:#000"> pointer</span><span style=3D"color:=
#660"><</span><span style=3D"color:#000">T</span><span style=3D"color:#6=
60">,</span><span style=3D"color:#000"> I</span><span style=3D"color:#660">=
,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">typen=
ame</span><span style=3D"color:#000"> private_access_token</span><span styl=
e=3D"color:#660"><</span><span style=3D"color:#000">T</span><span style=
=3D"color:#660">>::</span><span style=3D"color:#000">type </span><span s=
tyle=3D"color:#660">></span><span style=3D"color:#000"><br></span><span =
style=3D"color:#660">{</span><span style=3D"color:#000"><br></span><span st=
yle=3D"color:#008">public</span><span style=3D"color:#660">:</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#800">//always public with =
token</span><span style=3D"color:#000"><br> </span><span style=
=3D"color:#008">constexpr</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#008">static</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#606">SomeType</span><span style=3D"color:#000"> T</span><span=
style=3D"color:#660">::*</span><span style=3D"color:#000"> value </span><s=
pan style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span=
style=3D"color:#800">/* something */</span><span style=3D"color:#660">;</s=
pan><span style=3D"color:#000"><br> </span><span style=3D"colo=
r:#008">friend</span><span style=3D"color:#000"> T</span><span style=3D"col=
or:#660">;</span><span style=3D"color:#000"><br></span><span style=3D"color=
:#660">};</span><span style=3D"color:#000"><br><br></span></div></code></di=
v><br><br><br>Thanks to that, class implementation can have control over pr=
ivate access and allow sharing it to third party libraries without exposing=
private fields to the wild.<br>Some class designer could even allow every =
one using it by exposing type form token:<br><div style=3D"background-color=
:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-w=
idth:1px;word-wrap:break-word"><code><div><span style=3D"color:#008">class<=
/span><span style=3D"color:#000"> A<br></span><span style=3D"color:#660">{<=
/span><span style=3D"color:#000"><br> </span><span style=3D"co=
lor:#008">int</span><span style=3D"color:#000"> a</span><span style=3D"colo=
r:#660">;</span><span style=3D"color:#000"><br></span><span style=3D"color:=
#008">public</span><span style=3D"color:#660">:</span><span style=3D"color:=
#000"><br> </span><span style=3D"color:#008">using</span><span=
style=3D"color:#000"> </span><span style=3D"color:#606">PrivateToken</span=
><span style=3D"color:#000"> </span><span style=3D"color:#660">=3D</span><s=
pan style=3D"color:#000"> private_access_token</span><span style=3D"color:#=
660"><</span><span style=3D"color:#000">A</span><span style=3D"color:#66=
0">>::</span><span style=3D"color:#000">type</span><span style=3D"color:=
#660">;</span><span style=3D"color:#000"><br></span><span style=3D"color:#6=
60">};</span><span style=3D"color:#000"><br><br></span><span style=3D"color=
:#008">class</span><span style=3D"color:#000"> B<br></span><span style=3D"c=
olor:#660">{</span><span style=3D"color:#000"><br> </span><spa=
n style=3D"color:#008">int</span><span style=3D"color:#000"> a</span><span =
style=3D"color:#660">;</span><span style=3D"color:#000"><br> <=
/span><span style=3D"color:#008">int</span><span style=3D"color:#000"> b</s=
pan><span style=3D"color:#660">;</span><span style=3D"color:#000"><br></spa=
n><span style=3D"color:#008">public</span><span style=3D"color:#660">:</spa=
n><span style=3D"color:#000"><br> std</span><span style=3D"col=
or:#660">::</span><span style=3D"color:#008">string</span><span style=3D"co=
lor:#000"> to_string</span><span style=3D"color:#660">()</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">{</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#008">return</span><span style=3D"c=
olor:#000"> third_party_func</span><span style=3D"color:#660"><</span><s=
pan style=3D"color:#000">private_<wbr>access_token</span><span style=3D"col=
or:#660"><</span><span style=3D"color:#000">B</span><span style=3D"color=
:#660">>::</span><span style=3D"color:#000">type</span><span style=3D"co=
lor:#660">>(</span><span style=3D"color:#008">this</span><span style=3D"=
color:#660">);</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#660">}</span><span style=3D"color:#000"><br></span><span style=3D"color:=
#660">};</span><span style=3D"color:#000"><br><br></span></div></code></div=
><br><br>Do you think that could be good solution for that?<br><br><br></di=
v></blockquote></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_93_1703473618.1426202535547--
------=_Part_92_390065066.1426202535546--
.
Author: inkwizytoryankes@gmail.com
Date: Fri, 13 Mar 2015 14:25:11 -0700 (PDT)
Raw View
------=_Part_837_985633932.1426281911699
Content-Type: multipart/alternative;
boundary="----=_Part_838_2008125813.1426281911699"
------=_Part_838_2008125813.1426281911699
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Do you know why people was against this approach?
On Friday, March 13, 2015 at 12:22:15 AM UTC+1, Cleiton Santoia wrote:
>
>
>
>
> In this document http://random.m-ou.se/reflectionfeedbackurbana.html =
you=20
> will find :
>
>
> Opt-in to unsafe reflection from the class under reflection:
> SFFNASA543102
>
>
>
> Em quinta-feira, 12 de mar=C3=A7o de 2015 19:46:29 UTC-3, inkwizyt...@gma=
il.com=20
> escreveu:
>>
>> I have idea of system that could be used of handling private data in=20
>> reflection.
>>
>> First one, we add new template
>> template<typename T>
>> class private_access_token
>> {
>> using type =3D /* undefined */;
>> friend T;
>> };
>>
>>
>> And we add to `class_member::pointer` (like from n4113) new default=20
>> parameter:
>> template<typename T, size_t I, token =3D void>
>> struct pointer
>> {
>> private: //this line depend if I'th member is private
>> constexpr static SomeType T::* value =3D /* something */;
>> friend T;
>> };
>>
>> template<typename T, size_t I>
>> struct pointer<T, I, typename private_access_token<T>::type >
>> {
>> public: //always public with token
>> constexpr static SomeType T::* value =3D /* something */;
>> friend T;
>> };
>>
>>
>>
>>
>> Thanks to that, class implementation can have control over private acces=
s=20
>> and allow sharing it to third party libraries without exposing private=
=20
>> fields to the wild.
>> Some class designer could even allow every one using it by exposing type=
=20
>> form token:
>> class A
>> {
>> int a;
>> public:
>> using PrivateToken =3D private_access_token<A>::type;
>> };
>>
>> class B
>> {
>> int a;
>> int b;
>> public:
>> std::string to_string() { return third_party_func<
>> private_access_token<B>::type>(this); }
>> };
>>
>>
>>
>> Do you think that could be good solution for that?
>>
>>
>>
--=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_838_2008125813.1426281911699
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Do you know why people was against this approach?<br><br>O=
n Friday, March 13, 2015 at 12:22:15 AM UTC+1, Cleiton Santoia wrote:<block=
quote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-le=
ft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><br></div><div=
><br></div><div><br></div><div> In this document <a href=
=3D"http://random.m-ou.se/reflectionfeedbackurbana.html" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75=
http%3A%2F%2Frandom.m-ou.se%2Freflectionfeedbackurbana.html\46sa\75D\46sntz=
\0751\46usg\75AFQjCNFE655tqFygttII-m54Ge_tnol1GA';return true;" onclick=3D"=
this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Frandom.m-ou.se%2Fre=
flectionfeedbackurbana.html\46sa\75D\46sntz\0751\46usg\75AFQjCNFE655tqFygtt=
II-m54Ge_tnol1GA';return true;">http://random.m-ou.<wbr>se/reflectionfeedba=
ckurbana.<wbr>html</a> you will find :<br></div><div><br></div><div><b=
r></div><div><p style=3D"margin-left:4pc;margin-right:3pc;color:rgb(0,0,0);=
font-family:sans-serif;font-size:small;line-height:18.2000007629395px">Opt-=
in to unsafe reflection from the class under reflection:</p><table style=3D=
"margin-left:auto;margin-right:auto;border-collapse:collapse;color:rgb(0,0,=
0);font-family:sans-serif;font-size:small;line-height:18.2000007629395px"><=
thead><tr><th style=3D"text-align:center;font-weight:bold;border:1px solid =
rgb(211,211,211);padding:4pt;background:rgb(238,238,238)" align=3D"left">SF=
</th><th style=3D"text-align:center;font-weight:bold;border:1px solid rgb(2=
11,211,211);padding:4pt;background:rgb(238,238,238)" align=3D"left">F</th><=
th style=3D"text-align:center;font-weight:bold;border:1px solid rgb(211,211=
,211);padding:4pt;background:rgb(238,238,238)" align=3D"left">N</th><th sty=
le=3D"text-align:center;font-weight:bold;border:1px solid rgb(211,211,211);=
padding:4pt;background:rgb(238,238,238)" align=3D"left">A</th><th style=3D"=
text-align:center;font-weight:bold;border:1px solid rgb(211,211,211);paddin=
g:4pt;background:rgb(238,238,238)" align=3D"left">SA</th></tr></thead><tbod=
y><tr><td style=3D"border:1px solid rgb(211,211,211);padding:4pt" align=3D"=
left">5</td><td style=3D"border:1px solid rgb(211,211,211);padding:4pt" ali=
gn=3D"left">4</td><td style=3D"border:1px solid rgb(211,211,211);padding:4p=
t" align=3D"left">3</td><td style=3D"border:1px solid rgb(211,211,211);padd=
ing:4pt" align=3D"left">10</td><td style=3D"border:1px solid rgb(211,211,21=
1);padding:4pt" align=3D"left">2<br><br></td></tr></tbody></table></div><di=
v><br></div><div><br>Em quinta-feira, 12 de mar=C3=A7o de 2015 19:46:29 UTC=
-3, <a>inkwizyt...@gmail.com</a> escreveu:<blockquote class=3D"gmail_quote=
" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-le=
ft:1ex"><div dir=3D"ltr">I have idea of system that could be used of handli=
ng private data in reflection.<br><br>First one, we add new template<br><di=
v 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><div><span =
style=3D"color:#008">template</span><span style=3D"color:#660"><</span><=
span style=3D"color:#008">typename</span><span style=3D"color:#000"> T</spa=
n><span style=3D"color:#660">></span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#008">class</span><span style=3D"color:#000"> priva=
te_access_token<br></span><span style=3D"color:#660">{</span><span style=3D=
"color:#000"><br> </span><span style=3D"color:#008">using</spa=
n><span style=3D"color:#000"> type </span><span style=3D"color:#660">=3D</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#800">/* undefi=
ned */</span><span style=3D"color:#660">;</span><span style=3D"color:#000">=
<br> </span><span style=3D"color:#008">friend</span><span styl=
e=3D"color:#000"> T</span><span style=3D"color:#660">;</span><span style=3D=
"color:#000"><br></span><span style=3D"color:#660">};</span><span style=3D"=
color:#000"><br></span></div></code></div><br><br>And we add to `class_memb=
er::pointer` (like from n4113) new default parameter:<br><div style=3D"back=
ground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:so=
lid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:=
#008">template</span><span style=3D"color:#660"><</span><span style=3D"c=
olor:#008">typename</span><span style=3D"color:#000"> T</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> size_t I</span><span st=
yle=3D"color:#660">,</span><span style=3D"color:#000"> token </span><span s=
tyle=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#008">void</span><span style=3D"color:#660">></span><span sty=
le=3D"color:#000"><br></span><span style=3D"color:#008">struct</span><span =
style=3D"color:#000"> pointer<br></span><span style=3D"color:#660">{</span>=
<span style=3D"color:#000"><br></span><span style=3D"color:#008">private</s=
pan><span style=3D"color:#660">:</span><span style=3D"color:#000"> </span><=
span style=3D"color:#800">//this line depend if I'th member is private</spa=
n><span style=3D"color:#000"><br> </span><span style=3D"color:=
#008">constexpr</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#008">static</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#606">SomeType</span><span style=3D"color:#000"> T</span><span style=3D"=
color:#660">::*</span><span style=3D"color:#000"> value </span><span style=
=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span style=3D=
"color:#800">/* something */</span><span style=3D"color:#660">;</span><span=
style=3D"color:#000"><br> </span><span style=3D"color:#008">f=
riend</span><span style=3D"color:#000"> T</span><span style=3D"color:#660">=
;</span><span style=3D"color:#000"><br></span><span style=3D"color:#660">};=
</span><span style=3D"color:#000"><br><br></span><span style=3D"color:#008"=
>template</span><span style=3D"color:#660"><</span><span style=3D"color:=
#008">typename</span><span style=3D"color:#000"> T</span><span style=3D"col=
or:#660">,</span><span style=3D"color:#000"> size_t I</span><span style=3D"=
color:#660">></span><span style=3D"color:#000"><br></span><span style=3D=
"color:#008">struct</span><span style=3D"color:#000"> pointer</span><span s=
tyle=3D"color:#660"><</span><span style=3D"color:#000">T</span><span sty=
le=3D"color:#660">,</span><span style=3D"color:#000"> I</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#008">typename</span><span style=3D"color:#000"> private_access_token<=
/span><span style=3D"color:#660"><</span><span style=3D"color:#000">T</s=
pan><span style=3D"color:#660">>::</span><span style=3D"color:#000">type=
</span><span style=3D"color:#660">></span><span style=3D"color:#000"><b=
r></span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=
</span><span style=3D"color:#008">public</span><span style=3D"color:#660">:=
</span><span style=3D"color:#000"> </span><span style=3D"color:#800">//alwa=
ys public with token</span><span style=3D"color:#000"><br> </s=
pan><span style=3D"color:#008">constexpr</span><span style=3D"color:#000"> =
</span><span style=3D"color:#008">static</span><span style=3D"color:#000"> =
</span><span style=3D"color:#606">SomeType</span><span style=3D"color:#000"=
> T</span><span style=3D"color:#660">::*</span><span style=3D"color:#000"> =
value </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000=
"> </span><span style=3D"color:#800">/* something */</span><span style=3D"c=
olor:#660">;</span><span style=3D"color:#000"><br> </span><spa=
n style=3D"color:#008">friend</span><span style=3D"color:#000"> T</span><sp=
an style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><span=
style=3D"color:#660">};</span><span style=3D"color:#000"><br><br></span></=
div></code></div><br><br><br>Thanks to that, class implementation can have =
control over private access and allow sharing it to third party libraries w=
ithout exposing private fields to the wild.<br>Some class designer could ev=
en allow every one using it by exposing type form token:<br><div style=3D"b=
ackground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style=
:solid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"col=
or:#008">class</span><span style=3D"color:#000"> A<br></span><span style=3D=
"color:#660">{</span><span style=3D"color:#000"><br> </span><s=
pan style=3D"color:#008">int</span><span style=3D"color:#000"> a</span><spa=
n style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><span =
style=3D"color:#008">public</span><span style=3D"color:#660">:</span><span =
style=3D"color:#000"><br> </span><span style=3D"color:#008">us=
ing</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Pri=
vateToken</span><span style=3D"color:#000"> </span><span style=3D"color:#66=
0">=3D</span><span style=3D"color:#000"> private_access_token</span><span s=
tyle=3D"color:#660"><</span><span style=3D"color:#000">A</span><span sty=
le=3D"color:#660">>::</span><span style=3D"color:#000">type</span><span =
style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><span st=
yle=3D"color:#660">};</span><span style=3D"color:#000"><br><br></span><span=
style=3D"color:#008">class</span><span style=3D"color:#000"> B<br></span><=
span style=3D"color:#660">{</span><span style=3D"color:#000"><br> &nb=
sp; </span><span style=3D"color:#008">int</span><span style=3D"color:#000">=
a</span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=
</span><span style=3D"color:#008">int</span><span style=3D"co=
lor:#000"> b</span><span style=3D"color:#660">;</span><span style=3D"color:=
#000"><br></span><span style=3D"color:#008">public</span><span style=3D"col=
or:#660">:</span><span style=3D"color:#000"><br> std</span><sp=
an style=3D"color:#660">::</span><span style=3D"color:#008">string</span><s=
pan style=3D"color:#000"> to_string</span><span style=3D"color:#660">()</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#660">{</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#008">return</span><s=
pan style=3D"color:#000"> third_party_func</span><span style=3D"color:#660"=
><</span><span style=3D"color:#000">private_<wbr>access_token</span><spa=
n style=3D"color:#660"><</span><span style=3D"color:#000">B</span><span =
style=3D"color:#660">>::</span><span style=3D"color:#000">type</span><sp=
an style=3D"color:#660">>(</span><span style=3D"color:#008">this</span><=
span style=3D"color:#660">);</span><span style=3D"color:#000"> </span><span=
style=3D"color:#660">}</span><span style=3D"color:#000"><br></span><span s=
tyle=3D"color:#660">};</span><span style=3D"color:#000"><br><br></span></di=
v></code></div><br><br>Do you think that could be good solution for that?<b=
r><br><br></div></blockquote></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 <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_838_2008125813.1426281911699--
------=_Part_837_985633932.1426281911699--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 13 Mar 2015 23:44:07 +0200
Raw View
--001a1130c3fa68d96f0511326613
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On 13 March 2015 at 23:25, <inkwizytoryankes@gmail.com> wrote:
> Do you know why people was against this approach?
>
There is a desire to use reflection on legacy types that would be infeasibl=
e
to modify to contain such a token.
>
>
> On Friday, March 13, 2015 at 12:22:15 AM UTC+1, Cleiton Santoia wrote:
>>
>>
>>
>>
>> In this document http://random.m-ou.se/reflectionfeedbackurbana.html=
you
>> will find :
>>
>>
>> Opt-in to unsafe reflection from the class under reflection:
>> SFFNASA543102
>>
>>
>>
>> Em quinta-feira, 12 de mar=C3=A7o de 2015 19:46:29 UTC-3,
>> inkwizyt...@gmail.com escreveu:
>>>
>>> I have idea of system that could be used of handling private data in
>>> reflection.
>>>
>>> First one, we add new template
>>> template<typename T>
>>> class private_access_token
>>> {
>>> using type =3D /* undefined */;
>>> friend T;
>>> };
>>>
>>>
>>> And we add to `class_member::pointer` (like from n4113) new default
>>> parameter:
>>> template<typename T, size_t I, token =3D void>
>>> struct pointer
>>> {
>>> private: //this line depend if I'th member is private
>>> constexpr static SomeType T::* value =3D /* something */;
>>> friend T;
>>> };
>>>
>>> template<typename T, size_t I>
>>> struct pointer<T, I, typename private_access_token<T>::type >
>>> {
>>> public: //always public with token
>>> constexpr static SomeType T::* value =3D /* something */;
>>> friend T;
>>> };
>>>
>>>
>>>
>>>
>>> Thanks to that, class implementation can have control over private
>>> access and allow sharing it to third party libraries without exposing
>>> private fields to the wild.
>>> Some class designer could even allow every one using it by exposing typ=
e
>>> form token:
>>> class A
>>> {
>>> int a;
>>> public:
>>> using PrivateToken =3D private_access_token<A>::type;
>>> };
>>>
>>> class B
>>> {
>>> int a;
>>> int b;
>>> public:
>>> std::string to_string() { return third_party_func<private_
>>> access_token<B>::type>(this); }
>>> };
>>>
>>>
>>>
>>> Do you think that could be good solution for that?
>>>
>>>
>>> --
>
> ---
> 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/.
--001a1130c3fa68d96f0511326613
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On 13 March 2015 at 23:25, <span dir=3D"ltr"><<a href=3D"mailto:ink=
wizytoryankes@gmail.com" target=3D"_blank">inkwizytoryankes@gmail.com</a>&g=
t;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0=
.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Do you =
know why people was against this approach?</div></blockquote><div><br></div=
><div>There is a desire to use reflection on legacy types that would be inf=
easible<br></div><div>to modify to contain such a token.<br>=C2=A0<br></div=
><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1=
px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><div class=3D"h5"><br=
><br>On Friday, March 13, 2015 at 12:22:15 AM UTC+1, Cleiton Santoia wrote:=
<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><br></div><di=
v><br></div><div><br></div><div>=C2=A0 =C2=A0 In this document=C2=A0<a href=
=3D"http://random.m-ou.se/reflectionfeedbackurbana.html" rel=3D"nofollow" t=
arget=3D"_blank">http://random.m-ou.<u></u>se/reflectionfeedbackurbana.<u><=
/u>html</a>=C2=A0you will find :<br></div><div><br></div><div><br></div><di=
v><p style=3D"margin-left:4pc;margin-right:3pc;color:rgb(0,0,0);font-family=
:sans-serif;font-size:small;line-height:18.2000007629395px">Opt-in to unsaf=
e reflection from the class under reflection:</p><table style=3D"margin-lef=
t:auto;margin-right:auto;border-collapse:collapse;color:rgb(0,0,0);font-fam=
ily:sans-serif;font-size:small;line-height:18.2000007629395px"><thead><tr><=
th style=3D"text-align:center;font-weight:bold;border:1px solid rgb(211,211=
,211);padding:4pt;background:rgb(238,238,238)" align=3D"left">SF</th><th st=
yle=3D"text-align:center;font-weight:bold;border:1px solid rgb(211,211,211)=
;padding:4pt;background:rgb(238,238,238)" align=3D"left">F</th><th style=3D=
"text-align:center;font-weight:bold;border:1px solid rgb(211,211,211);paddi=
ng:4pt;background:rgb(238,238,238)" align=3D"left">N</th><th style=3D"text-=
align:center;font-weight:bold;border:1px solid rgb(211,211,211);padding:4pt=
;background:rgb(238,238,238)" align=3D"left">A</th><th style=3D"text-align:=
center;font-weight:bold;border:1px solid rgb(211,211,211);padding:4pt;backg=
round:rgb(238,238,238)" align=3D"left">SA</th></tr></thead><tbody><tr><td s=
tyle=3D"border:1px solid rgb(211,211,211);padding:4pt" align=3D"left">5</td=
><td style=3D"border:1px solid rgb(211,211,211);padding:4pt" align=3D"left"=
>4</td><td style=3D"border:1px solid rgb(211,211,211);padding:4pt" align=3D=
"left">3</td><td style=3D"border:1px solid rgb(211,211,211);padding:4pt" al=
ign=3D"left">10</td><td style=3D"border:1px solid rgb(211,211,211);padding:=
4pt" align=3D"left">2<br><br></td></tr></tbody></table></div><div><br></div=
><div><br>Em quinta-feira, 12 de mar=C3=A7o de 2015 19:46:29 UTC-3, <a>inkw=
izyt...@gmail.com</a> escreveu:<blockquote class=3D"gmail_quote" style=3D"=
margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><di=
v dir=3D"ltr">I have idea of system that could be used of handling private =
data in reflection.<br><br>First one, we add new template<br><div style=3D"=
background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-styl=
e:solid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"co=
lor:#008">template</span><span style=3D"color:#660"><</span><span style=
=3D"color:#008">typename</span><span style=3D"color:#000"> T</span><span st=
yle=3D"color:#660">></span><span style=3D"color:#000"><br></span><span s=
tyle=3D"color:#008">class</span><span style=3D"color:#000"> private_access_=
token<br></span><span style=3D"color:#660">{</span><span style=3D"color:#00=
0"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">using</span><span st=
yle=3D"color:#000"> type </span><span style=3D"color:#660">=3D</span><span =
style=3D"color:#000"> </span><span style=3D"color:#800">/* undefined */</sp=
an><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0=
=C2=A0 </span><span style=3D"color:#008">friend</span><span style=3D"color=
:#000"> T</span><span style=3D"color:#660">;</span><span style=3D"color:#00=
0"><br></span><span style=3D"color:#660">};</span><span style=3D"color:#000=
"><br></span></div></code></div><br><br>And we add to `class_member::pointe=
r` (like from n4113) new default parameter:<br><div style=3D"background-col=
or:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border=
-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#008">temp=
late</span><span style=3D"color:#660"><</span><span style=3D"color:#008"=
>typename</span><span style=3D"color:#000"> T</span><span style=3D"color:#6=
60">,</span><span style=3D"color:#000"> size_t I</span><span style=3D"color=
:#660">,</span><span style=3D"color:#000"> token </span><span style=3D"colo=
r:#660">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#=
008">void</span><span style=3D"color:#660">></span><span style=3D"color:=
#000"><br></span><span style=3D"color:#008">struct</span><span style=3D"col=
or:#000"> pointer<br></span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#008">private</span><span s=
tyle=3D"color:#660">:</span><span style=3D"color:#000"> </span><span style=
=3D"color:#800">//this line depend if I'th member is private</span><spa=
n style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">=
constexpr</span><span style=3D"color:#000"> </span><span style=3D"color:#00=
8">static</span><span style=3D"color:#000"> </span><span style=3D"color:#60=
6">SomeType</span><span style=3D"color:#000"> T</span><span style=3D"color:=
#660">::*</span><span style=3D"color:#000"> value </span><span style=3D"col=
or:#660">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:=
#800">/* something */</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">friend<=
/span><span style=3D"color:#000"> T</span><span style=3D"color:#660">;</spa=
n><span style=3D"color:#000"><br></span><span style=3D"color:#660">};</span=
><span style=3D"color:#000"><br><br></span><span style=3D"color:#008">templ=
ate</span><span style=3D"color:#660"><</span><span style=3D"color:#008">=
typename</span><span style=3D"color:#000"> T</span><span style=3D"color:#66=
0">,</span><span style=3D"color:#000"> size_t I</span><span style=3D"color:=
#660">></span><span style=3D"color:#000"><br></span><span style=3D"color=
:#008">struct</span><span style=3D"color:#000"> pointer</span><span style=
=3D"color:#660"><</span><span style=3D"color:#000">T</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> I</span><span style=3D"=
color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color=
:#008">typename</span><span style=3D"color:#000"> private_access_token</spa=
n><span style=3D"color:#660"><</span><span style=3D"color:#000">T</span>=
<span style=3D"color:#660">>::</span><span style=3D"color:#000">type </s=
pan><span style=3D"color:#660">></span><span style=3D"color:#000"><br></=
span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#008">public</span><span style=3D"color:#660">:</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#800">//always p=
ublic with token</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span>=
<span style=3D"color:#008">constexpr</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#008">static</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#606">SomeType</span><span style=3D"color:#000"> T<=
/span><span style=3D"color:#660">::*</span><span style=3D"color:#000"> valu=
e </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#800">/* something */</span><span style=3D"color=
:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span st=
yle=3D"color:#008">friend</span><span style=3D"color:#000"> T</span><span s=
tyle=3D"color:#660">;</span><span style=3D"color:#000"><br></span><span sty=
le=3D"color:#660">};</span><span style=3D"color:#000"><br><br></span></div>=
</code></div><br><br><br>Thanks to that, class implementation can have cont=
rol over private access and allow sharing it to third party libraries witho=
ut exposing private fields to the wild.<br>Some class designer could even a=
llow every one using it by exposing type form token:<br><div style=3D"backg=
round-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:sol=
id;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#=
008">class</span><span style=3D"color:#000"> A<br></span><span style=3D"col=
or:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span =
style=3D"color:#008">int</span><span style=3D"color:#000"> a</span><span st=
yle=3D"color:#660">;</span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">public</span><span style=3D"color:#660">:</span><span styl=
e=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">using<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#606">Private=
Token</span><span style=3D"color:#000"> </span><span style=3D"color:#660">=
=3D</span><span style=3D"color:#000"> private_access_token</span><span styl=
e=3D"color:#660"><</span><span style=3D"color:#000">A</span><span style=
=3D"color:#660">>::</span><span style=3D"color:#000">type</span><span st=
yle=3D"color:#660">;</span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#660">};</span><span style=3D"color:#000"><br><br></span><span s=
tyle=3D"color:#008">class</span><span style=3D"color:#000"> B<br></span><sp=
an style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color:#008">int</span><span style=3D"color:#000">=
a</span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#008">int</span><span style=3D"co=
lor:#000"> b</span><span style=3D"color:#660">;</span><span style=3D"color:=
#000"><br></span><span style=3D"color:#008">public</span><span style=3D"col=
or:#660">:</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><sp=
an style=3D"color:#660">::</span><span style=3D"color:#008">string</span><s=
pan style=3D"color:#000"> to_string</span><span style=3D"color:#660">()</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#660">{</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#008">return</span><s=
pan style=3D"color:#000"> third_party_func</span><span style=3D"color:#660"=
><</span><span style=3D"color:#000">private_<u></u>access_token</span><s=
pan style=3D"color:#660"><</span><span style=3D"color:#000">B</span><spa=
n style=3D"color:#660">>::</span><span style=3D"color:#000">type</span><=
span style=3D"color:#660">>(</span><span style=3D"color:#008">this</span=
><span style=3D"color:#660">);</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#660">}</span><span style=3D"color:#000"><br></span><span=
style=3D"color:#660">};</span><span style=3D"color:#000"><br><br></span></=
div></code></div><br><br>Do you think that could be good solution for that?=
<br><br><br></div></blockquote></div></div></blockquote></div></div></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></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 />
--001a1130c3fa68d96f0511326613--
.
Author: inkwizytoryankes@gmail.com
Date: Fri, 13 Mar 2015 15:09:18 -0700 (PDT)
Raw View
------=_Part_1014_1779994983.1426284558420
Content-Type: multipart/alternative;
boundary="----=_Part_1015_1928476571.1426284558420"
------=_Part_1015_1928476571.1426284558420
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
I see, this is unfixable problem. Only way I see my example could fulfill=
=20
this requirement is add special token that is named `hack_this_please` with=
=20
oblivious functionality.
This at least would separate legit use of private members (like=20
serialization) and hack that are workaround of class limitations (like lack=
=20
of support for serialization :) ).
But this is in itself hack of my proposition.
On Friday, March 13, 2015 at 10:44:09 PM UTC+1, Ville Voutilainen wrote:
>
>
>
> On 13 March 2015 at 23:25, <inkwizyt...@gmail.com <javascript:>> wrote:
>
>> Do you know why people was against this approach?
>>
>
> There is a desire to use reflection on legacy types that would be=20
> infeasible
> to modify to contain such a token.
> =20
>
>>
>>
>> On Friday, March 13, 2015 at 12:22:15 AM UTC+1, Cleiton Santoia wrote:
>>>
>>>
>>>
>>>
>>> In this document http://random.m-ou.se/reflectionfeedbackurbana.htm=
l you=20
>>> will find :
>>>
>>>
>>> Opt-in to unsafe reflection from the class under reflection:
>>> SFFNASA543102
>>>
>>>
>>>
>>> Em quinta-feira, 12 de mar=C3=A7o de 2015 19:46:29 UTC-3,=20
>>> inkwizyt...@gmail.com escreveu:
>>>>
>>>> I have idea of system that could be used of handling private data in=
=20
>>>> reflection.
>>>>
>>>> First one, we add new template
>>>> template<typename T>
>>>> class private_access_token
>>>> {
>>>> using type =3D /* undefined */;
>>>> friend T;
>>>> };
>>>>
>>>>
>>>> And we add to `class_member::pointer` (like from n4113) new default=20
>>>> parameter:
>>>> template<typename T, size_t I, token =3D void>
>>>> struct pointer
>>>> {
>>>> private: //this line depend if I'th member is private
>>>> constexpr static SomeType T::* value =3D /* something */;
>>>> friend T;
>>>> };
>>>>
>>>> template<typename T, size_t I>
>>>> struct pointer<T, I, typename private_access_token<T>::type >
>>>> {
>>>> public: //always public with token
>>>> constexpr static SomeType T::* value =3D /* something */;
>>>> friend T;
>>>> };
>>>>
>>>>
>>>>
>>>>
>>>> Thanks to that, class implementation can have control over private=20
>>>> access and allow sharing it to third party libraries without exposing=
=20
>>>> private fields to the wild.
>>>> Some class designer could even allow every one using it by exposing=20
>>>> type form token:
>>>> class A
>>>> {
>>>> int a;
>>>> public:
>>>> using PrivateToken =3D private_access_token<A>::type;
>>>> };
>>>>
>>>> class B
>>>> {
>>>> int a;
>>>> int b;
>>>> public:
>>>> std::string to_string() { return third_party_func<private_
>>>> access_token<B>::type>(this); }
>>>> };
>>>>
>>>>
>>>>
>>>> Do you think that could be good solution for that?
>>>>
>>>>
>>>> --=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_1015_1928476571.1426284558420
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I see, this is unfixable problem. Only way I see my exampl=
e could fulfill this requirement is add special token that is named `hack_t=
his_please` with oblivious functionality.<br>This at least would separate l=
egit use of private members (like serialization) and hack that are workarou=
nd of class limitations (like lack of support for serialization :) ).<br>Bu=
t this is in itself hack of my proposition.<br><br>On Friday, March 13, 201=
5 at 10:44:09 PM UTC+1, Ville Voutilainen wrote:<blockquote class=3D"gmail_=
quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;pa=
dding-left: 1ex;"><div dir=3D"ltr"><br><div><br><div class=3D"gmail_quote">=
On 13 March 2015 at 23:25, <span dir=3D"ltr"><<a href=3D"javascript:" t=
arget=3D"_blank" gdf-obfuscated-mailto=3D"xI5pk34Dt2gJ" rel=3D"nofollow" on=
mousedown=3D"this.href=3D'javascript:';return true;" onclick=3D"this.href=
=3D'javascript:';return true;">inkwizyt...@gmail.com</a>></span> wrote:<=
br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left=
:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Do you know why people w=
as against this approach?</div></blockquote><div><br></div><div>There is a =
desire to use reflection on legacy types that would be infeasible<br></div>=
<div>to modify to contain such a token.<br> <br></div><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><div dir=3D"ltr"><div><div><br><br>On Friday, March 13, 2015=
at 12:22:15 AM UTC+1, Cleiton Santoia wrote:<blockquote class=3D"gmail_quo=
te" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-=
left:1ex"><div dir=3D"ltr"><div><br></div><div><br></div><div><br></div><di=
v> In this document <a href=3D"http://random.m-ou.se/refl=
ectionfeedbackurbana.html" rel=3D"nofollow" target=3D"_blank" onmousedown=
=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Frandom.m-ou.se%=
2Freflectionfeedbackurbana.html\46sa\75D\46sntz\0751\46usg\75AFQjCNFE655tqF=
ygttII-m54Ge_tnol1GA';return true;" onclick=3D"this.href=3D'http://www.goog=
le.com/url?q\75http%3A%2F%2Frandom.m-ou.se%2Freflectionfeedbackurbana.html\=
46sa\75D\46sntz\0751\46usg\75AFQjCNFE655tqFygttII-m54Ge_tnol1GA';return tru=
e;">http://random.m-ou.<u></u>se<wbr>/reflectionfeedbackurbana.<u></u>html<=
/a><wbr> you will find :<br></div><div><br></div><div><br></div><div><=
p style=3D"margin-left:4pc;margin-right:3pc;color:rgb(0,0,0);font-family:sa=
ns-serif;font-size:small;line-height:18.2000007629395px">Opt-in to unsafe r=
eflection from the class under reflection:</p><table style=3D"margin-left:a=
uto;margin-right:auto;border-collapse:collapse;color:rgb(0,0,0);font-family=
:sans-serif;font-size:small;line-height:18.2000007629395px"><thead><tr><th =
style=3D"text-align:center;font-weight:bold;border:1px solid rgb(211,211,21=
1);padding:4pt;background:rgb(238,238,238)" align=3D"left">SF</th><th style=
=3D"text-align:center;font-weight:bold;border:1px solid rgb(211,211,211);pa=
dding:4pt;background:rgb(238,238,238)" align=3D"left">F</th><th style=3D"te=
xt-align:center;font-weight:bold;border:1px solid rgb(211,211,211);padding:=
4pt;background:rgb(238,238,238)" align=3D"left">N</th><th style=3D"text-ali=
gn:center;font-weight:bold;border:1px solid rgb(211,211,211);padding:4pt;ba=
ckground:rgb(238,238,238)" align=3D"left">A</th><th style=3D"text-align:cen=
ter;font-weight:bold;border:1px solid rgb(211,211,211);padding:4pt;backgrou=
nd:rgb(238,238,238)" align=3D"left">SA</th></tr></thead><tbody><tr><td styl=
e=3D"border:1px solid rgb(211,211,211);padding:4pt" align=3D"left">5</td><t=
d style=3D"border:1px solid rgb(211,211,211);padding:4pt" align=3D"left">4<=
/td><td style=3D"border:1px solid rgb(211,211,211);padding:4pt" align=3D"le=
ft">3</td><td style=3D"border:1px solid rgb(211,211,211);padding:4pt" align=
=3D"left">10</td><td style=3D"border:1px solid rgb(211,211,211);padding:4pt=
" align=3D"left">2<br><br></td></tr></tbody></table></div><div><br></div><d=
iv><br>Em quinta-feira, 12 de mar=C3=A7o de 2015 19:46:29 UTC-3, <a>inkwizy=
t...@gmail.com</a> escreveu:<blockquote class=3D"gmail_quote" style=3D"mar=
gin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div d=
ir=3D"ltr">I have idea of system that could be used of handling private dat=
a in reflection.<br><br>First one, we add new template<br><div style=3D"bac=
kground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:s=
olid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color=
:#008">template</span><span style=3D"color:#660"><</span><span style=3D"=
color:#008">typename</span><span style=3D"color:#000"> T</span><span style=
=3D"color:#660">></span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">class</span><span style=3D"color:#000"> private_access_tok=
en<br></span><span style=3D"color:#660">{</span><span style=3D"color:#000">=
<br> </span><span style=3D"color:#008">using</span><span style=
=3D"color:#000"> type </span><span style=3D"color:#660">=3D</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#800">/* undefined */</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#000"><br> &n=
bsp; </span><span style=3D"color:#008">friend</span><span style=3D"color:#0=
00"> T</span><span style=3D"color:#660">;</span><span style=3D"color:#000">=
<br></span><span style=3D"color:#660">};</span><span style=3D"color:#000"><=
br></span></div></code></div><br><br>And we add to `class_member::pointer` =
(like from n4113) new default parameter:<br><div style=3D"background-color:=
rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-wi=
dth:1px;word-wrap:break-word"><code><div><span style=3D"color:#008">templat=
e</span><span style=3D"color:#660"><</span><span style=3D"color:#008">ty=
pename</span><span style=3D"color:#000"> T</span><span style=3D"color:#660"=
>,</span><span style=3D"color:#000"> size_t I</span><span style=3D"color:#6=
60">,</span><span style=3D"color:#000"> token </span><span style=3D"color:#=
660">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#008=
">void</span><span style=3D"color:#660">></span><span style=3D"color:#00=
0"><br></span><span style=3D"color:#008">struct</span><span style=3D"color:=
#000"> pointer<br></span><span style=3D"color:#660">{</span><span style=3D"=
color:#000"><br></span><span style=3D"color:#008">private</span><span style=
=3D"color:#660">:</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#800">//this line depend if I'th member is private</span><span style=
=3D"color:#000"><br> </span><span style=3D"color:#008">constex=
pr</span><span style=3D"color:#000"> </span><span style=3D"color:#008">stat=
ic</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Some=
Type</span><span style=3D"color:#000"> T</span><span style=3D"color:#660">:=
:*</span><span style=3D"color:#000"> value </span><span style=3D"color:#660=
">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#800">/=
* something */</span><span style=3D"color:#660">;</span><span style=3D"colo=
r:#000"><br> </span><span style=3D"color:#008">friend</span><s=
pan style=3D"color:#000"> T</span><span style=3D"color:#660">;</span><span =
style=3D"color:#000"><br></span><span style=3D"color:#660">};</span><span s=
tyle=3D"color:#000"><br><br></span><span style=3D"color:#008">template</spa=
n><span style=3D"color:#660"><</span><span style=3D"color:#008">typename=
</span><span style=3D"color:#000"> T</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> size_t I</span><span style=3D"color:#660">&g=
t;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">s=
truct</span><span style=3D"color:#000"> pointer</span><span style=3D"color:=
#660"><</span><span style=3D"color:#000">T</span><span style=3D"color:#6=
60">,</span><span style=3D"color:#000"> I</span><span style=3D"color:#660">=
,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">typen=
ame</span><span style=3D"color:#000"> private_access_token</span><span styl=
e=3D"color:#660"><</span><span style=3D"color:#000">T</span><span style=
=3D"color:#660">>::</span><span style=3D"color:#000">type </span><span s=
tyle=3D"color:#660">></span><span style=3D"color:#000"><br></span><span =
style=3D"color:#660">{</span><span style=3D"color:#000"><br></span><span st=
yle=3D"color:#008">public</span><span style=3D"color:#660">:</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#800">//always public with =
token</span><span style=3D"color:#000"><br> </span><span style=
=3D"color:#008">constexpr</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#008">static</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#606">SomeType</span><span style=3D"color:#000"> T</span><span=
style=3D"color:#660">::*</span><span style=3D"color:#000"> value </span><s=
pan style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span=
style=3D"color:#800">/* something */</span><span style=3D"color:#660">;</s=
pan><span style=3D"color:#000"><br> </span><span style=3D"colo=
r:#008">friend</span><span style=3D"color:#000"> T</span><span style=3D"col=
or:#660">;</span><span style=3D"color:#000"><br></span><span style=3D"color=
:#660">};</span><span style=3D"color:#000"><br><br></span></div></code></di=
v><br><br><br>Thanks to that, class implementation can have control over pr=
ivate access and allow sharing it to third party libraries without exposing=
private fields to the wild.<br>Some class designer could even allow every =
one using it by exposing type form token:<br><div style=3D"background-color=
:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-w=
idth:1px;word-wrap:break-word"><code><div><span style=3D"color:#008">class<=
/span><span style=3D"color:#000"> A<br></span><span style=3D"color:#660">{<=
/span><span style=3D"color:#000"><br> </span><span style=3D"co=
lor:#008">int</span><span style=3D"color:#000"> a</span><span style=3D"colo=
r:#660">;</span><span style=3D"color:#000"><br></span><span style=3D"color:=
#008">public</span><span style=3D"color:#660">:</span><span style=3D"color:=
#000"><br> </span><span style=3D"color:#008">using</span><span=
style=3D"color:#000"> </span><span style=3D"color:#606">PrivateToken</span=
><span style=3D"color:#000"> </span><span style=3D"color:#660">=3D</span><s=
pan style=3D"color:#000"> private_access_token</span><span style=3D"color:#=
660"><</span><span style=3D"color:#000">A</span><span style=3D"color:#66=
0">>::</span><span style=3D"color:#000">type</span><span style=3D"color:=
#660">;</span><span style=3D"color:#000"><br></span><span style=3D"color:#6=
60">};</span><span style=3D"color:#000"><br><br></span><span style=3D"color=
:#008">class</span><span style=3D"color:#000"> B<br></span><span style=3D"c=
olor:#660">{</span><span style=3D"color:#000"><br> </span><spa=
n style=3D"color:#008">int</span><span style=3D"color:#000"> a</span><span =
style=3D"color:#660">;</span><span style=3D"color:#000"><br> <=
/span><span style=3D"color:#008">int</span><span style=3D"color:#000"> b</s=
pan><span style=3D"color:#660">;</span><span style=3D"color:#000"><br></spa=
n><span style=3D"color:#008">public</span><span style=3D"color:#660">:</spa=
n><span style=3D"color:#000"><br> std</span><span style=3D"col=
or:#660">::</span><span style=3D"color:#008">string</span><span style=3D"co=
lor:#000"> to_string</span><span style=3D"color:#660">()</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">{</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#008">return</span><span style=3D"c=
olor:#000"> third_party_func</span><span style=3D"color:#660"><</span><s=
pan style=3D"color:#000">private_<u></u>acces<wbr>s_token</span><span style=
=3D"color:#660"><</span><span style=3D"color:#000">B</span><span style=
=3D"color:#660">>::</span><span style=3D"color:#000">type</span><span st=
yle=3D"color:#660">>(</span><span style=3D"color:#008">this</span><span =
style=3D"color:#660">);</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#660">}</span><span style=3D"color:#000"><br></span><span style=
=3D"color:#660">};</span><span style=3D"color:#000"><br><br></span></div></=
code></div><br><br>Do you think that could be good solution for that?<br><b=
r><br></div></blockquote></div></div></blockquote></div></div></div><div><d=
iv>
<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"=
xI5pk34Dt2gJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:';ret=
urn true;" onclick=3D"this.href=3D'javascript:';return true;">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"xI5pk34Dt2gJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:=
';return true;">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" rel=3D"nofollow" onmousedown=3D"this.href=
=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';return true=
;" onclick=3D"this.href=3D'http://groups.google.com/a/isocpp.org/group/std-=
proposals/';return true;">http://groups.google.com/a/<wbr>isocpp.org/group/=
std-<wbr>proposals/</a>.<br>
</div></div></blockquote></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 <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_1015_1928476571.1426284558420--
------=_Part_1014_1779994983.1426284558420--
.