Boost logo

Boost Users :

Subject: Re: [Boost-users] fusion::result_of::transform<Seq1, Seq2, F> -- argument dependent result type
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-09-13 12:47:02


AMDG

e r wrote:
> I may have made a little bit of progress here...
>
>
> template<typename A>
> struct result<fun(const A&)>{
> typedef A type;
> };
>

Yeah. That's the idea. I generally use function_traits rather than
partial specialization. In your original example (untested):

#include <boost/type_traits/function_traits.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_refence.hpp>

struct fun {
    template<class Sig>
    struct result {
        typedef typename boost::function_traits<Sig>::arg1_type arg1_type;
        typedef typename boost::function_traits<Sig>::arg2_type arg2_type;
        typedef typename boost::remove_cv<typename
boost::remove_reference<arg1_type>::type>::type Metafun;
        typedef typename Metafun::type type;
    };
    // ...
}

In Christ,
Steven Watanabe


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