Skip to content
Snippets Groups Projects
Commit bdc6c3a4 authored by Simon Praetorius's avatar Simon Praetorius
Browse files

Provide a concept specification of a field types

parent 6439ce01
No related branches found
No related tags found
1 merge request!1494Draft: Add concept describing field types
Pipeline #75669 waiting for manual action
......@@ -5,18 +5,6 @@
#ifndef DUNE_COMMON_CONCEPTS_FIELD_HH
#define DUNE_COMMON_CONCEPTS_FIELD_HH
// check whether c++20 concept can be used
#if __has_include(<version>) && __has_include(<concepts>)
#include <version>
#if __cpp_concepts >= 201907L && __cpp_lib_concepts >= 202002L
#ifndef DUNE_ENABLE_CONCEPTS
#define DUNE_ENABLE_CONCEPTS 1
#endif
#endif
#endif
#if DUNE_ENABLE_CONCEPTS
#include <concepts>
#include <limits>
......@@ -61,6 +49,4 @@ static_assert(Field<Dune::Concept::Archetypes::Field>);
} // end namespace Dune::Concept
#endif // DUNE_ENABLE_CONCEPTS
#endif // DUNE_COMMON_CONCEPTS_FIELD_HH
......@@ -11,11 +11,11 @@
namespace Dune::Concept {
//! Zero is the neutral element of the addition
//! Identity is the neutral element of type `T` of the operation `Op`
template <class T, class Op>
struct Identity;
// Primary template depends on specializations of the template Zero
// Primary template depends on specializations of the template Identity
template <class T, class Op>
constexpr auto identity (T value, Op) noexcept
-> decltype(Identity<T,Op>{}(value))
......
......@@ -12,11 +12,11 @@
namespace Dune::Concept {
//! Zero is the neutral element of the addition
//! Inverse is the inverse element of type `T` of the operation `Op`
template <class T, class Op>
struct Inverse;
// Primary template depends on specializations of the template Zero
// Primary template depends on specializations of the template Inverse
template <class T, class Op>
constexpr auto inverse (T value, Op) noexcept
-> decltype(Inverse<T,Op>{}(value))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment