neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
variadic.hpp
Go to the documentation of this file.
1/*
2 * variadic.hpp
3 *
4 * PUBLIC DOMAIN
5 *
6 * THIS SOURCE FILE IS PROVIDED BY THE CONTRIBUTORS "AS
7 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
8 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
9 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
10 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
11 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
12 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
13 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
14 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
15 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
16 * SOURCE FILE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 */
18
19#pragma once
20
21#include <neolib/neolib.hpp>
22#include <type_traits>
23
24namespace neolib
25{
26 namespace variadic
27 {
28 template <typename...>
29 struct index;
30
31 // found it
32 template <typename T, typename... R>
33 struct index<T, T, R...> : std::integral_constant<size_t, 0u> {};
34
35 // still looking
36 template <typename T, typename F, typename... R>
37 struct index<T, F, R...> : std::integral_constant<size_t, 1u + index<T, R...>::value> {};
38
39 template <typename T, typename... R>
40 constexpr size_t index_v = index<T, R...>::value;
41
42 template <typename T, typename... R>
44 }
45}
constexpr size_t index_v
Definition variadic.hpp:40
constexpr size_t no_reference_index_v
Definition variadic.hpp:43