From: Denis Davydov Date: Sat, 23 Feb 2019 17:09:57 +0000 (+0100) Subject: add has_begin detector X-Git-Tag: v9.1.0-rc1~323^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12f2084c6ce0670a7b470aa1157bab02de31c294;p=dealii.git add has_begin detector --- diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 8da043d70b..4b088f977d 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -3450,6 +3450,27 @@ namespace internal }; + + // same as above to check + // T::const_iterator T::begin() const + template + struct has_begin + { + private: + static void + detect(...); + + template + static decltype(std::declval().begin()) + detect(const U &); + + public: + static constexpr bool value = + std::is_same()))>::value; + }; + + // access to generic vectors that have operator (). // FIXME: this is wrong for Trilinos/Petsc MPI vectors template ::value << std::endl; + // check has_begin(): + deallog + << "has_begin:" << std::endl + << "LinearAlgebra::distributed::Vector = " + << internal::has_begin>::value + << std::endl + << "TrilinosWrappers::MPI::Vector = " + << internal::has_begin::value << std::endl; + deallog << "OK" << std::endl; } diff --git a/tests/matrix_free/fe_evaluation_type_traits.with_trilinos=true.output b/tests/matrix_free/fe_evaluation_type_traits.with_trilinos=true.output index 4e82d52202..71bac87207 100644 --- a/tests/matrix_free/fe_evaluation_type_traits.with_trilinos=true.output +++ b/tests/matrix_free/fe_evaluation_type_traits.with_trilinos=true.output @@ -10,4 +10,7 @@ DEAL::Dummy2::operator() DEAL::has_partitioners_are_compatible: DEAL::LinearAlgebra::distributed::Vector = 1 DEAL::TrilinosWrappers::MPI::Vector = 0 +DEAL::has_begin: +DEAL::LinearAlgebra::distributed::Vector = 1 +DEAL::TrilinosWrappers::MPI::Vector = 1 DEAL::OK