Boost logo

Boost :

Subject: Re: [boost] [TTI] Review
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-07-11 23:07:47


On Mon, Jul 11, 2011 at 10:53 PM, Edward Diener <eldiener_at_[hidden]> wrote:
> On 7/11/2011 9:32 PM, Lorenzo Caminiti wrote:
>> Let's write down some examples for what I meant with comment #5
>> leaving variadics (comment #6) and implementation issues a side for a
>> moment. Let's just try to see if (1) we understand each other and (2)
>> we list options that users will find to be a better interface for the
>> library. I will not list the trait parameter (even if I suggested to
>> always add it).
>>
>> Here's some examples of what I was proposing with my comment #5:
>>
>> // check if mytpl exist
>> TTI_TEMPLATE( mytpl ) // [1]
>>
>> // check if template<class>  struct mytpl exist
>> TTI_TEMPLATE( template( (class) ) struct mytpl )
>>
>> // check if template<class, int>  class mytpl exist
>> TTI_TEMPLATE( template( (class) (int) ) class mytpl )
>>
>> // check if template<class, int, template<typename, class>  struct>
>> class mytpl exist
>> TTI_TEMPLATE( template( (class) (int) (template( (typename) (class) )
>> struct) class mytpl )
>>
>> The real question still is: For the TTI library user, is the interface
>> above better than TTI_TEMPLATE_CHECK_PARAMS? (Again, you know my
>> answer is yes but that's just my opinion.) I think we should all focus
>> the discussion in try to answer this question first.
>
> 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))
>
> or for variadic macros
>
> TTI_TEMPLATE(mytpl)
> TTI_TEMPLATE(mytpl,class,int,template<typename class> struct)

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

Thanks,
--Lorenzo


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