Boost logo

Boost :

From: shunsuke (pstade.mb_at_[hidden])
Date: 2007-07-12 13:35:43


Hi,

cvs head can't compile this.

    #include <boost/fusion/include/as_vector.hpp>
    #include <boost/fusion/include/transform_view.hpp>
    #include <boost/fusion/include/vector.hpp>

    struct identity
    {
        template<class FunCall>
        struct result;

        template<class Fun>
        struct result<Fun(int&)>
        {
            typedef int& type;
        };

        int& operator()(int& i) const
        {
            return i;
        }
    };

    int main()
    {
        typedef boost::fusion::vector<int, int> from_t;
        from_t from;
        boost::fusion::transform_view<from_t, ::identity> v(from, ::identity());

        // error.
        boost::fusion::as_vector(v);
    }

fusion::as_vector calls result_of::value_of.
Then, <boost/fusion/sequence/view/transform_view/detail/value_of_impl.hpp>
calls result_of::value_of. So, non-reference int is passed to ::identity::result.
I'm not sure which is wrong, as_vector or transform_view.

Regards,

-- 
Shunsuke Sogame

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