CPP-AP 3.0.1
Command-line argument parser for C++20
Loading...
Searching...
No Matches
helpers.hpp
Go to the documentation of this file.
1// Copyright (c) 2023-2025 Jakub MusiaƂ
2// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
3// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
4
10#pragma once
11
12#include "concepts.hpp"
13
14#include <utility>
15#include <variant>
16
17namespace ap::action::util {
18
21template <c_value_action_specifier AS, ap::util::c_argument_value_type T>
22using callable_type = typename AS::template type<T>;
23
25template <ap::util::c_argument_value_type T>
26using value_action_variant_type = std::variant<
30
36template <ap::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 ap::action::util
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::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
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::modify, value_type > &action) const
The call operator overload for the modify action type.
Definition helpers.hpp:60
Provides the general concept definitions.