yfast 0.6.1
Loading...
Searching...
No Matches
concepts.h
1#ifndef _YFAST_INTERNAL_CONCEPTS_H
2#define _YFAST_INTERNAL_CONCEPTS_H
3
4#include <concepts>
5
6namespace yfast::internal {
7
8template <typename Map, typename Key, typename Value>
9concept MapGeneric = requires (Map map, Key key) {
10 { map[key] } -> std::same_as<Value&>;
11 { map.at(key) } -> std::convertible_to<Value>;
12 { map.contains(key) } -> std::convertible_to<bool>;
13 { map.erase(key) };
14 { map.clear() };
15};
16
17template <typename BitExtractor, typename Key>
18concept BitExtractorGeneric = requires (BitExtractor bx, Key key, unsigned int n) {
19 { bx.extract_bit(key, n) } -> std::convertible_to<bool>;
20 { bx.shift(key, n) } -> std::convertible_to<typename BitExtractor::ShiftResult>;
21};
22
23}
24
25#endif
Definition bit_extractor.h:14
Definition concepts.h:18
Definition concepts.h:9