Jamba C++ API 8.0.0
Loading...
Searching...
No Matches
Concepts.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 pongasoft
3 *
4 * Licensed under the Apache License, Version 2.0 or the MIT license,
5 * at your option. You may not use this file except in compliance with
6 * one of these licenses. You may obtain copies of the licenses at:
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 * https://opensource.org/licenses/MIT
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 *
17 * @author Yan Pujante
18 */
19
20#ifndef JAMBA_UTILS_CONCEPTS_H
21#define JAMBA_UTILS_CONCEPTS_H
22
23#include <concepts>
24#include <functional>
25
26namespace pongasoft::Utils {
27
32template<typename F, typename T>
33concept UnaryFunction = std::invocable<F &, T const &>;
34
39template<typename F, typename T>
40concept UnaryModifier = std::invocable<F &, T &>;
41
46template<typename F, typename T>
48 std::invocable<F&, T const &> &&
49 std::convertible_to<std::invoke_result_t<F &, T const &>, T>;
50
52template<typename T>
53concept IntegralOrEnum = std::integral<T> || std::is_enum_v<T>;
54
55}
56
57
58#endif //JAMBA_UTILS_CONCEPTS_H
Concept that encapsulates both an integer and an enum (underlying type is an integral).
Definition Concepts.h:53
Matches a callable used for read-only operations.
Definition Concepts.h:33
Matches a callable used for modification.
Definition Concepts.h:40
Matches any callable (lambda, function object, etc.) that can be invoked with a T const& (or T) and r...
Definition Concepts.h:47
Definition CircularBuffer.h:27