Daniel James | 30 Apr 22:09
Picon
Favicon

[boostbook] Supporting variadic template parameters

Hi,

I'd like to add support for variadic template parameters to BoostBook.
I've attached a patch showing what I've done so far - basically I'm
adding a variadic attribute to template-type-parameter and
template-nontype-parameter, for example:

  <method name="emplace">
    <template>
      <template-type-parameter name="Args" variadic="1">
      </template-type-parameter>
    </template>
    <parameter name="args">
      <paramtype>Args&amp;&amp;...</paramtype>
    </parameter>
    <type>std::pair&lt;iterator, bool&gt;</type>
  </method>

for:

  template<typename... Args>
  std::pair<iterator, bool> emplace(Args&&... args)

You can see the output on:

http://unordered.nfshost.com/dev/doc/html/boost/unordered_set.html

Does this seem like a good solution? Giving the attribute a "1" value
seems very awkward, but I couldn't think of anything better (I copied
it from the 'html-only' attribute). Maybe it would be better to add
(Continue reading)

Frank Mori Hess | 30 Apr 22:53
Favicon

Re: [boostbook] Supporting variadic template parameters


On Wednesday 30 April 2008 16:12 pm, Daniel James wrote:
> Finally, I'll also need to update the boostbook reference. I assume
> that I should manually update reference.dtdxml. How is reference.xml
> generated from reference.dtdxml?

Hmm, it seems I was the last person to do that, but I'm not sure I remember 
how.  Maybe I applied the stylesheet xsl/dtd/dtd2boostbook.xsl to it?

--

-- 
Frank
Daniel James | 30 Apr 23:01
Picon
Favicon

Re: [boostbook] Supporting variadic template parameters

On 30/04/2008, Frank Mori Hess <frank.hess <at> nist.gov> wrote:
>
>  On Wednesday 30 April 2008 16:12 pm, Daniel James wrote:
>  > Finally, I'll also need to update the boostbook reference. I assume
>  > that I should manually update reference.dtdxml. How is reference.xml
>  > generated from reference.dtdxml?
>
> Hmm, it seems I was the last person to do that, but I'm not sure I remember
>  how.  Maybe I applied the stylesheet xsl/dtd/dtd2boostbook.xsl to it?

Yes, that seems to work. Thank you.
Douglas Gregor | 2 May 22:47
Picon
Favicon

Re: [boostbook] Supporting variadic template parameters

On Wed, 2008-04-30 at 21:12 +0100, Daniel James wrote:
> I'd like to add support for variadic template parameters to BoostBook.

Cool.

> I've attached a patch showing what I've done so far - basically I'm
> adding a variadic attribute to template-type-parameter and
> template-nontype-parameter, for example:
> 
>   <method name="emplace">
>     <template>
>       <template-type-parameter name="Args" variadic="1">
>       </template-type-parameter>
>     </template>
>     <parameter name="args">
>       <paramtype>Args&amp;&amp;...</paramtype>
>     </parameter>
>     <type>std::pair&lt;iterator, bool&gt;</type>
>   </method>

I would suggest calling the attribute "parameter_pack" or "pack", rather
than "variadic", since it's more precise. One could even do the same for
<parameter name="args" pack="1">.

> for:
> 
>   template<typename... Args>
>   std::pair<iterator, bool> emplace(Args&&... args)
> 
> You can see the output on:
(Continue reading)

Daniel James | 3 May 19:12
Picon
Favicon

Re: [boostbook] Supporting variadic template parameters

On 02/05/2008, Douglas Gregor <dgregor <at> osl.iu.edu> wrote:
>
> I would suggest calling the attribute "parameter_pack" or "pack", rather
>  than "variadic", since it's more precise. One could even do the same for
>  <parameter name="args" pack="1">.

I'll do that. Would it be also be worth adding an attribute when a
class inherits from a pack expansion? Something like:

  <class name="mixin">
    <template>
      <template-type-parameter name="Mixins" pack="1"/>
    </template>
    <inherit access="public" pack="1">
      <type>Mixins</type>
    </inherit>
    <constructor>
      <parameter name="mixins" pack="1">
        <paramtype>const Mixins&amp;</paramtype>
      </parameter>
    </constructor>
  </class>

Or maybe it could be <inherit pack-expansion="1">?

Thanks for the help,

Daniel
Douglas Gregor | 4 May 02:09
Picon
Favicon

Re: [boostbook] Supporting variadic template parameters

Daniel James wrote:
> On 02/05/2008, Douglas Gregor <dgregor <at> osl.iu.edu> wrote:
>   
>> I would suggest calling the attribute "parameter_pack" or "pack", rather
>>  than "variadic", since it's more precise. One could even do the same for
>>  <parameter name="args" pack="1">.
>>     
>
> I'll do that. Would it be also be worth adding an attribute when a
> class inherits from a pack expansion? 

Sure. If you want to be really pedantic, you could make sure that 
BoostBook supports pack and pack-expansion attributes everywhere that 
C++0x supports them, by going through the list in [temp.variadic] in the 
C++0x working draft.

    - Doug

Gmane