CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Concepts.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "Macros.hpp"
11
12#include <utility>
13
14namespace CeresEngine {
15
20 template<typename T>
21 concept CArithmetic = requires(T a, T b) {
22 a + b;
23 a - b;
24 a* b;
25 a / b;
26 };
27
31 template<typename T>
32 concept CHashable = requires(T a) {
33 std::is_convertible_v<decltype(std::hash<T>{}(a)), std::size_t>;
34 };
35
36 template<typename T, typename U = T>
37 concept CEqualityComparable = requires(T lhs, U rhs) {
38 {lhs == rhs};
39 std::is_convertible_v<decltype(lhs == rhs), bool>;
40 };
41
42 template<typename T, typename... Args>
43 concept CInvocable = requires(T func, Args... args) {
44 func(args...);
45 };
46
47} // namespace CeresEngine
A concept type that checks if a given type T has arithmetic properties.
Definition Concepts.hpp:21
Definition Concepts.hpp:37
Declaration of the concept "Hashable", which is satisfied by any type 'T' such that for values 'a' of...
Definition Concepts.hpp:32
Definition Concepts.hpp:43
Definition Application.hpp:19