From 407ab86d45decfbbdb67fe23e5945a0ff11cd469 Mon Sep 17 00:00:00 2001 From: Max Kahnt <max.kahnt@fu-berlin.de> Date: Sat, 30 Sep 2017 15:02:32 +0200 Subject: [PATCH] Add concepts. --- dune/matrix-vector/concepts.hh | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 dune/matrix-vector/concepts.hh diff --git a/dune/matrix-vector/concepts.hh b/dune/matrix-vector/concepts.hh new file mode 100644 index 0000000..c854388 --- /dev/null +++ b/dune/matrix-vector/concepts.hh @@ -0,0 +1,37 @@ +#ifndef DUNE_MATRIX_VECTOR_CONCEPTS_HH +#define DUNE_MATRIX_VECTOR_CONCEPTS_HH + +// though not needed for this file, checking +// for a concept requires this include anyway +#include <dune/common/concept.hh> + +namespace Dune { +namespace MatrixVector { +namespace Concept { + +struct HasBegin { + template <class C> + auto require(C&& c) -> decltype(c.begin()); +}; + + +struct HasN { + template <class C> + auto require(C&& c) -> decltype(c.N()); +}; + +struct HasResize { + template <class C> + auto require(C&& c) -> decltype(c.resize(0)); +}; + +struct HasSize { + template <class C> + auto require(C&& c) -> decltype(c.size()); +}; + +} // end namespace Concept +} // end namespace MatrixVector +} // end namespace Dune + +#endif // DUNE_MATRIX_VECTOR_CONCEPTS_HH -- GitLab