arg_router  1.4.0
C++ command line argument parsing and routing
error_name.hpp
1 // Copyright (C) 2022 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/policy/policy.hpp"
8 
9 namespace arg_router::policy
10 {
26 template <typename S>
28 {
29 public:
31  using string_type = S;
32 
37  constexpr explicit error_name_t([[maybe_unused]] S str = {}) noexcept {}
38 
43  [[nodiscard]] constexpr static std::string_view error_name() noexcept { return S::get(); }
44 
45 private:
46  static_assert(!error_name().empty(), "Error name must not be empty");
47 };
48 
53 template <typename S>
54 constexpr auto error_name = error_name_t<S>{};
55 
56 template <typename S>
57 struct is_policy<error_name_t<S>> : std::true_type {
58 };
59 } // namespace arg_router::policy
constexpr static std::string_view error_name() noexcept
Definition: error_name.hpp:43
constexpr error_name_t([[maybe_unused]] S str={}) noexcept
Definition: error_name.hpp:37
constexpr auto error_name
Definition: error_name.hpp:54