Sharg 1.1.2-rc.1
The argument parser for bio-c++ tools.
Loading...
Searching...
No Matches
concept.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 <concepts>
13
15
16namespace sharg
17{
18
35// clang-format off
36template <typename value_type>
37concept istreamable = requires (std::istream & is, value_type & val)
38{
39 {is >> val} -> std::same_as<std::istream&>;
40};
41// clang-format on
42
59// clang-format off
60template <typename type>
61concept ostreamable = requires (std::ostream & os, type & val)
62 {
63 {os << val} -> std::same_as<std::ostream&>;
64 }
65 ||
66 requires (std::ostream & os, std::ranges::range_reference_t<type> val)
67 {
68 {os << val} -> std::same_as<std::ostream&>;
69 };
70// clang-format on
71
90template <typename option_type>
91concept parsable =
93
94} // namespace sharg
Concept for types that can be parsed from a std::istream via the stream operator.
Definition concept.hpp:37
Checks whether the free function sharg::enumeration_names can be called on the type.
Definition enumeration_names.hpp:235
Concept for types that can be parsed into a std::ostream via the stream operator.
Definition concept.hpp:61
Checks whether the the type can be used in an add_(positional_)option call on the parser.
Definition concept.hpp:91
Provides auxiliary information.
T is_same_v
Hide me