xref: /freebsd/contrib/llvm-project/libcxx/include/concepts (revision 5ffd83dbcc34f10e07f6d3e968ae6365869615f4)
1*5ffd83dbSDimitry Andric// -*- C++ -*-
2*5ffd83dbSDimitry Andric//===-------------------------- concepts ----------------------------------===//
3*5ffd83dbSDimitry Andric//
4*5ffd83dbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*5ffd83dbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
6*5ffd83dbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*5ffd83dbSDimitry Andric//
8*5ffd83dbSDimitry Andric//===----------------------------------------------------------------------===//
9*5ffd83dbSDimitry Andric
10*5ffd83dbSDimitry Andric#ifndef _LIBCPP_CONCEPTS
11*5ffd83dbSDimitry Andric#define _LIBCPP_CONCEPTS
12*5ffd83dbSDimitry Andric
13*5ffd83dbSDimitry Andric/*
14*5ffd83dbSDimitry Andric    concepts synopsis
15*5ffd83dbSDimitry Andricnamespace std {
16*5ffd83dbSDimitry Andric  // [concepts.lang], language-related concepts
17*5ffd83dbSDimitry Andric  // [concept.same], concept same_as
18*5ffd83dbSDimitry Andric  template<class T, class U>
19*5ffd83dbSDimitry Andric    concept same_as = see below;
20*5ffd83dbSDimitry Andric
21*5ffd83dbSDimitry Andric  // [concept.derived], concept derived_from
22*5ffd83dbSDimitry Andric  template<class Derived, class Base>
23*5ffd83dbSDimitry Andric    concept derived_from = see below;
24*5ffd83dbSDimitry Andric
25*5ffd83dbSDimitry Andric  // [concept.convertible], concept convertible_to
26*5ffd83dbSDimitry Andric  template<class From, class To>
27*5ffd83dbSDimitry Andric    concept convertible_to = see below;
28*5ffd83dbSDimitry Andric
29*5ffd83dbSDimitry Andric  // [concept.commonref], concept common_reference_with
30*5ffd83dbSDimitry Andric  template<class T, class U>
31*5ffd83dbSDimitry Andric    concept common_reference_with = see below;
32*5ffd83dbSDimitry Andric
33*5ffd83dbSDimitry Andric  // [concept.common], concept common_with
34*5ffd83dbSDimitry Andric  template<class T, class U>
35*5ffd83dbSDimitry Andric    concept common_with = see below;
36*5ffd83dbSDimitry Andric
37*5ffd83dbSDimitry Andric  // [concepts.arithmetic], arithmetic concepts
38*5ffd83dbSDimitry Andric  template<class T>
39*5ffd83dbSDimitry Andric    concept integral = see below;
40*5ffd83dbSDimitry Andric  template<class T>
41*5ffd83dbSDimitry Andric    concept signed_integral = see below;
42*5ffd83dbSDimitry Andric  template<class T>
43*5ffd83dbSDimitry Andric    concept unsigned_integral = see below;
44*5ffd83dbSDimitry Andric  template<class T>
45*5ffd83dbSDimitry Andric    concept floating_point = see below;
46*5ffd83dbSDimitry Andric
47*5ffd83dbSDimitry Andric  // [concept.assignable], concept assignable_from
48*5ffd83dbSDimitry Andric  template<class LHS, class RHS>
49*5ffd83dbSDimitry Andric    concept assignable_from = see below;
50*5ffd83dbSDimitry Andric
51*5ffd83dbSDimitry Andric  // [concept.swappable], concept swappable
52*5ffd83dbSDimitry Andric  namespace ranges {
53*5ffd83dbSDimitry Andric    inline namespace unspecified {
54*5ffd83dbSDimitry Andric      inline constexpr unspecified swap = unspecified;
55*5ffd83dbSDimitry Andric    }
56*5ffd83dbSDimitry Andric  }
57*5ffd83dbSDimitry Andric  template<class T>
58*5ffd83dbSDimitry Andric    concept swappable = see below;
59*5ffd83dbSDimitry Andric  template<class T, class U>
60*5ffd83dbSDimitry Andric    concept swappable_with = see below;
61*5ffd83dbSDimitry Andric
62*5ffd83dbSDimitry Andric  // [concept.destructible], concept destructible
63*5ffd83dbSDimitry Andric  template<class T>
64*5ffd83dbSDimitry Andric    concept destructible = see below;
65*5ffd83dbSDimitry Andric
66*5ffd83dbSDimitry Andric  // [concept.constructible], concept constructible_from
67*5ffd83dbSDimitry Andric  template<class T, class... Args>
68*5ffd83dbSDimitry Andric    concept constructible_from = see below;
69*5ffd83dbSDimitry Andric
70*5ffd83dbSDimitry Andric  // [concept.defaultconstructible], concept default_constructible
71*5ffd83dbSDimitry Andric  template<class T>
72*5ffd83dbSDimitry Andric    concept default_constructible = see below;
73*5ffd83dbSDimitry Andric
74*5ffd83dbSDimitry Andric  // [concept.moveconstructible], concept move_constructible
75*5ffd83dbSDimitry Andric  template<class T>
76*5ffd83dbSDimitry Andric    concept move_constructible = see below;
77*5ffd83dbSDimitry Andric
78*5ffd83dbSDimitry Andric  // [concept.copyconstructible], concept copy_constructible
79*5ffd83dbSDimitry Andric  template<class T>
80*5ffd83dbSDimitry Andric    concept copy_constructible = see below;
81*5ffd83dbSDimitry Andric
82*5ffd83dbSDimitry Andric  // [concepts.compare], comparison concepts
83*5ffd83dbSDimitry Andric  // [concept.boolean], concept boolean
84*5ffd83dbSDimitry Andric  template<class B>
85*5ffd83dbSDimitry Andric    concept boolean = see below;
86*5ffd83dbSDimitry Andric
87*5ffd83dbSDimitry Andric  // [concept.equalitycomparable], concept equality_comparable
88*5ffd83dbSDimitry Andric  template<class T>
89*5ffd83dbSDimitry Andric    concept equality_comparable = see below;
90*5ffd83dbSDimitry Andric  template<class T, class U>
91*5ffd83dbSDimitry Andric    concept equality_comparable_with = see below;
92*5ffd83dbSDimitry Andric
93*5ffd83dbSDimitry Andric  // [concept.totallyordered], concept totally_ordered
94*5ffd83dbSDimitry Andric  template<class T>
95*5ffd83dbSDimitry Andric    concept totally_ordered = see below;
96*5ffd83dbSDimitry Andric  template<class T, class U>
97*5ffd83dbSDimitry Andric    concept totally_ordered_with = see below;
98*5ffd83dbSDimitry Andric
99*5ffd83dbSDimitry Andric  // [concepts.object], object concepts
100*5ffd83dbSDimitry Andric  template<class T>
101*5ffd83dbSDimitry Andric    concept movable = see below;
102*5ffd83dbSDimitry Andric  template<class T>
103*5ffd83dbSDimitry Andric    concept copyable = see below;
104*5ffd83dbSDimitry Andric  template<class T>
105*5ffd83dbSDimitry Andric    concept semiregular = see below;
106*5ffd83dbSDimitry Andric  template<class T>
107*5ffd83dbSDimitry Andric    concept regular = see below;
108*5ffd83dbSDimitry Andric
109*5ffd83dbSDimitry Andric  // [concepts.callable], callable concepts
110*5ffd83dbSDimitry Andric  // [concept.invocable], concept invocable
111*5ffd83dbSDimitry Andric  template<class F, class... Args>
112*5ffd83dbSDimitry Andric    concept invocable = see below;
113*5ffd83dbSDimitry Andric
114*5ffd83dbSDimitry Andric  // [concept.regularinvocable], concept regular_invocable
115*5ffd83dbSDimitry Andric  template<class F, class... Args>
116*5ffd83dbSDimitry Andric    concept regular_invocable = see below;
117*5ffd83dbSDimitry Andric
118*5ffd83dbSDimitry Andric  // [concept.predicate], concept predicate
119*5ffd83dbSDimitry Andric  template<class F, class... Args>
120*5ffd83dbSDimitry Andric    concept predicate = see below;
121*5ffd83dbSDimitry Andric
122*5ffd83dbSDimitry Andric  // [concept.relation], concept relation
123*5ffd83dbSDimitry Andric  template<class R, class T, class U>
124*5ffd83dbSDimitry Andric    concept relation = see below;
125*5ffd83dbSDimitry Andric
126*5ffd83dbSDimitry Andric  // [concept.equiv], concept equivalence_relation
127*5ffd83dbSDimitry Andric  template<class R, class T, class U>
128*5ffd83dbSDimitry Andric    concept equivalence_relation = see below;
129*5ffd83dbSDimitry Andric
130*5ffd83dbSDimitry Andric  // [concept.strictweakorder], concept strict_weak_order
131*5ffd83dbSDimitry Andric  template<class R, class T, class U>
132*5ffd83dbSDimitry Andric    concept strict_weak_order = see below;
133*5ffd83dbSDimitry Andric}
134*5ffd83dbSDimitry Andric
135*5ffd83dbSDimitry Andric*/
136*5ffd83dbSDimitry Andric
137*5ffd83dbSDimitry Andric#include <__config>
138*5ffd83dbSDimitry Andric#include <type_traits>
139*5ffd83dbSDimitry Andric#include <version>
140*5ffd83dbSDimitry Andric
141*5ffd83dbSDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
142*5ffd83dbSDimitry Andric#pragma GCC system_header
143*5ffd83dbSDimitry Andric#endif
144*5ffd83dbSDimitry Andric
145*5ffd83dbSDimitry Andric_LIBCPP_PUSH_MACROS
146*5ffd83dbSDimitry Andric#include <__undef_macros>
147*5ffd83dbSDimitry Andric
148*5ffd83dbSDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD
149*5ffd83dbSDimitry Andric
150*5ffd83dbSDimitry Andric#if _LIBCPP_STD_VER > 17 && defined(__cpp_concepts) && __cpp_concepts >= 201811L
151*5ffd83dbSDimitry Andric
152*5ffd83dbSDimitry Andric// [concept.same]
153*5ffd83dbSDimitry Andric
154*5ffd83dbSDimitry Andrictemplate<class _Tp, class _Up>
155*5ffd83dbSDimitry Andricconcept __same_as_impl = _VSTD::_IsSame<_Tp, _Up>::value;
156*5ffd83dbSDimitry Andric
157*5ffd83dbSDimitry Andrictemplate<class _Tp, class _Up>
158*5ffd83dbSDimitry Andricconcept same_as = __same_as_impl<_Tp, _Up> && __same_as_impl<_Up, _Tp>;
159*5ffd83dbSDimitry Andric
160*5ffd83dbSDimitry Andric#endif //_LIBCPP_STD_VER > 17 && defined(__cpp_concepts) && __cpp_concepts >= 201811L
161*5ffd83dbSDimitry Andric
162*5ffd83dbSDimitry Andric_LIBCPP_END_NAMESPACE_STD
163*5ffd83dbSDimitry Andric
164*5ffd83dbSDimitry Andric_LIBCPP_POP_MACROS
165*5ffd83dbSDimitry Andric
166*5ffd83dbSDimitry Andric#endif // _LIBCPP_CONCEPTS
167