arg_router  1.4.0
C++ command line argument parsing and routing
string_selector.hpp
Go to the documentation of this file.
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 
8 
9 #ifndef AR_ENABLE_CPP20_STRINGS
10 
11 # include <boost/preprocessor/variadic.hpp>
12 
16 namespace arg_router::multi_lang
17 {
24 template <std::size_t I, typename... S>
25 using string_selector = std::tuple_element_t<I, std::tuple<S...>>;
26 } // namespace arg_router::multi_lang
27 
28 # define AR_SM_UNPACK(z, n, var_list) AR_STRING(BOOST_PP_ARRAY_ELEM(n, var_list))
29 
44 # define SM_(I, ...) \
45  arg_router::multi_lang::string_selector<I, \
46  BOOST_PP_ENUM( \
47  BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), \
48  AR_SM_UNPACK, \
49  BOOST_PP_VARIADIC_TO_ARRAY(__VA_ARGS__))>
50 
51 #endif
std::tuple_element_t< I, std::tuple< S... > > string_selector