SeqAn3 3.4.0-rc.4
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::detail::lazy_conditional< decision, on_true_t, on_false_t > Struct Template Reference

Behaves like std::conditional, but instantiates types wrapped in seqan3::lazy. More...

#include <seqan3/utility/type_traits/lazy_conditional.hpp>

+ Inheritance diagram for seqan3::detail::lazy_conditional< decision, on_true_t, on_false_t >:

Related Symbols

(Note that these are not member symbols.)

template<bool decision, typename on_true_t , typename on_false_t >
using lazy_conditional_t = instantiate_t< std::conditional_t< decision, on_true_t, on_false_t > >
 Behaves like std::conditional_t, but instantiates types wrapped in seqan3::lazy. Transformation trait shortcut.
 

Detailed Description

template<bool decision, typename on_true_t, typename on_false_t>
struct seqan3::detail::lazy_conditional< decision, on_true_t, on_false_t >

Behaves like std::conditional, but instantiates types wrapped in seqan3::lazy.

Template Parameters
decisionWhether to resolve to the first type or the second.
on_true_tThe return type in case decision is true.
on_false_tThe return type in case decision is false.

Example

// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include <forward_list> // std::forward_list
#include <ranges> // std::ranges::input_range
#include <vector> // std::vector
#include <seqan3/core/range/type_traits.hpp> // seqan3::size_type_t
#include <seqan3/utility/type_traits/lazy_conditional.hpp> // seqan3::lazy_conditional_t
template <std::ranges::input_range rng_t>
void foobar(rng_t && range)
{
#if 0
// The following would fail to compile if rng_t is not sized,
// because std::ranges::range_size_t<rngt_t> needs to be valid
// (independent of whether the condition evaluates to true)
std::ranges::range_size_t<rng_t>,
void>;
#endif
// This delays instantiation of std::ranges::range_size_t<rngt_t> until after the
// conditional-decision is made:
using size_type = seqan3::detail::lazy_conditional_t<std::ranges::sized_range<rng_t>,
void>;
// DO SOMETHING with size_type
}
int main()
{
foobar(std::vector<int>{}); // sized
foobar(std::forward_list<int>{}); // not sized
}
#pragma GCC diagnostic pop
Provides various transformation traits used by the range module.
Provides lazy template instantiation traits.
constexpr auto const & get(configuration< configs_t... > const &config) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition configuration.hpp:412
An empty type whose only purpose is to hold an uninstantiated template plus its arguments.
Definition lazy_conditional.hpp:30

complete

Friends And Related Symbol Documentation

◆ lazy_conditional_t

Behaves like std::conditional_t, but instantiates types wrapped in seqan3::lazy. Transformation trait shortcut.

Template Parameters
decisionWhether to resolve to the first type or the second.
on_true_tThe return type in case decision is true.
on_false_tThe return type in case decision is false.

The documentation for this struct was generated from the following file:
Hide me