sharg 1.0.0
THE argument parser for bio-c++ tools.
concept.hpp
Go to the documentation of this file.
1// --------------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/sharg-parser/blob/main/LICENSE.md
6// --------------------------------------------------------------------------------------------------------
7
13#pragma once
14
15#include <concepts>
16
18
19namespace sharg
20{
21
38// clang-format off
39template <typename value_type>
40concept istreamable = requires (std::istream & is, value_type & val)
41{
42 {is >> val} -> std::same_as<std::istream&>;
43};
44// clang-format on
45
62// clang-format off
63template <typename type>
64concept ostreamable = requires (std::ostream & os, type & val)
65 {
66 {os << val} -> std::same_as<std::ostream&>;
67 }
68 ||
69 requires (std::ostream & os, std::ranges::range_reference_t<type> val)
70 {
71 {os << val} -> std::same_as<std::ostream&>;
72 };
73// clang-format on
74
93template <typename option_type>
94concept parsable =
96
97} // namespace sharg
Concept for types that can be parsed from a std::istream via the stream operator.
Definition: concept.hpp:40
Checks whether the free function sharg::enumeration_names can be called on the type.
Definition: enumeration_names.hpp:238
Concept for types that can be parsed into a std::ostream via the stream operator.
Definition: concept.hpp:64
Checks whether the the type can be used in an add_(positional_)option call on the parser.
Definition: concept.hpp:94
Provides auxiliary information.