arg_router  1.4.0
C++ command line argument parsing and routing
arg_router::add_missing_min_max_policy< MinCount, Policies > Class Template Reference

#include <arg_router/policy/min_max_count.hpp>

Public Types

using type = std::conditional_t< has_min_max, boost::mp11::mp_rename< policies_tuple, tree_node >, boost::mp11::mp_rename< boost::mp11::mp_push_front< policies_tuple, range_policy_type >, tree_node > >
 

Static Public Attributes

constexpr static auto has_min_max
 

Detailed Description

template<std::size_t MinCount, typename... Policies>
class arg_router::add_missing_min_max_policy< MinCount, Policies >

Provides a tree_node type with an unbounded policy::min_max_count_t if a compatible one is not present in Policies.

If no policy implementing minimum_count() and maximum_count() methods is in Policies (e.g. policy::min_max_count_t), then an unbounded policy::min_max_count_t is prepended to Policies.

This is used via inheritance in nodes, e.g.:

template <typename T, typename... Policies>
class my_arg_t : public add_missing_min_max_policy<0, Policies...>::type
{
public:
template <auto has_min_max = add_missing_min_max_policy<0, Policies...>::has_min_max>
constexpr explicit my_arg_t(Policies... policies,
std::enable_if_t<has_min_max>* = nullptr) noexcept :
parent_type{std::move(policies)...}
{
}
template <auto has_min_max = add_missing_min_max_policy<0, Policies...>::has_min_max>
constexpr explicit multi_arg_base_t(Policies... policies,
std::enable_if_t<!has_min_max>* = nullptr) noexcept :
parent_type{policy::min_count<0>, std::move(policies)...}
{
}
};
std::conditional_t< has_min_max, boost::mp11::mp_rename< policies_tuple, tree_node >, boost::mp11::mp_rename< boost::mp11::mp_push_front< policies_tuple, range_policy_type >, tree_node > > type

The constructor specialisation is needed because the parent constructor calls need to match the inherited policies count and order.

Template Parameters
MinCountMinimum count value to use if one not specified by user
PoliciesPack of policies that define its behaviour

Definition at line 193 of file min_max_count.hpp.

Member Typedef Documentation

◆ type

template<std::size_t MinCount, typename... Policies>
using arg_router::add_missing_min_max_policy< MinCount, Policies >::type = std::conditional_t< has_min_max, boost::mp11::mp_rename<policies_tuple, tree_node>, boost::mp11::mp_rename<boost::mp11::mp_push_front<policies_tuple, range_policy_type>, tree_node> >

Equivalent to tree_node<decltype(policy::min_count(0)), Policies...> if has_min_max is false, otherwise tree_node<Policies...>

Definition at line 217 of file min_max_count.hpp.

Member Data Documentation

◆ has_min_max

template<std::size_t MinCount, typename... Policies>
constexpr static auto arg_router::add_missing_min_max_policy< MinCount, Policies >::has_min_max
staticconstexpr
Initial value:
=
boost::mp11::mp_find_if<policies_tuple, has_min_max_t>::value !=
std::tuple_size_v<policies_tuple>

True if there is no policy implementing minimum_count() and maximum_count() methods in Policies.

Definition at line 210 of file min_max_count.hpp.


The documentation for this class was generated from the following file: