struct distribute_subscript : or_< scalar_grammar , when< vector_literal , _make_subscript( _, _state ) > , plus< distribute_subscript, distribute_subscript > , minus< distribute_subscript, distribute_subscript > , multiplies< distribute_subscript, distribute_subscript > , divides< distribute_subscript, distribute_subscript > , assign< distribute_subscript, distribute_subscript > > {}; template< std::size_t I, std::size_t N > struct unroll_vector_expr_c; template< std::size_t N > struct unroll_vector_expr_c< 0, N > : transform< unroll_vector_expr_c< 0, N > > { template< typename Expr, typename State, typename Data > struct impl : transform_impl< Expr, State, Data > { typedef typename result_of::make_expr< tag::comma , typename boost::result_of< unroll_vector_expr_c< 1, N >( typename impl::expr ) >::type , typename impl::state >::type result_type; result_type operator ()( typename impl::expr_param expr , typename impl::state_param state , typename impl::data_param data ) const { return make_expr< tag::comma >( unroll_vector_expr_c< 1, N >()( expr ) , state ); } }; }; template< std::size_t I, std::size_t N > struct unroll_vector_expr_c : transform< unroll_vector_expr_c< I, N > > { template< typename Expr, typename State, typename Data > struct impl : transform_impl< Expr, State, Data > { typedef typename result_of::make_expr< tag::comma , typename boost::result_of< distribute_subscript( typename impl::expr_param , typename result_of::make_expr< tag::terminal , boost::mpl::size_t< I - 1 > >::type const& ) >::type , typename boost::result_of< unroll_vector_expr_c< I + 1, N >( typename impl::expr_param ) >::type >::type result_type; result_type operator ()( typename impl::expr_param expr , typename impl::state_param state , typename impl::data_param data ) const { return make_expr< tag::comma >( distribute_subscript()( expr , make_expr< tag::terminal >( boost::mpl::size_t< I - 1 >() ) ) , unroll_vector_expr_c< I + 1, N >() ( expr ) ); } }; }; template< std::size_t N > struct unroll_vector_expr_c< N, N > : transform< unroll_vector_expr_c< N, N > > { template< typename Expr, typename State, typename Data > struct impl : transform_impl< Expr, State, Data > { typedef typename boost::result_of< distribute_subscript( typename impl::expr_param , typename result_of::make_expr< tag::terminal , boost::mpl::size_t< N - 1 > >::type const& ) >::type result_type; result_type operator ()( typename impl::expr_param expr , typename impl::state_param state , typename impl::data_param data ) const { return distribute_subscript()( expr , make_expr< tag::terminal >( boost::mpl::size_t< N - 1 >() ) ); } }; }; struct unroll_vector_expr : transform< unroll_vector_expr > { template< typename Expr, typename State, typename Data > struct impl : transform_impl< Expr, State, Data > { typedef typename dimension< typename boost::remove_reference< typename boost::result_of< _value( State ) >::type >::type >::type dimension; typedef typename boost::result_of< unroll_vector_expr_c< 0, dimension::value >( typename impl::expr_param , typename impl::state_param ) >::type result_type; result_type operator ()( typename impl::expr_param expr , typename impl::state_param state , typename impl::data_param data ) const { return unroll_vector_expr_c< 0, dimension::value >()( expr , state ); } }; };