namespace internal
{
+ // a helper type-trait that leverage SFINAE to figure out if type T has
+ // ... T::local_element() const
+ template <typename T>
+ struct has_local_element
+ {
+ private:
+ // this will work always.
+ // we let it be void as we know T::local_element() (if exists) should
+ // certainly return something
+ static void
+ detect(...);
+
+ // this detecter will work only if we have "... T::local_element() const"
+ // and its return type will be the same as local_element(),
+ // that we expect to be T::value_type
+ template <typename U>
+ static decltype(std::declval<U const>().local_element(0))
+ detect(const U &);
+
+ public:
+ // finally here we check if our detector has return type same as
+ // T::value_type. This will happen if compiler can use second detector,
+ // otherwise SFINAE let it work with the more general first one that is void
+ static constexpr bool value =
+ std::is_same<typename T::value_type,
+ decltype(detect(std::declval<T>()))>::value;
+ };
+
+
// access to generic vectors that have operator ().
template <typename VectorType>
inline typename VectorType::value_type &
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2014 - 2018 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+
+// test internal typetraits used in FEEvaluation
+
+#include <deal.II/lac/la_parallel_vector.h>
+#include <deal.II/lac/trilinos_vector.h>
+
+#include <deal.II/matrix_free/fe_evaluation.h>
+
+#include "../tests.h"
+
+
+int
+main()
+{
+ initlog();
+
+ deallog << "has_local_element:" << std::endl
+ << "LinearAlgebra::distributed::Vector = "
+ << internal::has_local_element<
+ LinearAlgebra::distributed::Vector<double>>::value
+ << std::endl
+ << "TrilinosWrappers::MPI::Vector = "
+ << internal::has_local_element<TrilinosWrappers::MPI::Vector>::value
+ << std::endl;
+
+ deallog << "OK" << std::endl;
+}