ComPPare 1.0.0
Loading...
Searching...
No Matches
concepts.hpp
Go to the documentation of this file.
1/*
2
3Copyright 2025 | Leong Fan FUNG | funglf | stanleyfunglf@gmail.com
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the “Software”), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21SOFTWARE.
22
23*/
33#pragma once
34#include <concepts>
35#include <type_traits>
36#include <ranges>
37#include <string>
38#include <ostream>
39
45{
51 template <typename T>
52 concept Streamable =
53 requires(std::ostream &os, T v) { { os << v } -> std::same_as<std::ostream&>; };
54
60 template <typename T>
61 concept FloatingPoint = std::floating_point<std::remove_cvref_t<T>>;
62
68 template <typename T>
69 concept Integral = std::integral<std::remove_cvref_t<T>>;
70
71
77 template <typename T>
79
80
86 template <typename T>
87 concept String = std::same_as<std::remove_cvref_t<T>, std::string>;
88
94 template <typename T>
95 concept Void = std::is_void_v<std::remove_cvref_t<T>>;
96
102 template <typename R>
105
106}
Concept for an arithmetic type (either floating-point or integral).
Definition concepts.hpp:78
Concept for a floating-point type.
Definition concepts.hpp:61
Concept for an integral type.
Definition concepts.hpp:69
Concept for a range of arithmetic types, excluding strings.
Definition concepts.hpp:103
Concept for a type that can be streamed to an output stream.
Definition concepts.hpp:52
Concept for a string type.
Definition concepts.hpp:87
Concept for a void type.
Definition concepts.hpp:95
Contains commonly used concepts internally within the ComPPare library.