SeqAn3
3.4.0
The Modern C++ library for sequence analysis.
Toggle main menu visibility
Loading...
Searching...
No Matches
lazy_conditional.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3
// SPDX-License-Identifier: BSD-3-Clause
4
9
10
#pragma once
11
12
#include <
type_traits
>
13
14
#include <
seqan3/core/platform.hpp
>
15
16
namespace
seqan3::detail
17
{
18
19
// ----------------------------------------------------------------------------
20
// lazy
21
// ----------------------------------------------------------------------------
22
28
template
<
template
<
typename
...>
typename
template_t,
typename
... spec_t>
29
struct
lazy
30
{};
31
32
// ----------------------------------------------------------------------------
33
// instantiate
34
// ----------------------------------------------------------------------------
35
41
template
<
typename
t>
42
struct
instantiate : std::type_identity<t>
43
{};
44
51
template
<
template
<
typename
...>
typename
template_t,
typename
... spec_t>
52
struct
instantiate<lazy<template_t, spec_t...>>
53
{
55
using
type = template_t<spec_t...>;
56
};
57
62
template
<
typename
t>
63
requires
requires
{
typename
instantiate<t>::type; }
64
using
instantiate_t =
typename
instantiate<t>::type;
65
66
// ----------------------------------------------------------------------------
67
// instantiate_if
68
// ----------------------------------------------------------------------------
69
76
template
<
typename
t,
bool
condition>
77
struct
instantiate_if : std::false_type
78
{};
79
86
template
<
typename
t>
87
struct
instantiate_if<t, true> : std::type_identity<t>
88
{};
89
97
template
<
template
<
typename
...>
typename
template_t,
typename
... spec_t>
98
struct
instantiate_if<lazy<template_t, spec_t...>, true>
99
{
101
using
type = template_t<spec_t...>;
102
};
103
108
template
<
typename
t,
bool
condition>
109
requires
requires
{
typename
instantiate_if<t, condition>::type; }
110
using
instantiate_if_t =
typename
instantiate_if<t, condition>::type;
111
116
template
<
typename
t,
bool
condition>
117
requires
requires
{ instantiate_if_t<t, condition>::value; }
118
inline
constexpr
auto
instantiate_if_v = instantiate_if_t<t, condition>::value;
119
120
// ----------------------------------------------------------------------------
121
// lazy_conditional
122
// ----------------------------------------------------------------------------
123
137
template
<
bool
decision,
typename
on_true_t,
typename
on_false_t>
138
struct
lazy_conditional : instantiate<std::conditional_t<decision, on_true_t, on_false_t>>
139
{};
140
147
template
<
bool
decision,
typename
on_true_t,
typename
on_false_t>
148
requires
requires
{
typename
instantiate_t<std::conditional_t<decision, on_true_t, on_false_t>>; }
149
using
lazy_conditional_t = instantiate_t<std::conditional_t<decision, on_true_t, on_false_t>>;
150
151
}
// namespace seqan3::detail
platform.hpp
Provides platform and dependency checks.
type_traits
Hide me
Version:
seqan3
utility
type_traits
lazy_conditional.hpp
Generated on
for SeqAn3 by
1.17.0