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:
> 
> http://unordered.nfshost.com/dev/doc/html/boost/unordered_set.html

Looks good.

> 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
> new tags for variadic parameters?

I think you have the right idea.

> 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?

The stylesheet to generate the BoostBook reference from the dtdxml
sources is in

  dtd/dtd2boostbook.xsl

Actually, when you re-run bjam in tools/boostbook/doc, it should
regenerate the appropriate BoostBook input from the dtdxml document.

  - Doug

Gmane