Boost logo

Boost :

From: Noah Stein (noah_at_[hidden])
Date: 2001-11-28 20:21:35


> -----Original Message-----
> From: joel de guzman [mailto:djowel_at_[hidden]]
> Sent: Wednesday, November 28, 2001 3:57 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] Submission: typelist
>

>
> I don't know much about loki nor mpl. I do have a metaprogramming library
> that uses functional techniques such as currying and list processing, not
> unlike mpl. I too have an int_t facility. Here's how I bind arguments:
>
> add<int_t<1>, int_t<2> > --> direct, both args supplied
> add<int_t<2>, _> --> 2nd arg, curry
> add<_, int_t<2> > --> 1st arg, curry
> add<_, _> --> both args, curry
>
> Now imagine if I use int2type instead.... That's why I tend to
> agree with mpl's this time.
>

I just got back from a week's vacation, and I must say that I missed a lot
of discussion, and it's tough to jump in on much of it, so I'll start with a
*lightweight* (well not complex) issue. :-)

I agree with Andrei that int_t does have a semblance to size_t and ptrdiff_t
but has a substantially different connotation. An int_t<> might be
naturally processed by many programmers as specifying a size mechanic the
way a basic_stream<> has its underlying character type specified as a
temlate paramter. I could also see such a nomenclature clashing with
internal types: would you name a wide character wrapper wchar_t_t?

I propose a slight variation: "_v". Thus, the types would be int_v,
wchar_v, etc. The role of these classes is that of a value, which the "_v"
implies. It forms a nice-looking duality: wchar_t & wchar_v. Being the
same number of characters as the "_t", it's just as concise when entering
code.

Admittedly, I've not seen a "_v" notation before. Of course, I programmed C
for a few years before running into the "_t" types. It seems similar enough
yet distinct to be a plausible choice. I like the idea that it clearly
states that the type is functioning as a value in metaprogramming.

Just and idea...

-- Noah


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