Boost logo

Boost :

Subject: Re: [boost] [TTI] Review
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-07-12 21:01:33

On 7/12/2011 7:27 PM, Lorenzo Caminiti wrote:
> On Tue, Jul 12, 2011 at 6:51 PM, Edward Diener<eldiener_at_[hidden]> wrote:
>> On 7/12/2011 5:45 PM, Jeffrey Lee Hellrung, Jr. wrote:
>>> On Tue, Jul 12, 2011 at 8:30 AM, Edward
>>> Diener<eldiener_at_[hidden]>wrote:
>>> [...]
>>>> TTI_TEMPLATE(yyy,(3,(class,**int,template<class,class>))) // (3) both
>>> [...]
>>> Isn't the above a size 4 Boost.PP Array? Or are you purposely
>>> demonstrating
>>> the ease with which the user would make mistakes with this syntax? :)
>> You copied it wrong from my reply. Are you purposely demonstrating the ease
>> by which template parameters may be copied incorrectly<g> ?
> Sorry... I really don't understand what this means...

Mr. Hellrung copied the example incorrectly when he replied.

>> You are right that it should be:
>> TTI_TEMPLATE(yyy,(4,(class,int,template<class,class>))) // (3) both
>> Despite my error in counting commas ( or addding 1 to my count ), I prefer
>> this syntax rather than inventing a different one. I realized that it is
>> easier presenting a pp-array than a pp-seq, as long as one can simply count
>> commas ( unlike yours truly ).
> How may commas do you count for the following case? Warning: It's a
> trick question ;)
> TTI_TEMPLATE(t, (?, (typename R, typename A0, typename A1, R (fptr)(A0, A1))))

I count 4 in the tuple part of the array, but since one is inside a
nested tuple, ? = 4 and not 5. Are we done with school for the day <g> ?
The point being, no doubt, that it is not all that easy to fill in the
length for the array.

I will make a point in the documentation to explain how to determine the
size of the pp-lib array.

It is still much easier to use the pp-lib array and transcribe the rest
from the actual template parameters of the template you are searching
for than either:

1) My original syntax using pp-seq.
2) Your suggested syntax replacing <> with () and other fun syntactical

Let it be. It really is the easiest solution for the end-user and for me
when it comes to non-variadic macros. Hopefully nearly everyone will be
able to use the variadic macros syntax, either now or in the immediate
future, and this syntactical issue will be completely unimportant. Paul
Mensonides has said that given variadic macro support the pp-lib array
is no longer useful and I concur. The only reason I am using it here is
to support those very few programmers who may need it now without
variadic macros. Doing really complicated preprocessor programming with
non-variadic macros merely to support some syntax which may or may not
be better than what I have decided is not my idea of fun or seem
worthwhile to me, and I am pretty happy with my solution despite your
clever example.


Boost list run by bdawes at, gregod at, cpdaniel at, john at