Topic: Choosing value categories using a specialized traits class
Author: =?UTF-8?Q?Andr=C3=A9?= <andre.francisco@tryhype.co>
Date: Sat, 6 Feb 2016 17:33:17 -0800 (PST)
Raw View
------=_Part_1266_1154080445.1454808797575
Content-Type: multipart/alternative;
boundary="----=_Part_1267_1188108203.1454808797578"
------=_Part_1267_1188108203.1454808797578
Content-Type: text/plain; charset=UTF-8
Hello everyone,
This idea for a proposal comes from discussions such as this
<http://stackoverflow.com/questions/3009543/passing-integers-as-constant-references-versus-copying> one.
There are several situations in STL's API in which integral values are
passed by const reference, such as vector's insert
<http://www.cplusplus.com/reference/vector/vector/insert/> for template
parameters of integral types. Consider the following code:
std::vector<int> v;
int a;
....
v.push_back(a);
I'm not sure to at what extent do compilers optimize this (if at all) by
passing "a" by copy instead of using a constant reference. In any case,
this idea would solve this problem at the framework level, which seems
optimal to me. Consider push_back
<http://www.cplusplus.com/reference/vector/vector/push_back/>'s signature:
void push_back (const value_type& val);
This proposal consists in providing a template *traits* class that
implements a set of typedefs and specializes them to provider cleaner and
optimal definitions, regarding multiple situations. Here's a simplified
example:
template <class T> class traits
{
public:
typedef T value_type;
typedef value_type & reference;
typedef value_type * pointer;
typedef const value_type & const_reference;
typedef const value_type * const_pointer;
};
In this case, it doesn't do much other than defining some pretty standard
stuff. These definitions can be found immensely in STL. The next step would
be to provide some more exotic definitions. Some examples:
- *argument_type* solves the problem described. For integral types this
would evaluate to value_type and for class types it would evaluate to
const_reference.
- *tag_type* the generic template would declare an empty struct
(tag_type) and a constant (tag) of that type. Useful for implementing tag
dispatching
<http://www.generic-programming.org/languages/cpp/techniques.php#tag_dispatching>
.
I was actually considering including other types in this discussion, such
as allocator_type, which would "recommend" an allocator, but so far these
two proposals seem the strongest on the table. For instance, recommending
an allocator is not as trivial as checking a given type, as it also depends
on the container (i.e. a "recommendable" allocator for int will most likely
be different for list<int> and vector<int>). Here's what would (probably)
be a naive approach to this problem:
template <class T>
class _traits_commons
{
public:
/* Standard stuff */
typedef T value_type;
typedef value_type & reference;
typedef value_type * pointer;
typedef const value_type & const_reference;
typedef const value_type * const_pointer;
typedef std::ptrdiff_t difference_type;
/* argument_type as described */
typedef value_type argument_type;
typedef const value_type const_argument_type;
/* Tag dispatching */
typedef struct {} tag_type;
static const tag_type tag;
};
template <class T, class E = void>
class traits
: public _traits_commons<T>
{
private:
typedef _traits_commons<T> _base_type;
public:
typedef typename _base_type::value_type value_type;
typedef typename _base_type::reference reference;
typedef typename _base_type::pointer pointer;
typedef typename _base_type::const_reference const_reference;
typedef typename _base_type::const_pointer const_pointer;
typedef typename _base_type::difference_type difference_type;
typedef typename _base_type::argument_type argument_type;
typedef typename _base_type::const_argument_type const_argument_type;
typedef typename _base_type::tag_type tag_type;
};
template <class T>
class traits<T, typename std::enable_if<std::is_class<T>::value>::type>
: public _traits_commons<T>
{
private:
typedef _traits_commons<T> _base_type;
public:
typedef typename _base_type::value_type value_type;
typedef typename _base_type::reference reference;
typedef typename _base_type::pointer pointer;
typedef typename _base_type::const_reference const_reference;
typedef typename _base_type::const_pointer const_pointer;
typedef typename _base_type::size_type size_type;
typedef typename _base_type::difference_type difference_type;
typedef typename _base_type::return_type return_type;
/* Enabled if std::is_class<T> (discussible). Notice that argument_type
is now a reference */
typedef reference argument_type;
typedef const reference const_argument_type;
typedef typename _base_type::tag_type tag_type;
};
This is obviously a simplification, but I believe it works to demonstrate
my intents. Getting back to the previous examples, push_back would now be
declared like this:
void push_back (typename traits<T>::const_argument_type val);
This would mean a pass-by-copy for non-class types and a const_reference
for class types. By using this approach I believe that argument passing can
be cleaner and more efficient. Has this been proposed before? What do you
think? I've been thinking about making a proposal to the C++ committee and
though of following their recommendation of posting on the forums first :)
Thank you immensely in advance for your feedback,
Happy coding!
--
---
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 https://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_1267_1188108203.1454808797578
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hello everyone,<div><br></div><div>This idea for a proposa=
l comes from discussions such as=C2=A0<a href=3D"http://stackoverflow.com/q=
uestions/3009543/passing-integers-as-constant-references-versus-copying">th=
is</a>=C2=A0one. There are several situations in STL's API in which int=
egral values are passed by const reference, such as=C2=A0<a href=3D"http://=
www.cplusplus.com/reference/vector/vector/insert/">vector's insert</a>=
=C2=A0for template parameters of integral types. Consider the following cod=
e:</div><div><br></div><div><div class=3D"prettyprint" style=3D"border: 1px=
solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250=
, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><fo=
nt color=3D"#660066"><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">vector</spa=
n><span style=3D"color: #080;" class=3D"styled-by-prettify"><int></sp=
an><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></span><span style=3D"color=
: #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;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br></span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">...</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br><br>v</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">push=
_back</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">a</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">);</span></font></div><=
/code></div><br>I'm not sure to at what extent do compilers optimize th=
is (if at all) by passing "a" by copy instead of using a constant=
reference. In any case, this idea would solve this problem at the framewor=
k level, which seems optimal to me. Consider=C2=A0<a href=3D"http://www.cpl=
usplus.com/reference/vector/vector/push_back/">push_back</a>'s signatur=
e:<br></div><div><br></div><div><div class=3D"prettyprint" style=3D"border:=
1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb=
(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"=
><pre style=3D"color: rgb(0, 128, 0); font-size: 12px; background-color: rg=
b(250, 255, 250);"><span style=3D"color: #008;" class=3D"styled-by-prettify=
">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> pus=
h_back </span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">const</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> value_type</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">&</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> val</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">);</span></pre></div></code=
></div><br>This proposal consists in providing a template <u>traits</u>=C2=
=A0class that implements a set of typedefs and specializes them to provider=
cleaner and optimal definitions, regarding multiple situations. Here's=
a simplified example:</div><div><br></div><div><div class=3D"prettyprint" =
style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; backg=
round-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D=
"subprettyprint"><p class=3D"p1"><span class=3D"s2" style=3D"font-family: A=
rial, Helvetica, sans-serif;"><span style=3D"color: #008;" class=3D"styled-=
by-prettify">template</span></span><span class=3D"s1" style=3D"font-family:=
Arial, Helvetica, sans-serif;"><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify"><</span></span><span class=3D"s2" style=3D"font-family: Arial, Hel=
vetica, sans-serif;"><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">class</span></span><span class=3D"s1" style=3D"font-family: Arial, Helv=
etica, sans-serif;"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">><=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></s=
pan><span class=3D"s2" style=3D"font-family: Arial, Helvetica, sans-serif;"=
><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span></sp=
an><span class=3D"s1" style=3D"font-family: Arial, Helvetica, sans-serif;">=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> traits</span></s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><s=
pan class=3D"s1"></span></p><p class=3D"p2"><span class=3D"s1"><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span></span></p><p class=
=3D"p3"><span class=3D"s1"><span style=3D"color: #008;" class=3D"styled-by-=
prettify">public</span></span><span class=3D"s3"><span style=3D"color: #660=
;" class=3D"styled-by-prettify">:</span></span></p><p class=3D"p1"><span cl=
ass=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=
=A0 =C2=A0</span></span></p><p class=3D"p2"><span class=3D"s1"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></span>=
<span class=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify=
">typedef</span></span><span class=3D"s1"><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> T value_type</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">;</span></span></p><p class=3D"p1"><span class=
=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =
=C2=A0</span></span></p><p class=3D"p2"><span class=3D"s1"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></span><span=
class=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify">typ=
edef</span></span><span class=3D"s1"><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span></span><span class=3D"s4"><span style=3D"color:=
#000;" class=3D"styled-by-prettify">value_type</span></span><span class=3D=
"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> reference</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">;</span></span></p><p clas=
s=3D"p2"><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> =C2=A0 =C2=A0</span></span><span class=3D"s2"><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typedef</span></span><span class=
=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
/span><span class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">value_type</span></span><span class=3D"s1"><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> pointer</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">;</span></span></p><p class=3D"p1"><span class=3D"s1"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></s=
pan></p><p class=3D"p2"><span class=3D"s1"><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></span><span class=3D"s2"><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">typedef</span></spa=
n><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span></span><span class=3D"s2"><span style=3D"color: #008;" class=3D=
"styled-by-prettify">const</span></span><span class=3D"s1"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span></span><span class=3D"s4"=
><span style=3D"color: #000;" class=3D"styled-by-prettify">value_type</span=
></span><span class=3D"s1"><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"> con=
st_reference</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">;</span></span></p><p class=3D"p2"><span class=3D"s1"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></span><span cl=
ass=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify">typede=
f</span></span><span class=3D"s1"><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span></span><span class=3D"s2"><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">const</span></span><span class=3D"s1"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span=
class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-prettify">val=
ue_type</span></span><span class=3D"s1"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">*</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> const_pointer</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span></span></p><p class=3D"p2"><span class=3D"s1"><span style=
=3D"color: #660;" class=3D"styled-by-prettify">};</span></span></p></div></=
code></div><br>In this case, it doesn't do much other than defining som=
e pretty standard stuff. These definitions can be found immensely in STL. T=
he next step would be to provide some more exotic definitions. Some example=
s:</div><div><ul><li><span style=3D"line-height: normal;"><b>argument_type<=
/b>=C2=A0solves the problem described. For integral types this would evalua=
te to value_type and for class types it would evaluate to const_reference.<=
/span></li><li><span style=3D"line-height: normal;"><b>tag_type</b>=C2=A0th=
e generic template would declare an empty struct (tag_type) and a constant =
(tag) of that type. Useful for implementing=C2=A0<a href=3D"http://www.gene=
ric-programming.org/languages/cpp/techniques.php#tag_dispatching">tag dispa=
tching</a>.</span></li></ul><div>I was actually considering including other=
types in this discussion, such as allocator_type, which would "recomm=
end" an allocator, but so far these two proposals seem the strongest o=
n the table. For instance, recommending an allocator is not as trivial as c=
hecking a given type, as it also depends on the container (i.e. a "rec=
ommendable" allocator for int will most likely be different for list&l=
t;int> and vector<int>). Here's what would (probably) be a nai=
ve approach to this problem:</div><div><br></div><div><div class=3D"prettyp=
rint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word;=
background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div cl=
ass=3D"subprettyprint"><p class=3D"p2"><span class=3D"s2"><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">template</span></span><span class=
=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify"><</span></span>=
<span class=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify=
">class</span></span><span class=3D"s1"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> <br></span></span><span class=3D"s2"><span style=3D"color: #008;=
" class=3D"styled-by-prettify">class</span></span><span class=3D"s1"><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> _traits_commons</span>=
</span></p><p class=3D"p2"><span class=3D"s1"><span style=3D"color: #660;" =
class=3D"styled-by-prettify">{</span></span></p><p class=3D"p3"><span class=
=3D"s1"><span style=3D"color: #008;" class=3D"styled-by-prettify">public</s=
pan></span><span class=3D"s3"><span style=3D"color: #660;" class=3D"styled-=
by-prettify">:</span></span></p><p class=3D"p1"><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0</span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">/* Standard stuff */</span></p><p cla=
ss=3D"p2"><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> =C2=A0 =C2=A0</span></span><span class=3D"s2"><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">typedef</span></span><span class=
=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> T value_=
type</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</spa=
n></span></p><p class=3D"p2"><span class=3D"s1"><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></span><span class=3D"s=
2"><span style=3D"color: #008;" class=3D"styled-by-prettify">typedef</span>=
</span><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span></span><span class=3D"s4"><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">value_type</span></span><span class=3D"s1"><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"> reference</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">;</span></span></p><p class=3D"p2"><s=
pan class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify">=
=C2=A0 =C2=A0</span></span><span class=3D"s2"><span style=3D"color: #008;"=
class=3D"styled-by-prettify">typedef</span></span><span class=3D"s1"><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span c=
lass=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-prettify">value=
_type</span></span><span class=3D"s1"><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">*</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> pointer</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>;</span></span></p><p class=3D"p2"><span class=3D"s1"><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></span><span cla=
ss=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify">typedef=
</span></span><span class=3D"s1"><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span></span><span class=3D"s2"><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">const</span></span><span class=3D"s1"><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span =
class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-prettify">valu=
e_type</span></span><span class=3D"s1"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> const_reference</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">;</span></span></p><p class=3D"p2"><span class=3D"s1"><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span><=
/span><span class=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">typedef</span></span><span class=3D"s1"><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span></span><span class=3D"s2"><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">const</span></span><span cl=
ass=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n></span><span class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by=
-prettify">value_type</span></span><span class=3D"s1"><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> const_pointer</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span></span></p><p class=3D"p2"><span class=3D"s=
1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0=
</span></span><span class=3D"s2"><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">typedef</span></span><span class=3D"s1"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span></span><span class=3D"s5"><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">std</span></span><s=
pan class=3D"s1"><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span></span><span class=3D"s5"><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">ptrdiff_t</span></span><span class=3D"s1"><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> difference_type</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">;</span></span></p><p clas=
s=3D"p2"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0</span><span style=3D"color: #800;" class=3D"styled-by-prettify">=
/* argument_type as described */</span></p><p class=3D"p2"><span class=3D"s=
1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0=
</span></span><span class=3D"s2"><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">typedef</span></span><span class=3D"s1"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span></span><span class=3D"s4"><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">value_type</span></=
span><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> argument_type</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-p=
rettify">typedef</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">con=
st</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> value_t=
ype const_argument_type</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">;</span></span></p><p class=3D"p1"><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0</span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">/* Tag dispatching */</span></p><p cl=
ass=3D"p2"><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> =C2=A0 =C2=A0</span></span><span class=3D"s2"><span style=3D"=
color: #008;" class=3D"styled-by-prettify">typedef</span></span><span class=
=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
/span><span class=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">struct</span></span><span class=3D"s1"><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"> tag_type</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">;</span></span></p><p class=3D"p2"><span class=3D"s1"><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></spa=
n><span class=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">static</span></span><span class=3D"s1"><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span></span><span class=3D"s2"><span style=3D"=
color: #008;" class=3D"styled-by-prettify">const</span></span><span class=
=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
/span><span class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">tag_type</span></span><span class=3D"s1"><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> tag</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span></span></p><p class=3D"p2"><span class=3D=
"s1"><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span></s=
pan></p><p class=3D"p1"><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span><span class=3D"s1"></span></p><p class=3D"p3"><span class=
=3D"s1"><span style=3D"color: #008;" class=3D"styled-by-prettify">template<=
/span></span><span class=3D"s3"><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify"><</span></span><span class=3D"s1"><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">class</span></span><span class=3D"s3"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> </span></span><span class=3D"s1"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span></span><span cla=
ss=3D"s3"><span style=3D"color: #000;" class=3D"styled-by-prettify"> E </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span =
class=3D"s1"><span style=3D"color: #008;" class=3D"styled-by-prettify">void=
</span></span><span class=3D"s3"><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> <br></span></span><span class=3D"s1"><span style=3D"color: #008;=
" class=3D"styled-by-prettify">class</span></span><span class=3D"s3"><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> traits</span></span></=
p><p class=3D"p4"><span class=3D"s3"><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> =C2=A0 =C2=A0</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><span class=3D"s2"><span style=3D"color: #008=
;" class=3D"styled-by-prettify">public</span></span><span class=3D"s3"><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span =
class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify">_tra=
its_commons</span></span><span class=3D"s3"><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">T</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">></span></span></p><p class=3D"p2"><span class=3D"s1"><span =
style=3D"color: #660;" class=3D"styled-by-prettify">{</span></span></p><p c=
lass=3D"p3"><span class=3D"s1"><span style=3D"color: #008;" class=3D"styled=
-by-prettify">private</span></span><span class=3D"s3"><span style=3D"color:=
#660;" class=3D"styled-by-prettify">:</span></span></p><p class=3D"p1"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></p><p cl=
ass=3D"p2"><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-=
by-prettify">=C2=A0 =C2=A0 </span></span><span class=3D"s2"><span style=3D"=
color: #008;" class=3D"styled-by-prettify">typedef</span></span><span class=
=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
/span><span class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">_traits_commons</span></span><span class=3D"s1"><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #00=
0;" 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"st=
yled-by-prettify"> _base_type</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span></span></p><p class=3D"p1"><span style=3D"color:=
#000;" class=3D"styled-by-prettify"><br></span></p><p class=3D"p3"><span c=
lass=3D"s1"><span style=3D"color: #008;" class=3D"styled-by-prettify">publi=
c</span></span><span class=3D"s3"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">:</span></span></p><p class=3D"p1"><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br></span></p><p class=3D"p2"><span cla=
ss=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0 =
=C2=A0</span></span><span class=3D"s2"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typedef</span></span><span class=3D"s1"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span class=
=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify">typename<=
/span></span><span class=3D"s1"><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span></span><span class=3D"s4"><span style=3D"color: #000=
;" class=3D"styled-by-prettify">_base_type</span></span><span class=3D"s1">=
<span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">value_type value_type</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></span=
></p><p class=3D"p2"><span class=3D"s1"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></span><span class=3D"s2"><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">typedef</span></span>=
<span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span></span><span class=3D"s2"><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">typename</span></span><span class=3D"s1"><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span></span><span class=3D"s4=
"><span style=3D"color: #000;" class=3D"styled-by-prettify">_base_type</spa=
n></span><span class=3D"s1"><span style=3D"color: #660;" class=3D"styled-by=
-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">reference reference</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">;</span></span></p><p class=3D"p2"><span class=3D"s1"><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></spa=
n><span class=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">typedef</span></span><span class=3D"s1"><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span></span><span class=3D"s2"><span style=3D=
"color: #008;" class=3D"styled-by-prettify">typename</span></span><span cla=
ss=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
></span><span class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-=
prettify">_base_type</span></span><span class=3D"s1"><span style=3D"color: =
#660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">pointer pointer</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">;</span></span></p><p class=3D"p2"><span c=
lass=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=
=A0 =C2=A0</span></span><span class=3D"s2"><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">typedef</span></span><span class=3D"s1"><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span class=
=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify">typename<=
/span></span><span class=3D"s1"><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span></span><span class=3D"s4"><span style=3D"color: #000=
;" class=3D"styled-by-prettify">_base_type</span></span><span class=3D"s1">=
<span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">const_reference const_ref=
erence</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan></span></p><p class=3D"p2"><span class=3D"s1"><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></span><span class=3D=
"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify">typedef</spa=
n></span><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span></span><span class=3D"s2"><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">typename</span></span><span class=3D"s1"><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span cl=
ass=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-prettify">_base_=
type</span></span><span class=3D"s1"><span style=3D"color: #660;" class=3D"=
styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">const_pointer const_pointer</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">;</span></span></p><p class=3D"p2"><span class=
=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =
=C2=A0</span></span><span class=3D"s2"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typedef</span></span><span class=3D"s1"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span class=
=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify">typename<=
/span></span><span class=3D"s1"><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span></span><span class=3D"s4"><span style=3D"color: #000=
;" class=3D"styled-by-prettify">_base_type</span></span><span class=3D"s1">=
<span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">difference_type differenc=
e_type</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan></span></p><p class=3D"p2"><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br></span></p><p class=3D"p2"><span class=3D"s1"><span style=
=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0 =C2=A0</span></span><=
span class=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>typedef</span></span><span class=3D"s1"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span></span><span class=3D"s2"><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typename</span></span><span class=
=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
/span><span class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">_base_type</span></span><span class=3D"s1"><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">argument_type argument_type</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typedef</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><font color=3D"#000088"><span=
style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> _base_type</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">const_argument_type const_argum=
ent_type</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;<=
/span></font><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-prettif=
y">typedef</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"> _base_type=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">tag_type tag_type<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></s=
pan></p><p class=3D"p2"><span class=3D"s1"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">};</span></span></p><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span><p class=3D"p2"><span class=3D"s2">=
<span style=3D"color: #008;" class=3D"styled-by-prettify">template</span></=
span><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;</span></span><span class=3D"s2"><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">class</span></span><span class=3D"s1"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> <br></span></span><span class=3D"s2"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span></span><span cla=
ss=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> traits=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span></span><span class=3D"s2">=
<span style=3D"color: #008;" class=3D"styled-by-prettify">typename</span></=
span><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span></span><span class=3D"s5"><span style=3D"color: #000;" class=
=3D"styled-by-prettify">std</span></span><span class=3D"s1"><span style=3D"=
color: #660;" class=3D"styled-by-prettify">::</span></span><span class=3D"s=
5"><span style=3D"color: #000;" class=3D"styled-by-prettify">enable_if</spa=
n></span><span class=3D"s1"><span style=3D"color: #660;" class=3D"styled-by=
-prettify"><</span></span><span class=3D"s5"><span style=3D"color: #000;=
" class=3D"styled-by-prettify">std</span></span><span class=3D"s1"><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">::</span></span><span cla=
ss=3D"s5"><span style=3D"color: #000;" class=3D"styled-by-prettify">is_clas=
s</span></span><span class=3D"s1"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify"><</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">va=
lue</span><span style=3D"color: #660;" class=3D"styled-by-prettify">>::<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">type</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">></span></span=
></p><p class=3D"p4"><span class=3D"s3"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> =C2=A0 =C2=A0</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span></span><span class=3D"s2"><span style=3D"color: =
#008;" class=3D"styled-by-prettify">public</span></span><span class=3D"s3">=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><s=
pan class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify">=
_traits_commons</span></span><span class=3D"s3"><span style=3D"color: #660;=
" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">T</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">></span></span></p><p class=3D"p2"><span class=3D"s1"><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">{</span></span></p>=
<p class=3D"p3"><span class=3D"s1"><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">private</span></span><span class=3D"s3"><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">:</span></span></p><p class=3D"p2"=
><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> <br>=C2=A0 =C2=A0</span></span><span class=3D"s2"><span style=3D"color:=
#008;" class=3D"styled-by-prettify">typedef</span></span><span class=3D"s1=
"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span>=
<span class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-prettify=
">_traits_commons</span></span><span class=3D"s1"><span style=3D"color: #66=
0;" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">T</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> _base_type</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">;</span></span></p><p class=3D"p1"><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></span></p><p class=3D"p3"><span class=
=3D"s1"><span style=3D"color: #008;" class=3D"styled-by-prettify">public</s=
pan></span><span class=3D"s3"><span style=3D"color: #660;" class=3D"styled-=
by-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br><br></span></span></p><p class=3D"p2"><span class=3D"s1"><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0 =C2=A0</span></span>=
<span class=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify=
">typedef</span></span><span class=3D"s1"><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span></span><span class=3D"s2"><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">typename</span></span><span class=
=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
/span><span class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">_base_type</span></span><span class=3D"s1"><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">value_type value_type</span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">;</span></span></p><p class=3D"p2"><sp=
an class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
=C2=A0 =C2=A0</span></span><span class=3D"s2"><span style=3D"color: #008;" =
class=3D"styled-by-prettify">typedef</span></span><span class=3D"s1"><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span cl=
ass=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify">typena=
me</span></span><span class=3D"s1"><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span></span><span class=3D"s4"><span style=3D"color: #=
000;" class=3D"styled-by-prettify">_base_type</span></span><span class=3D"s=
1"><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify">reference reference</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></spa=
n></p><p class=3D"p2"><span class=3D"s1"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></span><span class=3D"s2"><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">typedef</span></span>=
<span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span></span><span class=3D"s2"><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">typename</span></span><span class=3D"s1"><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span></span><span class=3D"s4=
"><span style=3D"color: #000;" class=3D"styled-by-prettify">_base_type</spa=
n></span><span class=3D"s1"><span style=3D"color: #660;" class=3D"styled-by=
-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">pointer pointer</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">;</span></span></p><p class=3D"p2"><span class=3D"s1"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></span>=
<span class=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify=
">typedef</span></span><span class=3D"s1"><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span></span><span class=3D"s2"><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">typename</span></span><span class=
=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
/span><span class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">_base_type</span></span><span class=3D"s1"><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">const_reference const_reference</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span></span></p><p class=
=3D"p2"><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> =C2=A0 =C2=A0</span></span><span class=3D"s2"><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">typedef</span></span><span class=3D=
"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></sp=
an><span class=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">typename</span></span><span class=3D"s1"><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span></span><span class=3D"s4"><span style=
=3D"color: #000;" class=3D"styled-by-prettify">_base_type</span></span><spa=
n class=3D"s1"><span style=3D"color: #660;" class=3D"styled-by-prettify">::=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">const_poin=
ter const_pointer</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">;</span></span></p><p class=3D"p2"><span class=3D"s1"><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></span><sp=
an class=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify">t=
ypedef</span></span><span class=3D"s1"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span></span><span class=3D"s2"><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typename</span></span><span class=
=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
/span><span class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">_base_type</span></span><span class=3D"s1"><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">size_type size_type</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">;</span></span></p><p class=3D"p2"><span=
class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
=C2=A0 =C2=A0</span></span><span class=3D"s2"><span style=3D"color: #008;" =
class=3D"styled-by-prettify">typedef</span></span><span class=3D"s1"><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span cl=
ass=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify">typena=
me</span></span><span class=3D"s1"><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span></span><span class=3D"s4"><span style=3D"color: #=
000;" class=3D"styled-by-prettify">_base_type</span></span><span class=3D"s=
1"><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify">difference_type differ=
ence_type</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;=
</span></span></p><p class=3D"p2"><span class=3D"s1"><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span></span><span class=
=3D"s2"><span style=3D"color: #008;" class=3D"styled-by-prettify">typedef</=
span></span><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span></span><span class=3D"s2"><span style=3D"color: #008;=
" class=3D"styled-by-prettify">typename</span></span><span class=3D"s1"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span=
class=3D"s4"><span style=3D"color: #000;" class=3D"styled-by-prettify">_ba=
se_type</span></span><span class=3D"s1"><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">return_type return_type</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br><br>=C2=A0 =C2=A0</span><span style=3D"color: #800;=
" class=3D"styled-by-prettify">/* Enabled if std::is_class<T> (discus=
sible). Notice that argument_type is now a reference */</span></span></p><p=
class=3D"p2"><span class=3D"s1"><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> =C2=A0 =C2=A0</span></span><span class=3D"s2"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">typedef</span></span><span c=
lass=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an></span><span class=3D"s4"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">reference</span></span><span class=3D"s1"><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> argument_type</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></p><p class=3D"p2"><span=
class=3D"s1"><span style=3D"color: #000;" class=3D"styled-by-prettify">=C2=
=A0 =C2=A0</span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
typedef</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><font color=3D"#000088"><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">const</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> reference</span></font><font color=3D"#000088"><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> const_argument_type</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">;</span></font><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span></span></p><p cla=
ss=3D"p2"><span class=3D"s1"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">=C2=A0 =C2=A0</span></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typedef</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> _base_type</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">tag_type tag_type</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span></p><p class=3D"p2"><span class=3D"s1"><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">};</span></span></p></div></code></=
div><br>This is obviously a simplification,=C2=A0but I believe it works to =
demonstrate my intents. Getting back to the previous examples, push_back wo=
uld now be declared like this:</div><div><br></div><div><div class=3D"prett=
yprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-wor=
d; background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div =
class=3D"subprettyprint"><pre style=3D"font-size: 12px; background-color: r=
gb(250, 255, 250);"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> pu=
sh_back </span><span style=3D"color: #660;" class=3D"styled-by-prettify">(<=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> traits</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><font=
color=3D"#000000"><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">const_argum=
ent_type val</span></font><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">);</span></pre></div></code></div><br>This would mean a pass-by-co=
py for non-class types and a const_reference for class types. By using this=
approach I believe that argument passing can be cleaner and more efficient=
.. Has this been proposed before? What do you think? I've been thinking =
about making a proposal to the C++ committee and though of following their =
recommendation of posting on the forums first :)</div><div><br></div><div>T=
hank you immensely in advance for your feedback,</div><div>Happy coding!</d=
iv><div><br></div></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />
------=_Part_1267_1188108203.1454808797578--
------=_Part_1266_1154080445.1454808797575--
.