]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add has_begin detector
authorDenis Davydov <davydden@gmail.com>
Sat, 23 Feb 2019 17:09:57 +0000 (18:09 +0100)
committerDenis Davydov <davydden@gmail.com>
Sat, 23 Feb 2019 17:09:57 +0000 (18:09 +0100)
include/deal.II/matrix_free/fe_evaluation.h
tests/matrix_free/fe_evaluation_type_traits.cc
tests/matrix_free/fe_evaluation_type_traits.with_trilinos=true.output

index 8da043d70beeb7068552ff62a86c91844b460074..4b088f977d17bb6b022898310b8c9979d14ccb4c 100644 (file)
@@ -3450,6 +3450,27 @@ namespace internal
   };
 
 
+
+  // same as above to check
+  // T::const_iterator T::begin() const
+  template <typename T>
+  struct has_begin
+  {
+  private:
+    static void
+    detect(...);
+
+    template <typename U>
+    static decltype(std::declval<U const>().begin())
+    detect(const U &);
+
+  public:
+    static constexpr bool value =
+      std::is_same<typename T::const_iterator,
+                   decltype(detect(std::declval<T>()))>::value;
+  };
+
+
   // access to generic vectors that have operator ().
   // FIXME: this is wrong for Trilinos/Petsc MPI vectors
   template <typename VectorType,
index 12ab08476b5b76d6f496ed07ac3efebe27f3f15e..d3363649aa1864815118cb3c1f19143e658355a3 100644 (file)
@@ -129,5 +129,14 @@ main()
                TrilinosWrappers::MPI::Vector>::value
           << std::endl;
 
+  // check has_begin():
+  deallog
+    << "has_begin:" << std::endl
+    << "LinearAlgebra::distributed::Vector = "
+    << internal::has_begin<LinearAlgebra::distributed::Vector<double>>::value
+    << std::endl
+    << "TrilinosWrappers::MPI::Vector = "
+    << internal::has_begin<TrilinosWrappers::MPI::Vector>::value << std::endl;
+
   deallog << "OK" << std::endl;
 }
index 4e82d5220255e34b378ffc3ec424e0ded7f137c2..71bac87207dc316dc26a23a270da2cf1732cb6cb 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.