repr 0.1
Reconstructable string representations and more
Loading...
Searching...
No Matches
range_list.h
Go to the documentation of this file.
1#pragma once
2#include <type_traits>
4
5#include "range.h"
6#include "util.h"
7
8namespace librepr::ctei {
9
10template <typename... Ranges>
11struct RangeList : TypeListBase<RangeList, Ranges...>{
12 using last = typename RangeList::template get<0>;
13 constexpr static auto next_index = last::max + 1;
14
15 template <auto Idx>
17 next_index == Idx,
19 typename RangeList::template prepend<Range<Idx>>
20 >;
21
22 template <typename T>
24 next_index == T::min,
26 typename RangeList::template prepend<T>
27 >;
28
29 template <typename T, auto V, auto Idx = V>
31
32 constexpr static bool is_binary_powers(){
33 return (Ranges::is_binary_powers() && ...);
34 }
35};
36
37template <>
38struct RangeList<> : TypeListBase<RangeList> {
39 constexpr static auto full_size = 0;
40
41 template <auto Index>
43
44 template <typename T>
46
47 template <typename T, auto V, auto Idx = V>
49
50 constexpr static bool is_binary_powers(){
51 // special case empty range list to detect flags outside of initial search range
52 return true;
53 }
54};
55} // namespace librepr::ctei
Definition accessor.h:14
std::string code_for()
Definition repr:39
Definition list.h:9
typename pack::Split< Idx, RangeList< Ts... > >::type get
Definition list.h:25
RangeList< T, Ts... > prepend
Definition list.h:40
typename do_split< Idx >::tail tail
Definition list.h:34
static constexpr bool is_binary_powers()
Definition range_list.h:50
Definition range_list.h:11
typename RangeList::template get< 0 > last
Definition range_list.h:12
static constexpr bool is_binary_powers()
Definition range_list.h:32
static constexpr auto next_index
Definition range_list.h:13