Boost logo

Boost :

Subject: Re: [boost] [TTI] Review
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-07-11 23:55:08


[I have not looked in detail at the TTI library and only *just* caught up on
this email exchange...whew!]

On Mon, Jul 11, 2011 at 8:07 PM, Lorenzo Caminiti <lorcaminiti_at_[hidden]>wrote:

> On Mon, Jul 11, 2011 at 10:53 PM, Edward Diener <eldiener_at_[hidden]>
> wrote:
>
[...]

> > I do not like your syntax. I much prefer the syntax I already have, with
> a
> > separate macro parameter merely being the template parameters if the
> > end-user is looking for a match, ie.
> >
> > TTI_TEMPLATE(mytpl,BOOST_PP_NIL)
> > TTI_TEMPLATE(mytpl,(class)(int)(template<typename class> struct))
>

This is acceptable.

> > or for variadic macros
> >
> > TTI_TEMPLATE(mytpl)
> > TTI_TEMPLATE(mytpl,class,int,template<typename class> struct)
>

Didn't Paul Mensonides (sp? sorry Paul!) rail against such constructs just a
week or two ago? :) I.e., shouldn't the template signature be packaged into
a single parameter?

> OK but don't you need something in between the inner template typename
> and class? (Because they can be any arbitrary type name for non-type
> template parameters.) For example (again, leaving variadics a side for
> a moment):
>
> TTI_TEMPLATE(mytpl,BOOST_PP_NIL)
> TTI_TEMPLATE(mytpl,(class)(int)(template<typename)(class> struct)) // [1]
>
> If so, is that better than the following?
>
> TTI_TEMPLATE(mytpl,BOOST_PP_NIL)
> TTI_TEMPLATE(mytpl,(class)(int)(template( (typename)(class) ) struct)) //
> [2]
>
> (You know I (somewhat strongly this time) prefer [2] to [1], see my
> comment #4. But that's just my opinion.)
>

FWIW, I, too, prefer [2] over [1], and I also kind of like Lorenzo's earlier
suggested syntax of

TTI_TEMPLATE( mytmp ) // template signature unspecified
TTI_TEMPLATE( template( ( class ) ( int ) ( template( ( typename ) ( class )
) ) struct mytmp ) // template signature specified

I *might* even go so far as to say that the equivalent variadic version
would just replace the Boost.PP Seqs with Boost.PP Tuples, and no more
(i.e., still don't use '<'s and '>'s):

TTI_TEMPLATE( template( class, int, template( typename, class ) ) struct
mytmp ) // variadic version

But that might not be a good idea, and, even worse, might be too radical :)

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk