Loading...
Searching...
No Matches
optional.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <optional>
#include <seqan3/core/debug_stream/debug_stream_type.hpp>
#include <seqan3/core/detail/template_inspection.hpp>
#include <seqan3/utility/type_traits/basic.hpp>
namespace seqan3
{
template <>
struct optional_printer<std::nullopt_t>
{
template <typename stream_t>
constexpr void operator()(stream_t & stream, std::nullopt_t const SEQAN3_DOXYGEN_ONLY(arg)) const
{
stream << "<VALUELESS_OPTIONAL>";
}
};
template <typename T>
struct optional_printer<std::optional<T>>
{
template <typename stream_t, typename arg_t>
constexpr void operator()(stream_t & stream, arg_t && arg) const
{
if (arg.has_value())
stream << *arg;
else
stream << "<VALUELESS_OPTIONAL>";
}
};
} // namespace seqan3
basic.hpp
Provides various type traits on generic types.
debug_stream_type.hpp
Provides seqan3::debug_stream and related types.
seqan3
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
std
SeqAn specific customisations in the standard namespace.
std::nullopt_t
optional
seqan3::optional_printer< std::nullopt_t >::operator()
constexpr void operator()(stream_t &stream, std::nullopt_t const arg) const
Prints std::nullopt_t to formatted output stream.
Definition optional.hpp:32
seqan3::optional_printer< std::optional< T > >::operator()
constexpr void operator()(stream_t &stream, arg_t &&arg) const
Print the optional to the stream by printing its value or nothing if valueless.
Definition optional.hpp:52
seqan3::optional_printer
Definition default_printer.hpp:40
template_inspection.hpp
Provides type traits for working with templates.
Hide me