domains.hpp 1004 Bytes
Newer Older
Michaël Roynard's avatar
Michaël Roynard committed
1
2
3
4
5
6
7
#pragma once

#include <mln/core/concept/new/cmcstl2.hpp>

#include <mln/core/concept/new/points.hpp>
#include <mln/core/concept/new/values.hpp>

8
9
#include <mln/core/domain/private/domain_traits.hpp>

Michaël Roynard's avatar
Michaël Roynard committed
10
11
12
13
14
15
16
17
#include <type_traits>

namespace mln::concepts
{

  // clang-format off

#ifdef PYLENE_CONCEPT_TS_ENABLED
Michaël Roynard's avatar
Michaël Roynard committed
18

Michaël Roynard's avatar
Michaël Roynard committed
19
20
  // Domain
  template<typename Dom>
21
  concept Domain = 
Michaël Roynard's avatar
Michaël Roynard committed
22
    stl::ForwardRange<Dom> &&
23
24
25
    stl::Same<domain_value_t<Dom>, domain_point_t<Dom>> &&
    Point<domain_point_t<Dom>> &&
    requires(const Dom cdom, domain_point_t<Dom> p) {
26
27
      { cdom.has(p) }   -> bool;
      { cdom.empty() }  -> bool;
Michaël Roynard's avatar
Michaël Roynard committed
28
      // { cdom.size() }   -> stl::UnsignedIntegral&&;
Michaël Roynard's avatar
Michaël Roynard committed
29
    };
Michaël Roynard's avatar
Michaël Roynard committed
30
31
32
33
34
35
36
37
38
39


  // SizedDomain
  template<typename Dom>
  concept Domain = 
    Domain<Dom> &&
    requires(const Dom cdom) {
      { cdom.size() } -> stl::UnsignedIntegral&&;
    };

Michaël Roynard's avatar
Michaël Roynard committed
40
41
42
43
44
#endif // PYLENE_CONCEPT_TS_ENABLED

  // clang-format on

} // namespace mln::concepts
Michaël Roynard's avatar
Michaël Roynard committed
45
46
47

// Validate concept
#include <mln/core/concept/new/archetype/domain.hpp>