mirror of
https://github.com/triqs/dft_tools
synced 2024-12-25 05:43:40 +01:00
arrays: correction of value_type of matrix_expr
- forgot to correct the value_type of matrix_expr, and vector_expr as was done long ago for arrays... - also added cases for arrays until dim 10 - TODO : replace this trait in arrays with a tuple tools for any dim.. not urgent.
This commit is contained in:
parent
91978da6db
commit
eda6eb90a2
@ -31,6 +31,10 @@ namespace triqs { namespace arrays {
|
||||
template<typename A> struct get_call_const_return_type<A,3> { typedef decltype(std::declval<A const>()(0,0,0)) type; };
|
||||
template<typename A> struct get_call_const_return_type<A,4> { typedef decltype(std::declval<A const>()(0,0,0,0)) type; };
|
||||
template<typename A> struct get_call_const_return_type<A,5> { typedef decltype(std::declval<A const>()(0,0,0,0,0)) type; };
|
||||
template<typename A> struct get_call_const_return_type<A,6> { typedef decltype(std::declval<A const>()(0,0,0,0,0,0)) type; };
|
||||
template<typename A> struct get_call_const_return_type<A,7> { typedef decltype(std::declval<A const>()(0,0,0,0,0,0,0)) type; };
|
||||
template<typename A> struct get_call_const_return_type<A,8> { typedef decltype(std::declval<A const>()(0,0,0,0,0,0,0,0)) type; };
|
||||
template<typename A> struct get_call_const_return_type<A,9> { typedef decltype(std::declval<A const>()(0,0,0,0,0,0,0,0,0)) type; };
|
||||
|
||||
template<typename Tag, typename L, typename R>
|
||||
struct array_expr : TRIQS_CONCEPT_TAG_NAME(ImmutableArray) {
|
||||
|
@ -69,10 +69,12 @@ namespace triqs { namespace arrays {
|
||||
typedef typename std::remove_reference<L>::type L_t;
|
||||
typedef typename std::remove_reference<R>::type R_t;
|
||||
static_assert( get_rank<R_t>::value==0 || get_rank<L_t>::value==0 || get_rank<L_t>::value == get_rank<R_t>::value, "rank mismatch in matrix operations");
|
||||
typedef typename std::result_of<utility::operation<Tag>(typename L_t::value_type,typename R_t::value_type)>::type value_type;
|
||||
//typedef typename std::result_of<utility::operation<Tag>(typename L_t::value_type,typename R_t::value_type )>::type value_type;
|
||||
typedef typename std::remove_cv< typename std::remove_reference<typename std::result_of<combine_domain(L_t,R_t)>::type>::type>::type domain_type;
|
||||
|
||||
L l; R r;
|
||||
using value_type = decltype(utility::operation<Tag>()(l(0, 0), r(0, 0)));
|
||||
|
||||
template<typename LL, typename RR> matrix_expr(LL && l_, RR && r_) : l(std::forward<LL>(l_)), r(std::forward<RR>(r_)) {}
|
||||
|
||||
domain_type domain() const { return combine_domain()(l,r); }
|
||||
|
@ -29,10 +29,12 @@ namespace triqs { namespace arrays {
|
||||
typedef typename std::remove_reference<L>::type L_t;
|
||||
typedef typename std::remove_reference<R>::type R_t;
|
||||
static_assert( get_rank<R_t>::value==0 || get_rank<L_t>::value==0 || get_rank<L_t>::value == get_rank<R_t>::value, "rank mismatch in array operations");
|
||||
typedef typename std::result_of<utility::operation<Tag>(typename L_t::value_type,typename R_t::value_type)>::type value_type;
|
||||
//typedef typename std::result_of<utility::operation<Tag>(typename L_t::value_type,typename R_t::value_type)>::type value_type;
|
||||
typedef typename std::remove_reference<typename std::result_of<combine_domain(L_t,R_t)>::type>::type domain_type;
|
||||
|
||||
L l; R r;
|
||||
using value_type = decltype(utility::operation<Tag>()(l(0), r(0)));
|
||||
|
||||
template<typename LL, typename RR> vector_expr(LL && l_, RR && r_) : l(std::forward<LL>(l_)), r(std::forward<RR>(r_)) {}
|
||||
|
||||
domain_type domain() const { return combine_domain()(l,r); }
|
||||
|
Loading…
Reference in New Issue
Block a user