Boost logo

Boost Users :

Subject: [Boost-users] [fusion] transform and transform_view
From: Karsten Ahnert (karsten.ahnert_at_[hidden])
Date: 2011-04-22 08:47:54


Hi,

I have a small functor:

struct operation {
  template<class> struct result;

  template< class F >
  struct result<F(int)> {
    typedef long type;
  };

  template< class F >
  struct result<F(float)> {
    typedef double type;
  };

  template< class T >
  typename result< operation(T) >::type operator()( T t ) {
    typedef typename result< operation(T) >::type result_type;
    return result_type( t * T( 2 ) );
  }
};

and I wonder why a transform_view works as expected:

typedef fusion::vector< int , float > vector_type;
vector_type v( 1 , 3.4 );
fusion::transform_view< vector_type , operation > tv( v , operation() );

while

result_of::transform does not:

fusion::result_of::transform< vector_type , operation >::type tv2
    = fusion::transform( v , operation() );

result in compile errors? Any hints?


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