arg_router  1.4.0
C++ command line argument parsing and routing
default_value.hpp
1 // Copyright (C) 2022-2023 by Camden Mannett.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
4 
5 #pragma once
6 
7 #include "arg_router/config.hpp"
8 #include "arg_router/policy/policy.hpp"
9 
10 namespace arg_router::policy
11 {
16 template <typename T>
18 {
19 public:
21  using value_type = T;
22 
24  constexpr static auto priority = std::size_t{500};
25 
30  constexpr explicit default_value(value_type value) noexcept : value_{std::move(value)} {}
31 
40  template <typename ValueType, typename... Parents>
41  [[nodiscard]] constexpr ValueType missing_phase(
42  [[maybe_unused]] const Parents&... parents) const noexcept
43  {
44  return value_;
45  }
46 
47 private:
48  value_type value_;
49 };
50 
51 template <typename T>
52 struct is_policy<default_value<T>> : std::true_type {
53 };
54 } // namespace arg_router::policy
constexpr ValueType missing_phase([[maybe_unused]] const Parents &... parents) const noexcept
constexpr default_value(value_type value) noexcept
constexpr static auto priority