DryChem 1.0.0
A generic, compile-time C++ toolbox with no dependencies for the modern computational chemistry project.
Loading...
Searching...
No Matches
integerSequenceAlgorithms.hpp
Go to the documentation of this file.
1// Copyright (c) 2020-2025 Cody R. Drisko. All rights reserved.
2// Licensed under the MIT License. See the LICENSE file in the project root for more information.
3//
4// Name: integerSequenceAlgorithms.hpp
5// Author: crdrisko
6// Date: 01/08/2021-08:00:49
7// Description: A collection of all the metafunctions relating to the std::integer_sequence<> class template
8
9#ifndef DRYCHEM_COMMON_UTILITIES_INCLUDE_COMMON_UTILS_META_TYPES_INTEGER_SEQUENCES_INTEGERSEQUENCEALGORITHMS_HPP
10#define DRYCHEM_COMMON_UTILITIES_INCLUDE_COMMON_UTILS_META_TYPES_INTEGER_SEQUENCES_INTEGERSEQUENCEALGORITHMS_HPP
11
12#include <type_traits>
13#include <utility>
14
16
17namespace CppUtils::Meta
18{
27 template<typename T, T Head, T... Tail>
28 struct front_list<std::integer_sequence<T, Head, Tail...>>
29 {
30 using type = std::integral_constant<T, Head>;
31 };
32
33
41 template<typename T, T... Elements>
42 struct is_empty_list<std::integer_sequence<T, Elements...>>
43 {
44 static constexpr bool value = sizeof...(Elements) == 0;
45 };
46
47
56 template<typename T, T Head, T... Tail>
57 struct pop_front_list<std::integer_sequence<T, Head, Tail...>>
58 {
59 using type = std::integer_sequence<T, Tail...>;
60 };
61
62
71 template<typename T, T... Elements, T NewElement>
72 struct push_back_list<std::integer_sequence<T, Elements...>, std::integral_constant<T, NewElement>>
73 {
74 using type = std::integer_sequence<T, Elements..., NewElement>;
75 };
76
77
86 template<typename T, T... Elements, T NewElement>
87 struct push_front_list<std::integer_sequence<T, Elements...>, std::integral_constant<T, NewElement>>
88 {
89 using type = std::integer_sequence<T, NewElement, Elements...>;
90 };
91} // namespace CppUtils::Meta
92
93#endif
Definition frontList.hpp:13
std::integral_constant< T, Head > type
Definition integerSequenceAlgorithms.hpp:30
Definition frontList.hpp:21
static constexpr bool value
Definition integerSequenceAlgorithms.hpp:44
Definition isEmptyList.hpp:24
std::integer_sequence< T, Tail... > type
Definition integerSequenceAlgorithms.hpp:59
Definition popFrontList.hpp:21
std::integer_sequence< T, Elements..., NewElement > type
Definition integerSequenceAlgorithms.hpp:74
Definition pushBackList.hpp:22
std::integer_sequence< T, NewElement, Elements... > type
Definition integerSequenceAlgorithms.hpp:89
Definition pushFrontList.hpp:22