Visual Computing Library  devel
Loading...
Searching...
No Matches
type_wrapper.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_BASE_TYPE_WRAPPER_H
24#define VCL_BASE_TYPE_WRAPPER_H
25
26#include "variadic_templates.h"
27
28namespace vcl {
29
37template<typename... Args>
39{
40 static constexpr uint size() { return sizeof...(Args); }
41};
42
48// note: specialization from variadic_templates.h
49template<typename... Args>
50struct FirstType<TypeWrapper<Args...>>
51{
52 using type = std::tuple_element<0, std::tuple<Args...>>::type;
53};
54
66// note: specialization from variadic_templates.h
67template<typename... Args>
69{
70 return indexInTypePack<Args...>(ti);
71}
72
78// note: specialization from variadic_templates.h
79template<typename T, typename... Us>
81{
82 static constexpr uint value = indexInTypePack<T, Us...>();
83};
84
90// note: specialization from variadic_templates.h
91template<uint I, typename... T>
92struct TypeAt<I, TypeWrapper<T...>>
93{
94 using type = TypeAt<I, T...>::type;
95};
96
102// note: specialization from variadic_templates.h
103template<typename... Args>
104struct NumberOfTypes<TypeWrapper<Args...>> : public NumberOfTypes<Args...>
105{
106};
107
113// note: specialization from variadic_templates.h
114template<typename... T>
115struct ForEachType<TypeWrapper<T...>> : public ForEachType<T...>
116{
117};
118
119} // namespace vcl
120
121#endif // VCL_BASE_TYPE_WRAPPER_H
A class representing a box in N-dimensional space.
Definition box.h:46
constexpr uint indexInTypePack()
Function that returns the index of a Type T in a pack of types (variadic templates)....
Definition variadic_templates.h:73
Get the first type of a pack of types (variadic templates) or a TypeWrapper.
Definition variadic_templates.h:47
Allows to apply a function to each type in a variadic template pack.
Definition variadic_templates.h:212
Get the index of a type T in a pack of types (variadic templates) or a TypeWrapper.
Definition variadic_templates.h:138
Get the number of types in a pack of types (variadic templates) or a TypeWrapper.
Definition variadic_templates.h:189
Get the type at a given index in a pack of types (variadic templates) or a TypeWrapper.
Definition variadic_templates.h:156
A simple structure that wraps a list of variadic templates, without instantiating anything....
Definition type_wrapper.h:39