CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
iter_concept.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
13
14#include <iterator>
15#include <type_traits>
16
17namespace CeresEngine::traits {
18
21 template<class T, class = void> struct iter_concept {};
22
23 template<class T>
24 struct iter_concept<T,
26 // clang-format off
27 has_iterator_traits_iterator_concept_v<remove_cvref_t<T>>
28 // clang-format on
29 >> {
30 using type = typename std::iterator_traits<remove_cvref_t<T>>::iterator_concept;
31 };
32
33 template<class T>
34 struct iter_concept<T,
36 // clang-format off
37 !has_iterator_traits_iterator_concept_v<remove_cvref_t<T>> &&
38 has_iterator_traits_iterator_category_v<remove_cvref_t<T>>
39 // clang-format on
40 >> {
41 using type = typename std::iterator_traits<remove_cvref_t<T>>::iterator_category;
42 };
43
44 template<class T>
45 struct iter_concept<T,
47 // clang-format off
48 !has_iterator_traits_iterator_concept_v<remove_cvref_t<T>> &&
49 !has_iterator_traits_iterator_category_v<remove_cvref_t<T>>
50 // clang-format on
51 >> {
52 using type = std::random_access_iterator_tag;
53 };
54
56 template<class T> using iter_concept_t = typename iter_concept<T>::type;
57
58} // namespace CeresEngine::traits
Definition Partitioner.hpp:146
typename iter_concept< T >::type iter_concept_t
A C++17 type trait equivalent to the C++20 iter_concept concept.
Definition iter_concept.hpp:56
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition Span.hpp:668
A C++17 type trait equivalent to the C++20 iter_concept concept.
Definition iter_concept.hpp:21