Boost logo

Boost Users :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-03-04 15:10:58


Matthias Kaeppler wrote:

> > In any event, since you need to
> > redefine argument_type and result_type yourself, there is no point
> > inheriting from std::unary_function.
> >
>
> Why? I thought those types are boost::unary_traits specific types? I
> thought I have to inherit from std::unary_function if I want to create
> what is called an "Adaptable Unary Function"?

To define an adaptable unary function, all you need is the member types. One way
to acquire them is to inherit from unary_function. If you redefine argument_type
and result_type, inheriting from unary function does no good;in fact, it's
harmful if the argument_type and result_type don't coincide with the inherited
versions, since users may only look at the base class list.

Jonathan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net