dune-functions 2.9.0
backends/concepts.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_FUNCTIONS_BACKEND_CONCEPTS_HH
4#define DUNE_FUNCTIONS_BACKEND_CONCEPTS_HH
5
6
7#include <utility>
8
9#include <dune/common/concept.hh>
10
11namespace Dune {
12namespace Functions {
13namespace Concept {
14
15using namespace Dune::Concept;
16
17
18// Concept for a ConstVectorBackend
19template<class GlobalBasis>
21{
22 template<class V>
23 auto require(const V& v) -> decltype(
24 v[std::declval<typename GlobalBasis::MultiIndex>()]
25 );
26};
27
28// Concept for a VectorBackend
29template<class GlobalBasis>
30struct VectorBackend : Refines<ConstVectorBackend<GlobalBasis>>
31{
32 template<class V>
33 auto require(const V& v) -> decltype(
34 const_cast<V&>(v).resize(std::declval<const GlobalBasis&>()),
35 const_cast<V&>(v)[std::declval<typename GlobalBasis::MultiIndex>()] = v[std::declval<typename GlobalBasis::MultiIndex>()]
36 );
37};
38
39} // namespace Dune::Functions::Concept
40} // namespace Dune::Functions
41} // namespace Dune
42
43
44#endif // DUNE_FUNCTIONS_BACKEND_CONCEPTS_HH
Definition: polynomial.hh:10
Definition: backends/concepts.hh:21
auto require(const V &v) -> decltype(v[std::declval< typename GlobalBasis::MultiIndex >()])
Definition: backends/concepts.hh:31
auto require(const V &v) -> decltype(const_cast< V & >(v).resize(std::declval< const GlobalBasis & >()), const_cast< V & >(v)[std::declval< typename GlobalBasis::MultiIndex >()]=v[std::declval< typename GlobalBasis::MultiIndex >()])