Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-05-15 11:17:38


Thomas Witt wrote:
>
> Daniel,
>
> Sorry I missed this posting.
>
> Daniel Frey wrote:
>
>> Thomas Witt wrote:
>>
>>>
>>> struct my_functor :
>>> public boost::function_traits<int(double)>
>>> {
>>> // ...
>>> };
>>
>>
>>
>> I like it, too. The only thing that I don't like is the name. Used
>> like this, it no longer has traits semantics IMHO. Thus I'd prefer:
>
>
> I disagree. I think it has traits semantics. That what it does it
> provides traits.

Maybe I should explain what I think a traits class is: It's a container
for types and/or constants. It provides types/constants that depend on
the "input parameters" at compile time. It is not a base class. Thus, I
would have expected:

struct my_functor : boost::function_traits<int(double)>::base
{
   // ...
};

Or probably some other name for 'base' like 'functor'... (I know, some
people will stone me for calling a 'function object' a 'functor' :).

Also, my suggestion to call it 'function<int(double)>' IMHO matches
unary_function and binary_function better, so it might be easier for
users that are used to the current style. But I don't really have strong
feelings about it, so keeping the _traits is fine with me, too. Probably
it's the least invasive approach from boost's perspective. :)

Regards, Daniel

-- 
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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