Sequoia
Loading...
Searching...
No Matches
StaticGraphDetails.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2018. //
3// Distributed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. //
4// (See accompanying file LICENSE.md or copy at //
5// https://www.gnu.org/licenses/gpl-3.0.en.html) //
7
8#pragma once
9
15
16namespace data_structures
17{
18 template <class, std::size_t, std::size_t, class> class static_partitioned_sequence;
19}
20
21namespace sequoia::maths::graph_impl
22{
23 enum class index_type_tag { u_char, u_short, u_int, u_long};
24
25 template<std::size_t Size, std::size_t Order, bool Embedded>
26 [[nodiscard]]
27 constexpr index_type_tag to_index_max() noexcept
28 {
29 if constexpr ((Order < 255) && (!Embedded || (Size < 255))) return index_type_tag::u_char;
30 else if constexpr((Order < 65535) && (!Embedded || (Size < 65535))) return index_type_tag::u_short;
31 else return index_type_tag::u_long;
32 }
33
34 template
35 <
36 std::size_t Size,
37 std::size_t Order,
38 bool Embedded,
39 index_type_tag=to_index_max<Size, Order, Embedded>()
40 >
42 {
43 using index_type = std::size_t;
44 };
45
46 template
47 <
48 std::size_t Size,
49 std::size_t Order,
50 bool Embedded
51 >
52 struct static_edge_index_type_generator<Size, Order, Embedded, index_type_tag::u_char>
53 {
54 using index_type = unsigned char;
55 };
56
57 template
58 <
59 std::size_t Size,
60 std::size_t Order,
61 bool Embedded
62 >
63 struct static_edge_index_type_generator<Size, Order, Embedded, index_type_tag::u_short>
64 {
65 using index_type = unsigned short;
66 };
67}
Meta-programming elements for graph implementation.
Definition: StaticGraphDetails.hpp:18