LAL: Linear Arrangement Library 23.01.00
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
conditional_list.hpp
1/*********************************************************************
2 *
3 * Linear Arrangement Library - A library that implements a collection
4 * algorithms for linear arrangments of graphs.
5 *
6 * Copyright (C) 2019 - 2023
7 *
8 * This file is part of Linear Arrangement Library. The full code is available
9 * at:
10 * https://github.com/LAL-project/linear-arrangement-library.git
11 *
12 * Linear Arrangement Library is free software: you can redistribute it
13 * and/or modify it under the terms of the GNU Affero General Public License
14 * as published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * Linear Arrangement Library is distributed in the hope that it will be
18 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Affero General Public License for more details.
21 *
22 * You should have received a copy of the GNU Affero General Public License
23 * along with Linear Arrangement Library. If not, see <http://www.gnu.org/licenses/>.
24 *
25 * Contact:
26 *
27 * LluĂ­s Alemany Puig (lalemany@cs.upc.edu)
28 * LARCA (Laboratory for Relational Algorithmics, Complexity and Learning)
29 * CQL (Complexity and Quantitative Linguistics Lab)
30 * Jordi Girona St 1-3, Campus Nord UPC, 08034 Barcelona. CATALONIA, SPAIN
31 * Webpage: https://cqllab.upc.edu/people/lalemany/
32 *
33 * Ramon Ferrer i Cancho (rferrericancho@cs.upc.edu)
34 * LARCA (Laboratory for Relational Algorithmics, Complexity and Learning)
35 * CQL (Complexity and Quantitative Linguistics Lab)
36 * Office S124, Omega building
37 * Jordi Girona St 1-3, Campus Nord UPC, 08034 Barcelona. CATALONIA, SPAIN
38 * Webpage: https://cqllab.upc.edu/people/rferrericancho/
39 *
40 ********************************************************************/
41
42#pragma once
43
44// lal includes
45#include <lal/detail/type_traits/ith_type.hpp>
46#include <lal/detail/type_traits/bool_sequence.hpp>
47#include <lal/detail/type_traits/type_sequence.hpp>
48
49namespace lal {
50namespace detail {
51
53template <std::size_t ith_idx, typename... Ts>
54struct ith_type<ith_idx, type_sequence<Ts...>> : ith_type<ith_idx, Ts...>
55{ };
56
65template <typename bool_seq, typename type_seq>
68 using type =
69 std::conditional_t<
70 bool_seq::num_true == 0,
71 std::nullptr_t,
73 >;
74};
75
77template <typename bool_seq, typename type_seq>
79
80
81static_assert(
82 std::is_same_v<
86 >,
87 double
88 >
89);
90static_assert(
91 std::is_same_v<
95 >,
96 std::nullptr_t
97 >
98);
99static_assert(
100 std::is_same_v<
104 >,
105 char
106 >
107);
108
109} // -- namespace detail
110} // -- namespace lal
typename ith_type< ith_idx, Ts... >::type ith_type_t
Shorthand for ith_type::type.
Definition: ith_type.hpp:88
typename conditional_list< bool_seq, type_seq >::type conditional_list_t
Shorthand for conditional_list.
Definition: conditional_list.hpp:78
Main namespace of the library.
Definition: basic_types.hpp:50
A sequence of Boolean values.
Definition: bool_sequence.hpp:52
Generalization of std::conditional_list.
Definition: conditional_list.hpp:66
std::conditional_t< bool_seq::num_true==0, std::nullptr_t, ith_type_t< bool_seq::index_true, type_seq > > type
The type from type_seq that is to be used according to bool_seq.
Definition: conditional_list.hpp:73
Selection of the ith type of a list of types.
Definition: ith_type.hpp:62
A sequence of types.
Definition: type_sequence.hpp:51