fennec
Loading...
Searching...
No Matches
vector_traits.h
Go to the documentation of this file.
1// =====================================================================================================================
2// fennec, a free and open source game engine
3// Copyright © 2025 Medusa Slockbower
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <https://www.gnu.org/licenses/>.
17// =====================================================================================================================
18
30
31#ifndef FENNEC_MATH_VECTOR_TRAITS_H
32#define FENNEC_MATH_VECTOR_TRAITS_H
33
65
66#include <fennec/math/detail/_vector_traits.h>
67
68namespace fennec
69{
70
74template<typename T> struct is_vector : detail::_is_vector_helper<remove_cvref_t<T>>{};
75
79template<typename T> constexpr bool is_vector_v = is_vector<T>::value;
80
84template<typename T> struct component_count : detail::_component_count_helper<remove_cvref_t<T>>{};
85
89template<typename T> constexpr size_t component_count_v = component_count<T>::value;
90
94template<typename...Ts> struct total_component_count : integral_constant<size_t, (component_count_v<Ts> + ...)>{};
95
96// Override for empty list
97template<> struct total_component_count<> : integral_constant<size_t, 0>{};
98
102template<typename...Ts> constexpr size_t total_component_count_v = total_component_count<Ts...>::value;
103
104
105}
106
107#endif // FENNEC_MATH_VECTOR_TRAITS_H
Get the number of Components in T, returns 1 for types that pass is_arithmetic<T>,...
Definition vector_traits.h:84
metaprogramming integral constant
Definition constants.h:76
check if T is a fennec::vector type
Definition vector_traits.h:74
Get the total number of Components among types in TypesT.
Definition vector_traits.h:94
constexpr size_t component_count_v
shorthand for component_count<T>::value
Definition vector_traits.h:89
constexpr size_t total_component_count_v
shorthand for component_count<T>::value
Definition vector_traits.h:102
constexpr bool is_vector_v
shorthand for is_vector<T>::value
Definition vector_traits.h:79