|
Boost Users : |
From: Matthias Kaeppler (nospam_at_[hidden])
Date: 2005-03-04 16:18:16
Matthias Kaeppler wrote:
> Are those two function templates also defined in call_traits.hpp? I
> can't find them in the library docs.
type_traits.hpp -- found it :)
Alright, based on your valuable input, I have come up with this (those
template meta programming facilities of boost are /amazing/!):
template< typename Operation >
class indirecter_unary
{
typedef typename boost::unary_traits<Operation>::argument_type arg_type;
typedef typename boost::unary_traits<Operation>::param_type param_type;
typedef typename boost::unary_traits<Operation>::result_type result_type;
typedef typename boost::unary_traits<Operation>::function_type
function_type;
typedef typename boost::remove_reference<typename
boost::add_const<arg_type>::type>::type* ptr_type;
function_type op_;
public:
explicit indirecter_unary( param_type op ): op_(op) {}
result_type operator() (ptr_type ptr) const {
return op_(*ptr);
}
};
Anything else coming to your mind what could be bad about this adaptor?
I want it to be as robust as possible because I intend to use it a lot.
By the way (silly question):
Is it 'indirecter' or 'indirector'? I wasn't quite sure. Don't want to
have typos in my classnames :)
Regards,
Matthias
-- Matthias Kaeppler
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