diff --git a/test/triqs/gfs/curry1.cpp b/test/triqs/gfs/curry1.cpp index f69604cf..175b06da 100644 --- a/test/triqs/gfs/curry1.cpp +++ b/test/triqs/gfs/curry1.cpp @@ -37,7 +37,7 @@ try { //std::cout << G_t_tau_N (0.1,0.2) << std::endl; auto G_w_wn_view = G_w_wn(); - auto G_w_wn_sl0_a = partial_eval<0>(G_w_wn(), std::make_tuple(size_t(8))); + auto G_w_wn_sl0_a = partial_eval<0>(G_w_wn(), 8); static_assert(std::is_same::type, const gf_mesh>::value, "oops"); //auto G_w_wn_curry0_a = curry0(G_w_wn); //auto G_w_wn_sl0_a = slice_mesh0(G_w_wn(), 8); @@ -72,17 +72,15 @@ try { // test curry std::cout << "curry no"<< G_w_wn.on_mesh(8,3) << std::endl ; -/* + auto G_w_wn_curry0 = curry<0>(G_w_wn); static_assert(std::is_same::type, const gf_mesh>::value, "oops"); static_assert(std::is_same::type, const gf_mesh>::value, "oops"); auto G_w_wn_curry1 = curry<1>(G_w_wn); auto G_w_wn_view2 = G_w_wn(); - std::cout << " curry "< auto rm_tuple_of_size_one(std::tuple const & t) DECL_AND_RETURN(t); template auto rm_tuple_of_size_one(std::tuple const & t) DECL_AND_RETURN(std::get<0>(t)); + // as_tuple leaves a tuple intact and wrap everything else in a tuple... + template std::tuple as_tuple(T && x) { return std::tuple {std::forward(x)};} + template std::tuple as_tuple(std::tuple && x) { return std::forward(x);} + template std::tuple const & as_tuple(std::tuple const & x) { return x;} + template std::tuple & as_tuple(std::tuple & x) { return x;} + template gf_view< typename cart_prod_impl< triqs::tuple::filter_out_t, pos...>>::type ,Target, Opt,IsConst> partial_eval(gf_impl< cartesian_product, Target,Opt,B,IsConst> const & g, IT index) { // meshes of the returned gf_view : just drop the mesh of the evaluated variables auto meshes_tuple_partial = triqs::tuple::filter_out(g.mesh().components()); // a view of the array of g, with the dimension sizeof...(Ms) - auto arr = reinterpret_linear_array(g.mesh(),g.data()); + auto arr = reinterpret_linear_array(g.mesh(),g.data()); // NO the second () forces a view // now rebuild a tuple of the size sizeof...(Ms), containing the indices and range at the position of evaluated variables. - auto arr_args = triqs::tuple::inverse_filter(index, arrays::range()); + auto arr_args = triqs::tuple::inverse_filter(as_tuple(index), arrays::range()); // from it, we make a slice of the array of g, corresponding to the data of the returned gf_view auto arr2 = triqs::tuple::apply(arr, arr_args); // finally, we build the view on this data.