SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
optional.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <optional>
13
17
18namespace seqan3
19{
20
23template <>
24struct optional_printer<std::nullopt_t>
25{
31 template <typename stream_t>
32 constexpr void operator()(stream_t & stream, std::nullopt_t const SEQAN3_DOXYGEN_ONLY(arg)) const
33 {
34 stream << "<VALUELESS_OPTIONAL>";
35 }
36};
37
42template <typename T>
43struct optional_printer<std::optional<T>>
44{
51 template <typename stream_t, typename arg_t>
52 constexpr void operator()(stream_t & stream, arg_t && arg) const
53 {
54 if (arg.has_value())
55 stream << *arg;
56 else
57 stream << "<VALUELESS_OPTIONAL>";
58 }
59};
60
61} // namespace seqan3
Provides various type traits on generic types.
Provides seqan3::debug_stream and related types.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
SeqAn specific customisations in the standard namespace.
constexpr void operator()(stream_t &stream, std::nullopt_t const arg) const
Prints std::nullopt_t to formatted output stream.
Definition optional.hpp:32
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
Definition default_printer.hpp:40
Provides type traits for working with templates.
Hide me