Ian McCulloch wrote:
template< typename Operation > class indirecter_unary : public std::unary_function< typename boost::unary_traits<Operation>::argument_type,
Is this correct? You are advertising that your function has an argument_type that is the same as Operation::argument_type. Don't you want your argument_type to be a pointer?
Hm yes, that is true. So let me correct this to: class indirecter_unary : public std::unary_function< typename boost::unary_traits<Operation>::argument_type*, typename boost::unary_traits<Operation>::result_type >
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"?
typename boost::unary_traits<Operation>::result_type > { typedef typename boost::unary_traits<Operation>::argument_type arg_type;
I think, the argument_type you are looking for is
typedef typename boost::remove_reference
::type* argument_type;
Thanks, that sounds reasonable.
typedef typename boost::unary_traits<Operation>::param_type param_type;
IIUC, param_type is supposed to be a type used to pass this function object as a parameter. ie, it should be something like indirecter_unary const&, NOT the param_type of Operation.
Yes, I know. That's how I used it: To pass objects of type Operation to the constructor of indirecter_unary.
typedef typename boost::unary_traits<Operation>::result_type result_type; typedef typename boost::unary_traits<Operation>::function_type function_type; function_type op_; public: explicit indirecter_unary( param_type op ): op_(op) {} result_type operator() (arg_type *arg) const {
^^^^^^^^^^ should be: result_type operator()(argument_type arg) const {
Should it? operator() is supposed to take pointers! Where would the indirection be if I would pass non-pointer types? -- Matthias Kaeppler