CPP-ARGON 4.0.0
Command-Line Argument Parser for C++20
Loading...
Searching...
No Matches
helpers.hpp
Go to the documentation of this file.
1// Copyright (c) 2023-2026 Jakub Musiał
2// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
3// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
4
10#pragma once
11
13
14#include <utility>
15#include <variant>
16
17namespace argon::action::util {
18
21template <c_value_action_specifier AS, argon::util::c_argument_value_type T>
22using callable_type = typename AS::template type<T>;
23
25template <argon::util::c_argument_value_type T>
26using value_action_variant_type = std::variant<
30
36template <argon::util::c_argument_value_type T>
38 using value_type = T;
39
45 action(std::as_const(value));
46 }
47
53 value = action(std::as_const(value));
54 }
55
61 action(value);
62 }
63
65};
66
67} // namespace argon::action::util
Defines action-related concepts.
typename AS::template type< T > callable_type
Template argument action callable type alias.
Definition helpers.hpp:22
std::variant< callable_type< action_type::observe, T >, callable_type< action_type::transform, T >, callable_type< action_type::modify, T > > value_action_variant_type
Template argument action callabla variant type alias.
Definition helpers.hpp:29
A visitor structure used to apply value actions.
Definition helpers.hpp:37
void operator()(const callable_type< action_type::modify, value_type > &action) const
The call operator overload for the modify action type.
Definition helpers.hpp:60
value_type & value
A reference to the argument's value for which the action will be applied.
Definition helpers.hpp:64
void operator()(const callable_type< action_type::transform, value_type > &action) const
The call operator overload for the transform action type.
Definition helpers.hpp:52
void operator()(const callable_type< action_type::observe, value_type > &action) const
The call operator overload for the observe action type.
Definition helpers.hpp:44