220 27199 <d0eb7c1b-19b5-4ab4-97c3-e3f1a88a7fe3@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Derek Ross <antiquarktv@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Generalized "using" member aliases.
Date: Thu, 21 Jul 2016 19:23:07 -0700 (PDT)
Lines: 342
Approved: news@gmane.org
Message-ID: <d0eb7c1b-19b5-4ab4-97c3-e3f1a88a7fe3@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_91_839745895.1469154187556"
X-Trace: ger.gmane.org 1469154203 31512 80.91.229.3 (22 Jul 2016 02:23:23 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 22 Jul 2016 02:23:23 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDJJ7WHE3YKRBDEHY26AKGQEPLRWQHQ@isocpp.org Fri Jul 22 04:23:17 2016
Return-path: <std-proposals+bncBDJJ7WHE3YKRBDEHY26AKGQEPLRWQHQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-io0-f199.google.com ([209.85.223.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDJJ7WHE3YKRBDEHY26AKGQEPLRWQHQ@isocpp.org>)
	id 1bQQ7N-0008Da-Og
	for gclcip-std-proposals@m.gmane.org; Fri, 22 Jul 2016 04:23:14 +0200
Original-Received: by mail-io0-f199.google.com with SMTP id m101sf201595633ioi.0
        for <gclcip-std-proposals@m.gmane.org>; Thu, 21 Jul 2016 19:23:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=lI7sFcEsBXVJ7M3THBF92jv+9rOtSEP1XyqGlDDU1Oo=;
        b=czg9++HOrCZ1zfAvCkidmN0YQx2Te4ZrIBXZjBwWhzctt3fgB6B2cqjZzVnBZ0HzMW
         OX3v1gkElS5Mqzs8BIxkUmSTyDdMmvy0zkkl+ZmgPrS4SvTLQZYuJkHIhAYVlqiZwD0i
         TltgUbJmoNDGGhl3RZpWibP8yMuwxErnY5ubdFpt5BllYh5yUDIQ2ecNj7+PCpV+HdYW
         OnZBV9K7Twi6JWfheZZ078f8KXgFsnICcx6qEV/iV9FmisIwg5vqv/EBNhmjXl08Cxhd
         njY25GLf9rwx/JKMx9Yd0x4pDaHBWJUSK3Ug/vhgmNho9ZL39FCBr2P/1dfLSUffdti/
         BwwA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=lI7sFcEsBXVJ7M3THBF92jv+9rOtSEP1XyqGlDDU1Oo=;
        b=iZoygeVXIFFv/I9F4OdnOQngOufLs7dmFPE8xxqbNX6wftFS057aP49XKYdKWTZtcJ
         kiQM6m+mjMKVBAA7evRzv642JEl4JDXLiMZBK4MkX2jpvd3Bn+8pTbRRNCEn8CgDCPpT
         C522jzNQ/WoXF9UU9zaG75NK6OLvN4O/KtZP32UUe7ayyx2pYZqYnbT1nCtWoXsT+dZh
         7NnLbK8p5i47mKdwHm3AWpfPO+6lcnyb1dmxN0Y51qbz29YUVQEoAQqHR9NuKpFjWexb
         Eo27HrONmuHBEmETLny+aRBkoQIZdpEZ+3Ol8Vdb136tnbK1V+dPdBKrWoGP7opHhmYX
         DU5w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=lI7sFcEsBXVJ7M3THBF92jv+9rOtSEP1XyqGlDDU1Oo=;
        b=IM7sESpkMshZFbhwAhScq9QvGIiDplrKOzj0e/cQNrm8kolKz4ilN7IGYWd9/J9ba0
         IvLotW3ricJtDaM1Ny9UInaKHSP0qZVTxwYumqlz3MnbGfe1uQY5tf35Kf/DAB+5cVKv
         AIIFV5hSMLR3571cAI75e69M0IaYILciktgN59yJb15eGZCwlZiDwp3Smq8O3zpWu5l8
         +yjx1jxR4ZQBbn6aUnTI2UsFfJ6L9zRkB6d+zSaBSGPaTQpoWzdlUDGlQGiMWRkavK08
         JfDgOPCWdoyuLqg1vElmg+GTOhj5mR1cXkdv98hgoSMJ8HiEldkEpGVQkp+L1a/FfbFe
         9okQ==
X-Gm-Message-State: ALyK8tJ5GFV3L2BetAUBg8o4nby+ML+vW+rZOEy04i58OkT5rdE+urOHps6sWHYsnDeQwg==
X-Received: by 10.36.110.210 with SMTP id w201mr10924060itc.7.1469154192676;
        Thu, 21 Jul 2016 19:23:12 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.214.71 with SMTP id o68ls1066866itg.8.gmail; Thu, 21 Jul
 2016 19:23:08 -0700 (PDT)
X-Received: by 10.36.217.2 with SMTP id p2mr69739itg.5.1469154188558;
        Thu, 21 Jul 2016 19:23:08 -0700 (PDT)
X-Original-Sender: antiquarktv@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:27199
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/27199>

------=_Part_91_839745895.1469154187556
Content-Type: multipart/alternative; 
	boundary="----=_Part_92_2098299631.1469154187557"

------=_Part_92_2098299631.1469154187557
Content-Type: text/plain; charset=UTF-8

It would be useful if "using" aliases could be expanded beyond namespaces 
and types. Why not provide aliases for class members? This would be useful 
if you wanted to derive a class from a standard type such as pair or tuple, 
but wanted more meaningful member names than the built-in .first, .second, 
etc, names. In effect, a way to easily "rename" a member.

The member alias syntax would look like: 

class X { ...
 using NewName = ExistingName;

where ExistingName is an existing member variable or member function in a 
class. The implemention would treat NewName like a macro, and substitute 
ExistingName wherever NewName appears. ExistingName could also specify a 
function, e.g., "ExistingName()", in which case NewName becomes a 
property-like element. 

*Examples:*

You could derive from a std::pair, then alias different names to the .first 
and .second members of the pair.

struct Gps_Pos : pair<double,double> {    
    using latitude = first;
    using longitude = second;
};

Gps_Pos gps; 
gps.latitude = 12.34; //sets gps.first

Another possibility could be to alias names to certain elements of an 
array. Thus, an N-dimensional array could provide names for each dimension. 
 
struct Vec3d{
    double data[3];    
    using x = data[0];
    using y = data[1];
    using z = data[2];
};

Vec3d v;
v.z = 123; // sets data[2]
 
Member aliases could also be used to shorten inconveniently long names:
 
struct My_Database{
    int GetNumberOfCustomersCurrentlyActive(){
     ...
    }    
    using custs = GetNumberOfCustomersCurrentlyActive;
};
 
My_Database db;
cout << db.custs() ; // calls db.GetNumberOfCustomersCurrentlyActive()

Finally, member aliases could be used to access elements of a tuple through 
meaningful names. This brings tuples one step closer to being a struct 
replacement, with all the extra features that a tuple provides. 

struct Person : tuple<string,int>{
    string& get0(){return std::get<0>(*this);}
    int&    get1(){return std::get<1>(*this);}
    
    using name = get0();
    using age  = get1();
};

Person p;
p.name = "Bob"; //sets via get<0>(p)

----
Cheers,
Derek

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/d0eb7c1b-19b5-4ab4-97c3-e3f1a88a7fe3%40isocpp.org.

------=_Part_92_2098299631.1469154187557
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">It would be useful if &quot;using&quot; aliases could be e=
xpanded beyond namespaces and types. Why not provide aliases for class memb=
ers? This would be useful if you wanted to derive a class from a standard t=
ype such as pair or tuple, but wanted more meaningful member names than the=
 built-in .first, .second, etc, names. In effect, a way to easily &quot;ren=
ame&quot; a member.<br><br>The member alias syntax would look like: <br><br=
><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); =
border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; w=
ord-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyp=
rint"><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> X </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: #6=
60;" class=3D"styled-by-prettify">...</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>=C2=A0</span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">using</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">NewName</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #606;" class=3D"styled-by-prettify">ExistingName<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></d=
iv></code></div><br>where ExistingName is an existing member variable or me=
mber function in a class. The implemention would treat NewName like a macro=
, and substitute ExistingName wherever NewName appears. ExistingName could =
also specify a function, e.g., &quot;ExistingName()&quot;, in which case Ne=
wName becomes a property-like element. <br><br><b>Examples:</b><br><br>You =
could derive from a std::pair, then alias different names to the .first and=
 .second members of the pair.<br><br><div class=3D"prettyprint" style=3D"ba=
ckground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); borde=
r-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"p=
rettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-b=
y-prettify">Gps_Pos</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> pair</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">double</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">double</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> =C2=A0 =C2=A0<br>=C2=A0 =C2=A0 </span><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> latitude </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> first</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> longitude </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> second</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">;</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><s=
pan style=3D"color: #606;" class=3D"styled-by-prettify">Gps_Pos</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> gps</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> <br>gps</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">latitude </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-=
prettify">12.34</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #800;" class=3D"styled-by-prettify">//sets gps.fi=
rst</span></div></code></div><br>Another possibility could be to alias name=
s to certain elements of an array. Thus, an N-dimensional array could provi=
de names for each dimension. <br>=C2=A0<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 clas=
s=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;=
" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"st=
yled-by-prettify">Vec3d</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">double</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> data</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">[</span><span style=3D"color: #066;" class=3D"styled-by-prettify">3</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">];</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0<br>=C2=
=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>using</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> x <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> data</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"=
color: #066;" class=3D"styled-by-prettify">0</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">];</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">using</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> y </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> data</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">[</span><span style=3D"color: #066;" class=3D"styled-by-prettif=
y">1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">];</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">using<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> z </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> data</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">2</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">];</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br><br></span><span style=3D"color: #606;" class=3D"styled-by-prett=
ify">Vec3d</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 v</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br>v</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">z </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: #066;" class=3D"=
styled-by-prettify">123</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">// se=
ts data[2]</span></div></code></div>=C2=A0<br>Member aliases could also be =
used to shorten inconveniently long names:<br>=C2=A0<br><div class=3D"prett=
yprint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(18=
7, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word=
;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D=
"color: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;=
" class=3D"styled-by-prettify">My_Database</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styl=
ed-by-prettify">GetNumberOfCustomersCurrentlyActive</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(){</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">...</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0<br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">using</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> custs </span><spa=
n 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=
: #606;" class=3D"styled-by-prettify">GetNumberOfCustomersCurrentlyActive</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>=C2=A0<br></span><span style=3D=
"color: #606;" class=3D"styled-by-prettify">My_Database</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> db</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>cout </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> db</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">custs</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">// calls db.GetNumberOfCusto=
mersCurrentlyActive()</span></div></code></div><br>Finally, member aliases =
could be used to access elements of a tuple through meaningful names. This =
brings tuples one step closer to being a struct replacement, with all the e=
xtra features that a tuple provides. <br><br><div class=3D"prettyprint" sty=
le=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187=
); border-style: solid; border-width: 1px; word-wrap: break-word;"><code cl=
ass=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"=
styled-by-prettify">Person</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> t=
uple</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">string</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&gt;{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">string</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> get0</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">(){</span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">return</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">get</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&lt;</span><span style=3D"color: #066;" class=3D"styled-by-prettify">0</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(*</span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">this</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">);}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0get1</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">(){</span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">return</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">::</span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">get</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&lt;</span><span style=3D"color: #066;" class=3D"styled-=
by-prettify">1</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">&gt;(*</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"><br>=C2=A0 =
=C2=A0 <br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">using</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> name </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
get0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">();</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">usi=
ng</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> age =C2=
=A0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> get1</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">();</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">Person</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> p</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>p</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">na=
me </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #080;" class=3D"styled-by-prettify">&quot;Bob&quot;</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #800;" class=3D"styled-by-prettify">//sets via get&lt;0&gt;(p)</span></d=
iv></code></div><br>----<br>Cheers,<br>Derek<br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d0eb7c1b-19b5-4ab4-97c3-e3f1a88a7fe3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d0eb7c1b-19b5-4ab4-97c3-e3f1a88a7fe3=
%40isocpp.org</a>.<br />

------=_Part_92_2098299631.1469154187557--

------=_Part_91_839745895.1469154187556--

.
