Topic: An automatically-provided (C-level) varargs iterator


Author: Daryle Walker <darylew@gmail.com>
Date: Tue, 5 Nov 2013 02:12:54 -0800 (PST)
Raw View
------=_Part_1348_7290899.1383646374447
Content-Type: text/plain; charset=ISO-8859-1

When you write a function with the C-level variable arguments, you declare
a std::va_list object, initialize it with va_start, either pass it to
another function or repeatedly call va_arg on it, then close it with va_end.
Since C99, you can make copies of the pseudo-iterator with va_copy.
Nowadays, you need either a scope-exit class or a try-catch structure for
va_end to work with exceptions.

In another thread I discuss that an updated variant of va_start could omit
the name of the last pre-ellipsis argument since a C++ compiler always
knows what it is, unlike classic C implementations. I later realized that
we can go further and automate more of the process. I got inspired by
seeing the Standard paragraph about __func__, which lets a function's
definition know the name of itself (as a C-string). Why not provide a
va_list that's already initialized to the function's ... parameter?! (Its
code shouldn't be included if it's never referenced.)

I came up with a proposal at
<http://htmlpreview.github.io/?https://raw.github.com/CTMacUser/multiarray-iso-proposal/master/va-proposal.html>.
I don't have an implementation since that would require me to be a compiler
writer. (Maybe I can finish one by C++2020.) So if anyone here is part of
GCC, Clang/LLVM, Visual Studio, or other major compiler, I'm wondering if
this idea is doable. I think it is.

Could the example I provide be improved? I obviously haven't tested it,
either.

Am I missing anything important?

Daryle W.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_1348_7290899.1383646374447
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">When you write a function with the C-level variable argume=
nts, you declare a <span style=3D"font-family: courier new,monospace;">std:=
:va_list</span> object, initialize it with <span style=3D"font-family: cour=
ier new,monospace;">va_start</span>, either pass it to another function or =
repeatedly call <span style=3D"font-family: courier new,monospace;">va_arg<=
/span> on it, then close it with <span style=3D"font-family: courier new,mo=
nospace;">va_end</span>. Since C99, you can make copies of the pseudo-itera=
tor with <span style=3D"font-family: courier new,monospace;">va_copy</span>=
.. Nowadays, you need either a scope-exit class or a try-catch structure for=
 <span style=3D"font-family: courier new,monospace;">va_end</span> to work =
with exceptions.<br><br>In another thread I discuss that an updated variant=
 of <span style=3D"font-family: courier new,monospace;">va_start</span> cou=
ld omit the name of the last pre-ellipsis argument since a C++ compiler alw=
ays knows what it is, unlike classic C implementations. I later realized th=
at we can go further and automate more of the process. I got inspired by se=
eing the Standard paragraph about __func__, which lets a function's definit=
ion know the name of itself (as a C-string). Why not provide a <span style=
=3D"font-family: courier new,monospace;">va_list</span> that's already init=
ialized to the function's <span style=3D"font-family: courier new,monospace=
;">...</span> parameter?! (Its code shouldn't be included if it's never ref=
erenced.)<br><br>I came up with a proposal at &lt;http://htmlpreview.github=
..io/?https://raw.github.com/CTMacUser/multiarray-iso-proposal/master/va-pro=
posal.html&gt;. I don't have an implementation since that would require me =
to be a compiler writer. (Maybe I can finish one by C++2020.) So if anyone =
here is part of GCC, Clang/LLVM, Visual Studio, or other major compiler, I'=
m wondering if this idea is doable. I think it is.<br><br>Could the example=
 I provide be improved? I obviously haven't tested it, either.<br><br>Am I =
missing anything important?<br><br>Daryle W.<br><br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1348_7290899.1383646374447--

.


Author: David Krauss <potswa@gmail.com>
Date: Wed, 06 Nov 2013 08:12:50 +0800
Raw View
This is a multi-part message in MIME format.
--------------040303030503070906070107
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 11/5/13 6:12 PM, Daryle Walker wrote:
> In another thread I discuss that an updated variant of va_start could omit
> the name of the last pre-ellipsis argument since a C++ compiler always
> knows what it is, unlike classic C implementations.

No. How are C++ and C different here? Nothing has changed.

Did you see my last reply on the previous thread or my answer to your
StackOverflow question?

> Why not provide a
> va_list that's already initialized to the function's ... parameter?! (Its
> code shouldn't be included if it's never referenced.)

I assure you they thought of that already the first time, when
prototypes were first added to C. Things are done this way for
compatibility, and convenience matters little because nobody writes
these functions any more.

> Am I missing anything important?

Motivation. I already demonstrated that combining va_args and parameter
packs usually requires some kind of placemarker to separate them, due to
requirements on both sides.

Anyway, va_args is widely considered obsolete; it doesn't work with much
of C++. 5.2.2/7:

 5.

    Passing a potentially-evaluated argument of class type (Clause 9)
    having a non- trivial copy constructor, a non-trivial move
    constructor, or a non-trivial destructor, with no corresponding
    parameter, is conditionally-supported with implementation-defined
    semantics.

C++ International Standard
A more modern way would be std::initializer_list (or a proper container)
over some polymorphic type, using union, discriminated union, type
erasure, or virtual dispatch.

C++ International Standard

--

---
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/.

--------------040303030503070906070107
Content-Type: text/html; charset=ISO-8859-1

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 11/5/13 6:12 PM, Daryle Walker
      wrote:<br>
    </div>
    <blockquote
      cite="mid:170d2eba-ceb7-468d-b07c-42eef745b53a@isocpp.org"
      type="cite">
      <pre wrap="">In another thread I discuss that an updated variant of va_start could omit
the name of the last pre-ellipsis argument since a C++ compiler always
knows what it is, unlike classic C implementations.</pre>
    </blockquote>
    <br>
    No. How are C++ and C different here? Nothing has changed.<br>
    <br>
    Did you see my last reply on the previous thread or my answer to
    your StackOverflow question?<br>
    <br>
    <blockquote type="cite">
      <pre wrap="">Why not provide a
va_list that's already initialized to the function's ... parameter?! (Its
code shouldn't be included if it's never referenced.)</pre>
    </blockquote>
    <br>
    I assure you they thought of that already the first time, when
    prototypes were first added to C. Things are done this way for
    compatibility, and convenience matters little because nobody writes
    these functions any more.<br>
    <br>
    <blockquote
      cite="mid:170d2eba-ceb7-468d-b07c-42eef745b53a@isocpp.org"
      type="cite">
      <pre wrap="">Am I missing anything important?</pre>
    </blockquote>
    <br>
    Motivation. I already demonstrated that combining va_args and
    parameter packs usually requires some kind of placemarker to
    separate them, due to requirements on both sides.<br>
    <br>
    Anyway, va_args is widely considered obsolete; it doesn't work with
    much of C++. 5.2.2/7:<br>
    <br>
    <meta http-equiv="Content-Type" content="text/html;
      charset=ISO-8859-1">
    <div class="page" title="Page 113">
      <div class="layoutArea">
        <div class="column">
          <ol start="5" style="list-style-type: none">
            <li>
              <p><span style="font-size: 10.000000pt; font-family:
                  'LMRoman10'">Passing a potentially-evaluated argument
                  of class type (Clause </span><span style="font-size:
                  10.000000pt; font-family: 'LMRoman10'; color:
                  rgb(0.000000%, 0.000000%, 100.000000%)">9</span><span
                  style="font-size: 10.000000pt; font-family:
                  'LMRoman10'">) having a non-
                  trivial copy constructor, a non-trivial move
                  constructor, or a non-trivial destructor, with no
                  corresponding
                  parameter, is conditionally-supported with
                  implementation-defined semantics.
                </span></p>
            </li>
          </ol>
        </div>
      </div>
    </div>
    <title>C++ International Standard</title>
    <br>
    A more modern way would be std::initializer_list (or a proper
    container) over some polymorphic type, using union, discriminated
    union, type erasure, or virtual dispatch.<br>
    <br>
    <meta http-equiv="Content-Type" content="text/html;
      charset=ISO-8859-1">
    <title>C++ International Standard</title>
  </body>
</html>

<p></p>

-- <br />
&nbsp;<br />
--- <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 email to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />

--------------040303030503070906070107--

.


Author: Daryle Walker <darylew@gmail.com>
Date: Wed, 6 Nov 2013 13:16:39 -0800 (PST)
Raw View
------=_Part_619_7346239.1383772599924
Content-Type: text/plain; charset=ISO-8859-1

On Tuesday, November 5, 2013 7:12:50 PM UTC-5, David Krauss wrote:
>
>  On 11/5/13 6:12 PM, Daryle Walker wrote:
>
> In another thread I discuss that an updated variant of va_start could omit
> the name of the last pre-ellipsis argument since a C++ compiler always
> knows what it is, unlike classic C implementations.
>
>
> No. How are C++ and C different here? Nothing has changed.
>

How should I correct this? Just remove the ", unlike classic C
implementations" part?


> Did you see my last reply on the previous thread or my answer to your
> StackOverflow question?
>
>  Why not provide a
> va_list that's already initialized to the function's ... parameter?! (Its
> code shouldn't be included if it's never referenced.)
>
>
> I assure you they thought of that already the first time, when prototypes
> were first added to C. Things are done this way for compatibility, and
> convenience matters little because nobody writes these functions any more.
>

Were you part of the C Standard committee back then, or did you find some
notes about this? I would like to read them. What compatibility problems
could there be to the implementation adding a variant of va_start (not the
actual macro) to the initialization guts of a function?

 Am I missing anything important?
>
>
> Motivation. I already demonstrated that combining va_args and parameter
> packs usually requires some kind of placemarker to separate them, due to
> requirements on both sides.
>

Although inspired by our previous thread, this proposal is a separate
thing. That other issue should be a bug fix to C++11, and this proposal is
aimed at C++17. This proposal is applicable to all functions, even ones
without C++-level variadics. The example in the proposal doesn't use
C++-level variadics, but a constructor that takes only an ellipsis (which
is straight-out banned by va_start).


> Anyway, va_args is widely considered obsolete; it doesn't work with much
> of C++. 5.2.2/7:
>
>
>    1.
>
>    Passing a potentially-evaluated argument of class type (Clause 9)
>    having a non- trivial copy constructor, a non-trivial move constructor, or
>    a non-trivial destructor, with no corresponding parameter, is
>    conditionally-supported with implementation-defined semantics.
>
>
In other words, if an object that is not of a trivially-copyable type is
passed through the ellipsis parameter, support is implementation-defined.
Was that paragraph written before the term "trivially copyable" was
invented in another section of the Standard? There's a lot of types that
can still be passed. Further, we could define a function template that
returns a given object if its type is trivially copyable, and a pointer to
said object otherwise.


> A more modern way would be std::initializer_list (or a proper container)
> over some polymorphic type, using union, discriminated union, type erasure,
> or virtual dispatch.
>

You mentioned ABI compatibility in the other thread. I think using a
std::initializer_list<std::any> (where the element type is an adaptation of
boost::any) would violate ABI compatibility with an ellipsis parameter.

Daryle W.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_619_7346239.1383772599924
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Tuesday, November 5, 2013 7:12:50 PM UTC-5, David Kraus=
s wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0=
..8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
 =20
   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div>On 11/5/13 6:12 PM, Daryle Walker
      wrote:<br>
    </div>
    <blockquote type=3D"cite">
      <pre>In another thread I discuss that an updated variant of va_start =
could omit=20
the name of the last pre-ellipsis argument since a C++ compiler always=20
knows what it is, unlike classic C implementations.</pre>
    </blockquote>
    <br>
    No. How are C++ and C different here? Nothing has changed.
    <br></div></blockquote><div><br>How should I correct this? Just remove =
the ", unlike classic C implementations" part?<br>&nbsp;</div><blockquote c=
lass=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px=
 #ccc solid;padding-left: 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#000000">
    Did you see my last reply on the previous thread or my answer to
    your StackOverflow question?<br>
    <br>
    <blockquote type=3D"cite">
      <pre>Why not provide a=20
va_list that's already initialized to the function's ... parameter?! (Its=
=20
code shouldn't be included if it's never referenced.)</pre>
    </blockquote>
    <br>
    I assure you they thought of that already the first time, when
    prototypes were first added to C. Things are done this way for
    compatibility, and convenience matters little because nobody writes
    these functions any more.
    <br></div></blockquote><div><br>Were you part of the C Standard committ=
ee back then, or did you find some notes about this? I would like to read t=
hem. What compatibility problems could there be to the implementation addin=
g a variant of <span style=3D"font-family: courier new,monospace;">va_start=
</span> (not the actual macro) to the initialization guts of a function?<br=
><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left=
: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div bgcolor=3D"#FF=
FFFF" text=3D"#000000">
    <blockquote type=3D"cite">
      <pre>Am I missing anything important?</pre>
    </blockquote>
    <br>
    Motivation. I already demonstrated that combining va_args and
    parameter packs usually requires some kind of placemarker to
    separate them, due to requirements on both sides.
    <br></div></blockquote><div><br>Although inspired by our previous threa=
d, this proposal is a separate thing. That other issue should be a bug fix =
to C++11, and this proposal is aimed at C++17. This proposal is applicable =
to all functions, even ones without C++-level variadics. The example in the=
 proposal doesn't use C++-level variadics, but a constructor that takes onl=
y an ellipsis (which is straight-out banned by <span style=3D"font-family: =
courier new,monospace;">va_start</span>).<br>&nbsp;</div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#000000">
    Anyway, va_args is widely considered obsolete; it doesn't work with
    much of C++. 5.2.2/7:<br>
    <br>
   =20
    <div title=3D"Page 113">
      <div>
        <div>
          <ol start=3D"5" style=3D"list-style-type:none">
            <li>
              <p><span style=3D"font-size:10.000000pt;font-family:'LMRoman1=
0'">Passing a potentially-evaluated argument
                  of class type (Clause </span><span style=3D"font-size:10.=
000000pt;font-family:'LMRoman10';color:rgb(0.000000%,0.000000%,100.000000%)=
">9</span><span style=3D"font-size:10.000000pt;font-family:'LMRoman10'">) h=
aving a non-
                  trivial copy constructor, a non-trivial move
                  constructor, or a non-trivial destructor, with no
                  corresponding
                  parameter, is conditionally-supported with
                  implementation-defined semantics.</span></p></li></ol></d=
iv></div></div></div></blockquote><div><br>In other words, if an object tha=
t is not of a trivially-copyable type is passed through the ellipsis parame=
ter, support is implementation-defined. Was that paragraph written before t=
he term "trivially copyable" was invented in another section of the Standar=
d? There's a lot of types that can still be passed. Further, we could defin=
e a function template that returns a given object if its type is trivially =
copyable, and a pointer to said object otherwise.<br>&nbsp;</div><blockquot=
e class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: =
1px #ccc solid;padding-left: 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#000000=
">
    A more modern way would be std::initializer_list (or a proper
    container) over some polymorphic type, using union, discriminated
    union, type erasure, or virtual dispatch.
    <br></div></blockquote><div><br>You mentioned ABI compatibility in the =
other thread. I think using a <span style=3D"font-family: courier new,monos=
pace;">std::initializer_list&lt;std::any&gt;</span> (where the element type=
 is an adaptation of <span style=3D"font-family: courier new,monospace;">bo=
ost::any</span>) would violate ABI compatibility with an ellipsis parameter=
..<br><br>Daryle W.<br><br></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_619_7346239.1383772599924--

.


Author: David Krauss <potswa@gmail.com>
Date: Thu, 07 Nov 2013 07:45:32 +0800
Raw View
On 11/7/13 5:16 AM, Daryle Walker wrote:
> On Tuesday, November 5, 2013 7:12:50 PM UTC-5, David Krauss wrote:
>>   On 11/5/13 6:12 PM, Daryle Walker wrote:
>>
>>   Why not provide a
>> va_list that's already initialized to the function's ... parameter?! (Its
>> code shouldn't be included if it's never referenced.)
>>
>>
>> I assure you they thought of that already the first time, when prototypes
>> were first added to C. Things are done this way for compatibility, and
>> convenience matters little because nobody writes these functions any more.
>>
> Were you part of the C Standard committee back then, or did you find some
> notes about this? I would like to read them.

No, your proposal is just an obvious design. They must have had a reason
for implementing a less-obvious design, and compatibility and ease of
implementation are the usual suspects.

The notes from 1986-1996 appear to be listed but not published online.

> What compatibility problems
> could there be to the implementation adding a variant of va_start (not the
> actual macro) to the initialization guts of a function?

It's a completely new feature which would touch a sensitive part of the
ABI in a new way.

>   Am I missing anything important?

Yes, motivation. Sorry to be a naysayer but you're just wasting your own
time here. I don't think many folks will even bother to read a C++-only
proposal about va_args before voting against it. Try proposing it for C
instead.

If you don't take my word for it, go right ahead. I myself am just a
spectator, not on any committee (nor have ever been). But I'm done with
this topic.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Jean-Marc Bourguet <jm.bourguet@gmail.com>
Date: Thu, 7 Nov 2013 05:26:42 -0800 (PST)
Raw View
------=_Part_7113_1831655.1383830802947
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Le mercredi 6 novembre 2013 22:16:39 UTC+1, Daryle Walker a =E9crit :

>
>> I assure you they thought of that already the first time, when prototype=
s=20
>> were first added to C. Things are done this way for compatibility, and=
=20
>> convenience matters little because nobody writes these functions any mor=
e.=20
>>
>
> Were you part of the C Standard committee back then, or did you find some=
=20
> notes about this? I would like to read them. What compatibility problems=
=20
> could there be to the implementation adding a variant of va_start (not=20
> the actual macro) to the initialization guts of a function?
>
>
I wasn't there, but looks at the C rationale.  The C99 version is built=20
over the C90 one.

The C committee has always been very reluctant (far more than the C++ one)=
=20
to standardize something else than existing practice (and the problems of=
=20
C99 for which they diverted from that line of conduct is attributed to the=
=20
fact they diverted from it)  or something very similar like the common=20
subset of various existing practices. I think it is the case for stdarg.h=
=20
content (there was something called vararg.h previously).

Yours,

--=20
Jean-Marc

--=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_7113_1831655.1383830802947
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Le mercredi 6 novembre 2013 22:16:39 UTC+1, Daryle Walker =
a =E9crit&nbsp;:<br><blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.=
8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor=3D"#FFFFFF" t=
ext=3D"#000000"><br>
    I assure you they thought of that already the first time, when
    prototypes were first added to C. Things are done this way for
    compatibility, and convenience matters little because nobody writes
    these functions any more.
    <br></div></blockquote><div><br>Were you part of the C Standard committ=
ee back then, or did you find some notes about this? I would like to read t=
hem. What compatibility problems could there be to the implementation addin=
g a variant of <span style=3D"font-family:courier new,monospace">va_start</=
span> (not the actual macro) to the initialization guts of a function?<br><=
br></div></div></blockquote><div><br></div><div>I wasn't there, but looks a=
t the C rationale. &nbsp;The C99 version is built over the C90 one.</div><d=
iv><br></div><div>The C committee has always been very reluctant (far more =
than the C++ one) to standardize something else than existing practice (and=
 the problems of C99 for which they diverted from that line of conduct is a=
ttributed to the fact they diverted from it) &nbsp;or something very simila=
r like the common subset of various existing practices. I think it is the c=
ase for stdarg.h content (there was something called vararg.h previously).<=
/div><div><br></div><div>Yours,</div><div><br></div><div>--&nbsp;</div><div=
>Jean-Marc</div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_7113_1831655.1383830802947--

.


Author: Daryle Walker <darylew@gmail.com>
Date: Sun, 10 Nov 2013 14:53:22 -0800 (PST)
Raw View
------=_Part_231_13763869.1384124002192
Content-Type: text/plain; charset=ISO-8859-1

On Wednesday, November 6, 2013 6:45:32 PM UTC-5, David Krauss wrote:
>
> On 11/7/13 5:16 AM, Daryle Walker wrote:
> > On Tuesday, November 5, 2013 7:12:50 PM UTC-5, David Krauss wrote:
> >>   On 11/5/13 6:12 PM, Daryle Walker wrote:
> >>
> >>   Why not provide a
> >> va_list that's already initialized to the function's ... parameter?!
> (Its
> >> code shouldn't be included if it's never referenced.)
> >>
> >>
> >> I assure you they thought of that already the first time, when
> prototypes
> >> were first added to C. Things are done this way for compatibility, and
> >> convenience matters little because nobody writes these functions any
> more.
> >>
> > Were you part of the C Standard committee back then, or did you find
> some
> > notes about this? I would like to read them.
>
> No, your proposal is just an obvious design. They must have had a reason
> for implementing a less-obvious design, and compatibility and ease of
> implementation are the usual suspects.
>

So your assertions were unsubstantiated guesswork? I can guess too. The
implementation of __func__ is a code-less static initialization. But __va__would require dynamic initialization; it must be done at run-time instead
of compile-time. C'ers generally don't do that. (They leave it to the
C++'ers.)


> The notes from 1986-1996 appear to be listed but not published online.
>
> > What compatibility problems
> > could there be to the implementation adding a variant of va_start (not
> the
> > actual macro) to the initialization guts of a function?
>
> It's a completely new feature which would touch a sensitive part of the
> ABI in a new way.
>

The proposal is the compiler sticking in (somethings like) va_start and
va_end, instead of the user doing it. It's completely internal. ABI issues
are non-existent since external code never sees it.


> >   Am I missing anything important?
>
> Yes, motivation. Sorry to be a naysayer but you're just wasting your own
> time here. I don't think many folks will even bother to read a C++-only
> proposal about va_args before voting against it. Try proposing it for C
> instead.
>

Since the proposal involves a pseudo-constructor and -destructor, the C
committee would probably ask for it to be sent back here.

As for use, instead of making some new thing like
std::intializer_list<std::any>, we could smarten up what we got:

// va_list semi-wrapper, definitely not thread-safe,
// also NOT TESTED
class va_iterator
{
    va_list current, backup;

public:
    explicit va_iterator( va_list &va )  // noexcept
    { va_copy(current, va); va_copy(backup, va);}
    va_iterator( const va_iterator &that )  // noexcept
    { va_copy(current, that.current); va_copy(backup, that.backup); }
    va_iterator( va_iterator && ) = delete;
    ~va_iterator() // noexcept
    { va_end(backup); va_end(current); }

    va_iterator &  operator =( const va_iterator &that ) // noexcept
    {
        if ( &current != &that.current )
            { va_end(current); va_copy(current, that.current); }
        if ( &backup != &that.backup )
            { va_end(backup); va_copy(backup, that.backup); }
        return *this;
    }
    va_iterator &  operator =( va_iterator && ) = delete;

    void  reset()  // noexcept
    { va_end(current); va_copy(current, backup); }

    template <typename T>
    auto  extract() /*noexcept*/ -> typename vararg_type<T>::type
    {
        using return_type = decltype( this->template extract<T>() );

        return va_arg( current, return_type );
    }
    template <typename T, size_t N>
    void  extract( T (&out)[N] )
    {
        using inner_type = remove_all_extents_t<T[N]>;

        auto const  p = reinterpret_cast<inner_type *>( this->template
         extract<T[N]>() );  // original type was T*

        copy( p, p + sizeof(out) / sizeof(inner_type),
         reinterpret_cast<inner_type *>(&out) );
    }
    void  extract( nullptr_t &out )
    {
        // better be void*
        auto const  p = this->template extract<nullptr_t>();

        assert( p == nullptr );
        out = nullptr;
    }
    template <typename T>
    void  extract( T &out )
    { out = static_cast<T>(this->template extract<T>()); }
    template <typename T>
    void  extract( reference_wrapper<T> r )
    { extract(r.get()); }
    template <typename T, typename U, typename ...V>
    void  extract( T&& first, U&& second, V&& ...rest )
    {
        extract( forward<T>(first) );
        extract( forward<U>(second), forward<V>(rest)... );
    }
};

inline
void  extract_impl( va_iterator &, tuple<> &, index_sequence<> )  {}

template <typename T, typename ...U, size_t ...I>
void  extract_impl( va_iterator &va, tuple<T, U...> &t,
 index_sequence<I...> )
{ va.extract( get<I>(t)... ); }

template <typename ...T>
tuple<T...>  extract( va_iterator &va )
{
    decltype( extract<T...>(va) )  result;

    extract_impl( va, result, index_sequence_for<T...>{} );
    return result;
}

Where the "extract_impl" functions would be hidden. And vararg_type is a
transformation type-trait class that returns the post-mangled type that has
been through a ... parameter. The constructor takes an already-set va_listobject. That object is either a function parameter itself, or was set from
a va_start or va_copy call, which would require a (guard-scoped) va_endcall. Or we could have something like
__va__ to take care of that:

// The new hotness
return extract<Whatever...>( va_iterator{__va__} );


> If you don't take my word for it, go right ahead. I myself am just a
> spectator, not on any committee (nor have ever been). But I'm done with
> this topic.
>

 Daryle W.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_231_13763869.1384124002192
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, November 6, 2013 6:45:32 PM UTC-5, David Kra=
uss wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:=
 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 11/7/13 5:16 AM, =
Daryle Walker wrote:
<br>&gt; On Tuesday, November 5, 2013 7:12:50 PM UTC-5, David Krauss wrote:
<br>&gt;&gt; &nbsp; On 11/5/13 6:12 PM, Daryle Walker wrote:
<br>&gt;&gt; &nbsp;=20
<br>&gt;&gt; &nbsp; Why not provide a
<br>&gt;&gt; va_list that's already initialized to the function's ... param=
eter?! (Its
<br>&gt;&gt; code shouldn't be included if it's never referenced.)
<br>&gt;&gt;
<br>&gt;&gt; &nbsp;=20
<br>&gt;&gt; I assure you they thought of that already the first time, when=
 prototypes
<br>&gt;&gt; were first added to C. Things are done this way for compatibil=
ity, and
<br>&gt;&gt; convenience matters little because nobody writes these functio=
ns any more.
<br>&gt;&gt;
<br>&gt; Were you part of the C Standard committee back then, or did you fi=
nd some
<br>&gt; notes about this? I would like to read them.
<br>
<br>No, your proposal is just an obvious design. They must have had a reaso=
n=20
<br>for implementing a less-obvious design, and compatibility and ease of=
=20
<br>implementation are the usual suspects.

<br></blockquote><div><br>So your assertions were unsubstantiated guesswork=
? I can guess too. The implementation of <span style=3D"font-family: courie=
r new,monospace;">__func__</span> is a code-less static initialization. But=
 <span style=3D"font-family: courier new,monospace;">__va__</span> would re=
quire dynamic initialization; it must be done at run-time instead of compil=
e-time. C'ers generally don't do that. (They leave it to the C++'ers.)<br>&=
nbsp;</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left=
: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">The notes from 1986=
-1996 appear to be listed but not published online.
<br>
<br>&gt; What compatibility problems
<br>&gt; could there be to the implementation adding a variant of va_start =
(not the
<br>&gt; actual macro) to the initialization guts of a function?
<br>
<br>It's a completely new feature which would touch a sensitive part of the=
=20
<br>ABI in a new way.

<br></blockquote><div><br>The proposal is the compiler sticking in (somethi=
ngs like) <span style=3D"font-family: courier new,monospace;">va_start</spa=
n> and <span style=3D"font-family: courier new,monospace;">va_end</span>, i=
nstead of the user doing it. It's completely internal. ABI issues are non-e=
xistent since external code never sees it.<br>&nbsp;</div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;">&gt; &nbsp; Am I missing anything important?
<br>
<br>Yes, motivation. Sorry to be a naysayer but you're just wasting your ow=
n=20
<br>time here. I don't think many folks will even bother to read a C++-only=
=20
<br>proposal about va_args before voting against it. Try proposing it for C=
=20
<br>instead.

<br></blockquote><div><br>Since the proposal involves a pseudo-constructor =
and -destructor, the C committee would probably ask for it to be sent back =
here.<br><br>As for use, instead of making some new thing like <span style=
=3D"font-family: courier new,monospace;">std::intializer_list&lt;std::any&g=
t;</span>, we could smarten up what we got:<br><br><div class=3D"prettyprin=
t" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 18=
7, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><c=
ode class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"colo=
r: #800;" class=3D"styled-by-prettify">// va_list semi-wrapper, definitely =
not thread-safe,</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br></span><span style=3D"color: #800;" class=3D"styled-by-prettify">=
// also NOT TESTED</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> va=
_iterator<br></span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&n=
bsp; &nbsp; va_list current</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> backup</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
<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><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">explicit</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> va_iterator<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> va_list </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">va </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> &nbsp;</span><span style=3D"color: #800;"=
 class=3D"styled-by-prettify">// noexcept</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> va_copy</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">current</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> va</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> va_copy=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">backup</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> va</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">);}</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br>&nbsp; &nbsp; va_iterator</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">const</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> va_iterator </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">that </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> &nbsp;</span><span style=3D"color: #800;" class=3D"styled-by-pre=
ttify">// noexcept</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> va_copy</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">curr=
ent</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> that</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">current</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> va_copy</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">backup</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> that</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">ba=
ckup</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</sp=
an><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>&nbsp; &nbsp; va_iterator</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> va_iterator </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><s=
pan 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"> </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"style=
d-by-prettify">delete</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br>&nbsp; &nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">~</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>va_iterator</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #800;" class=3D"styled-by-prettify">// noexcept</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nb=
sp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> va_end</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">backup</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> va_end</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">current</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: #660;" class=3D"styled-by-pretti=
fy">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
br>&nbsp; &nbsp; va_iterator </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> &nbsp;</span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">operator</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">const</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> va_iterator </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">that </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;"=
 class=3D"styled-by-prettify">// noexcept</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">if</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;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">current </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">!=3D</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">that</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">current </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbs=
p; &nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> va_end</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">current</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> va_copy</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">current</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> that</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">current</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp=
; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">i=
f</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </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: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">backup </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">!=3D</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">that</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">back=
up </span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp=
; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> va_end</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">b=
ackup</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> va_copy</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">backup</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> that</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">backup</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&n=
bsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">return</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">*</span><span style=3D"color: #008;" class=3D"styled-by-prettify">this</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; va_i=
terator </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&a=
mp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> &nbsp;=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">operator</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">=3D(</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> va_iterator </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" 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"sty=
led-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">delete</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> &nbsp;reset</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> &nbs=
p;</span><span style=3D"color: #800;" class=3D"styled-by-prettify">// noexc=
ept</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nb=
sp; &nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> va_end<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">current</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> va_copy</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">current</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> backup</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">);</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"styled-by-prettify"><br><br>=
&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">template</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> &nbsp;extract</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">/*noexcept*/</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">-&gt;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">typename</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> vararg_type</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">T</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&gt;::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">ty=
pe<br>&nbsp; &nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> return_type </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">decltype</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">this</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">template</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> extract</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">T</span><span style=3D"color: #66=
0;" 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"styled-b=
y-prettify"><br><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">return</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> va_arg</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> current</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> return_type </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br>&nbsp; &nbsp; </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>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">template</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&lt;</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><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> size_t N</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> &nbsp;extract</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(&amp;</span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">out</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">)[</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">N</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">]</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbs=
p; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp=
; &nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">using</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> inner_type </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> rem=
ove_all_extents_t</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&lt;</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">N</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">]&gt;;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; &nbsp;=
 &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">au=
to</span><span style=3D"color: #000;" 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"> &nbsp;p </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">reinterpret_cast</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">inner_type </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">*&gt;(</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">this</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">-&gt;</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">template</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;extract</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">T</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">[</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">N</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">]&gt;()</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> &nbs=
p;</span><span style=3D"color: #800;" class=3D"styled-by-prettify">// origi=
nal type was</span><span style=3D"color: #800;" class=3D"styled-by-prettify=
"> T*</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
br>&nbsp; &nbsp; &nbsp; &nbsp; copy</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> p</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,</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-by-prettify"> </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">sizeof</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">out</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: #660;" class=3D"style=
d-by-prettify">/</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">siz=
eof</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">inner_type</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">),</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp;=
 &nbsp; &nbsp;</span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">reinterpret_cast</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">inner_type </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">*&gt;(&amp;</span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">out</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 style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> &nbsp;extract</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> nullptr_t </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">out</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">// better be void*</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nb=
sp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">const</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> &nbsp;p </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">this</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">-&gt;</span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">template</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> extract</span><span style=3D"color: #080;" class=3D"sty=
led-by-prettify">&lt;nullptr_t&gt;</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">();</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">assert</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> p </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D=3D</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">nullptr</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">)=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp=
; &nbsp; &nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">out</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">nullptr</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">template</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #0=
08;" 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">&gt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> &nbsp;extract</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> T </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&amp;</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">out</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">out</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cl=
ass=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">static_cast</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt=
;(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">this</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">template</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> extract</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">T</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;" cl=
ass=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">template</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&lt;</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">&=
gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nb=
sp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> &nbs=
p;extract</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> reference=
_wrapper</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> r </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> extract</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">r</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">.</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">get</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">());</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">template</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> U</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</sp=
an><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">V</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> &nbsp;extract</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 style=3D"color: #660;" class=3D=
"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> first</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> U</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 second</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> V</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">...</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">rest </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; extract</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> forward</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">T</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&gt;(</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">first</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: #660;" class=3D"styled-by-pret=
tify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>&nbsp; &nbsp; &nbsp; &nbsp; extract</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> forward</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">U</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&gt;(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">seco=
nd</span><span style=3D"color: #660;" class=3D"styled-by-prettify">),</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> forward</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">V</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&gt;(</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify">rest</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">)...</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><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: #008;" class=3D"styled-by-prettify">inline</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> &nbsp;extract_impl</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> va_iterator </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&amp;,</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> tuple</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;&gt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&amp;,</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> index_sequence</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&lt;&gt;</span><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"> &nbsp;</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">{}</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">template</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><spa=
n 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=
: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">...</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">U</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> size_t </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
....</span><span style=3D"color: #000;" class=3D"styled-by-prettify">I</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> &nbsp;extract_impl</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> va_iterator </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">va</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> tuple</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify">T</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> U</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">...&gt;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&amp;</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"><br>&nbsp;index_sequence</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify">I</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">...&gt;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> va</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">extract</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">get</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">I</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&gt;(</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)...<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">);</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"styled-by-prettify"><br><br></span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">template</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </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 style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br>tuple</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">T</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">...&gt;</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> &nbsp;extract</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> va_iterator </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">va </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">decltype</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> extra=
ct</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">...&gt;(</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">va</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" 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"> &nbsp;result</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><br>&nbsp; &nbsp; extract_impl</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> va</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> result</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ind=
ex_sequence_for</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">T=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...&gt;{}<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">return</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> result</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span></div></code></div><br>Where the "<span =
style=3D"font-family: courier new,monospace;">extract_impl</span>" function=
s would be hidden. And <span style=3D"font-family: courier new,monospace;">=
vararg_type</span> is a transformation type-trait class that returns the po=
st-mangled type that has been through a <span style=3D"font-family: courier=
 new,monospace;">...</span> parameter. The constructor takes an already-set=
 <span style=3D"font-family: courier new,monospace;">va_list</span> object.=
 That object is either a function parameter itself, or was set from a <span=
 style=3D"font-family: courier new,monospace;">va_start</span> or <span sty=
le=3D"font-family: courier new,monospace;">va_copy</span> call, which would=
 require a (guard-scoped) <span style=3D"font-family: courier new,monospace=
;">va_end</span> call. Or we could have something like <span style=3D"font-=
family: courier new,monospace;">__va__</span> to take care of that:<br><br>=
<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; wo=
rd-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettypr=
int"><span style=3D"color: #800;" class=3D"styled-by-prettify">// The new h=
otness</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">return</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> extract</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span=
 style=3D"color: #606;" class=3D"styled-by-prettify">Whatever</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">...&gt;(</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> va_iterator</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">__va__</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: #660;" class=3D"=
styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br></span></div></code></div>&nbsp;</div><blockquote class=3D"=
gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc so=
lid;padding-left: 1ex;">If you don't take my word for it, go right ahead. I=
 myself am just a=20
<br>spectator, not on any committee (nor have ever been). But I'm done with=
=20
<br>this topic.

<br></blockquote><div><br>&nbsp;Daryle W.<br><br></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_231_13763869.1384124002192--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Mon, 11 Nov 2013 01:36:05 +0200
Raw View
On 11 November 2013 00:53, Daryle Walker <darylew@gmail.com> wrote:
>
> Where the "extract_impl" functions would be hidden. And vararg_type is a
> transformation type-trait class that returns the post-mangled type that has
> been through a ... parameter. The constructor takes an already-set va_list
> object. That object is either a function parameter itself, or was set from a
> va_start or va_copy call, which would require a (guard-scoped) va_end call.
> Or we could have something like __va__ to take care of that:
>
> // The new hotness
> return extract<Whatever...>( va_iterator{__va__} );


New hotness for a legacy-compatibility feature that everything and
everybody I know
advices against. ;)

I must say I'm not exactly looking forward to having further
extensions to legacy variadics,
we have much better facilities to deal with such things nowadays.

If you want to push this idea, perhaps you should do a library-only
version that just
wraps the va_end handling and provides an iterator, and see whether that catches
any fire in any user community. I have my doubts about that, and hence
I have my doubts
(very strong ones) about the usefulness of standardizing something like this.

In other words, as I predicted to myself, I did read the proposal and
I think I would vote
against it, due to lack of practical motivation.

--

---
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/.

.