From 4ae4dfd42bdfc7da7737e403d5b0246ca673684f Mon Sep 17 00:00:00 2001 From: Olivier Parcollet Date: Mon, 7 Apr 2014 15:11:03 +0200 Subject: [PATCH] arrays: add lazy call to matrix_tensor_proxy - correction to previous patch --- triqs/arrays/matrix_tensor_proxy.hpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/triqs/arrays/matrix_tensor_proxy.hpp b/triqs/arrays/matrix_tensor_proxy.hpp index 766db471..1ce3e2b1 100644 --- a/triqs/arrays/matrix_tensor_proxy.hpp +++ b/triqs/arrays/matrix_tensor_proxy.hpp @@ -60,7 +60,12 @@ namespace arrays { value_type *restrict data_start() { return &storage()[indexmap().start_shift()]; } view_type operator()() const { return *this; } - template value_type const &operator()(Args &&... args) const { return a(n, std::forward(args)...); } + + template + std::c14::enable_if_t::value, value_type const &> operator()(Args &&... args) const { + return a(n, std::forward(args)...); + } + TRIQS_CLEF_IMPLEMENT_LAZY_CALL(); template const_matrix_tensor_proxy &operator=(const RHS &X) =delete; // can not assign to a const @@ -109,7 +114,13 @@ namespace arrays { value_type *restrict data_start() { return &storage()[indexmap().start_shift()]; } view_type operator()() const { return *this; } - template value_type &operator()(Args &&... args) const { return a(n, std::forward(args)...); } + + template + std::c14::enable_if_t::value, value_type &> operator()(Args &&... args) const { + return a(n, std::forward(args)...); + } + + TRIQS_CLEF_IMPLEMENT_LAZY_CALL(); template matrix_tensor_proxy &operator=(const RHS &X) { triqs_arrays_assign_delegation(*this, X);