45template <
bool B,
class T =
void>
using enable_if_t =
typename std::enable_if<B, T>::type;
56template <
bool B,
class T,
class F>
using conditional_t =
typename std::conditional<B, T, F>::type;
59template <
typename T>
struct is_bool : std::false_type {};
62template <>
struct is_bool<bool> : std::true_type {};
68template <
typename T>
struct is_shared_ptr<std::shared_ptr<T>> : std::true_type {};
71template <
typename T>
struct is_shared_ptr<const std::shared_ptr<T>> : std::true_type {};
100template <
typename T>
struct element_type<T, typename std::enable_if<is_copyable_ptr<T>::value>::type> {
101 using type =
typename std::pointer_traits<T>::element_type;
111template <
typename T,
typename _ =
void>
struct pair_adaptor : std::false_type {
113 using first_type =
typename std::remove_const<value_type>::type;
117 template <
typename Q>
static auto first(Q &&pair_value) ->
decltype(std::forward<Q>(pair_value)) {
118 return std::forward<Q>(pair_value);
121 template <
typename Q>
static auto second(Q &&pair_value) ->
decltype(std::forward<Q>(pair_value)) {
122 return std::forward<Q>(pair_value);
131 conditional_t<false,
void_t<typename T::value_type::first_type, typename T::value_type::second_type>, void>>
134 using first_type =
typename std::remove_const<typename value_type::first_type>::type;
135 using second_type =
typename std::remove_const<typename value_type::second_type>::type;
138 template <
typename Q>
static auto first(Q &&pair_value) ->
decltype(std::get<0>(std::forward<Q>(pair_value))) {
139 return std::get<0>(std::forward<Q>(pair_value));
142 template <
typename Q>
static auto second(Q &&pair_value) ->
decltype(std::get<1>(std::forward<Q>(pair_value))) {
143 return std::get<1>(std::forward<Q>(pair_value));
154#pragma GCC diagnostic push
155#pragma GCC diagnostic ignored "-Wnarrowing"
159 template <
typename TT,
typename CC>
160 static auto test(
int, std::true_type) ->
decltype(
163#ifdef __NVCC_DIAG_PRAGMA_SUPPORT__
164#pragma nv_diag_suppress 2361
166#pragma diag_suppress 2361
169 TT{std::declval<CC>()}
171#ifdef __NVCC_DIAG_PRAGMA_SUPPORT__
172#pragma nv_diag_default 2361
174#pragma diag_default 2361
178 std::is_move_assignable<TT>());
180 template <
typename TT,
typename CC>
static auto test(
int, std::false_type) -> std::false_type;
182 template <
typename,
typename>
static auto test(...) -> std::false_type;
185 static constexpr bool value =
decltype(test<T, C>(0,
typename std::is_constructible<T, C>::type()))
::value;
188#pragma GCC diagnostic pop
195 template <
typename TT,
typename SS>
196 static auto test(
int) ->
decltype(std::declval<SS &>() << std::declval<TT>(), std::true_type());
198 template <
typename,
typename>
static auto test(...) -> std::false_type;
206 template <
typename TT,
typename SS>
207 static auto test(
int) ->
decltype(std::declval<SS &>() >> std::declval<TT &>(), std::true_type());
209 template <
typename,
typename>
static auto test(...) -> std::false_type;
217 template <
typename TT>
218 static auto test(
int) ->
decltype(std::declval<TT>().real(), std::declval<TT>().imag(), std::true_type());
220 template <
typename>
static auto test(...) -> std::false_type;
229 std::istringstream is;
232 return !is.fail() && !is.rdbuf()->in_avail();
250 void_t<typename T::value_type,
251 decltype(std::declval<T>().end()),
252 decltype(std::declval<T>().clear()),
253 decltype(std::declval<T>().insert(std::declval<decltype(std::declval<T>().end())>(),
254 std::declval<const typename T::value_type &>()))>,
255 void>> :
public conditional_t<std::is_constructible<T, std::string>::value ||
256 std::is_constructible<T, std::wstring>::value,
269 conditional_t<false,
void_t<decltype(std::declval<T>().end()), decltype(std::declval<T>().begin())>, void>>
270 :
public std::true_type {};
273template <
typename T,
typename _ =
void>
struct is_wrapper : std::false_type {};
281 template <
typename SS>
284 static auto test(
int) ->
decltype(std::tuple_size<typename std::decay<SS>::type>
::value, std::true_type{});
285 template <
typename>
static auto test(...) -> std::false_type;
293auto to_string(T &&value) ->
decltype(std::forward<T>(value)) {
294 return std::forward<T>(value);
302 return std::string(value);
311 std::stringstream stream;
319 !is_readable_container<typename std::remove_const<T>::type>::value,
328 is_readable_container<T>::value,
331 auto cval = variable.begin();
332 auto end = variable.end();
336 std::vector<std::string> defaults;
345template <
typename T1,
350 return to_string(std::forward<T>(value));
354template <
typename T1,
359 return std::string{};
364 return std::to_string(value);
369 return std::to_string(
static_cast<typename std::underlying_type<T>::type
>(value));
379template <
typename T,
typename def,
typename Enable =
void>
struct wrapped_type {
384template <
typename T,
typename def>
struct wrapped_type<T, def, typename std::enable_if<is_wrapper<T>::value>::type> {
385 using type =
typename T::value_type;
396 typename std::enable_if<!is_tuple_like<T>::value && !is_mutable_container<T>::value &&
397 !std::is_void<T>::value>::type> {
403struct type_count_base<T, typename std::enable_if<is_tuple_like<T>::value && !is_mutable_container<T>::value>::type> {
404 static constexpr int value{std::tuple_size<T>::value};
408template <
typename T>
struct type_count_base<T, typename std::enable_if<is_mutable_container<T>::value>::type> {
421template <
typename T,
typename Enable =
void>
struct type_count {
428 typename std::enable_if<!is_wrapper<T>::value && !is_tuple_like<T>::value && !is_complex<T>::value &&
429 !std::is_void<T>::value>::type> {
434template <
typename T>
struct type_count<T, typename std::enable_if<is_complex<T>::value>::type> {
439template <
typename T>
struct type_count<T, typename std::enable_if<is_mutable_container<T>::value>::type> {
446 typename std::enable_if<is_wrapper<T>::value && !is_complex<T>::value && !is_tuple_like<T>::value &&
447 !is_mutable_container<T>::value>::type> {
452template <
typename T, std::
size_t I>
453constexpr typename std::enable_if<I == type_count_base<T>::value,
int>::type
tuple_type_size() {
458template <
typename T, std::
size_t I>
459 constexpr typename std::enable_if < I<type_count_base<T>::value,
int>::type
tuple_type_size() {
460 return subtype_count<typename std::tuple_element<I, T>::type>::value + tuple_type_size<T, I + 1>();
464template <
typename T>
struct type_count<T, typename std::enable_if<is_tuple_like<T>::value>::type> {
465 static constexpr int value{tuple_type_size<T, 0>()};
469template <
typename T>
struct subtype_count {
474template <
typename T,
typename Enable =
void>
struct type_count_min {
475 static const int value{0};
480struct type_count_min<
482 typename std::enable_if<!is_mutable_container<T>::value && !is_tuple_like<T>::value && !is_wrapper<T>::value &&
483 !is_complex<T>::value && !std::is_void<T>::value>::type> {
484 static constexpr int value{type_count<T>::value};
488template <
typename T>
struct type_count_min<T, typename std::enable_if<is_complex<T>::value>::type> {
489 static constexpr int value{1};
494struct type_count_min<
496 typename std::enable_if<is_wrapper<T>::value && !is_complex<T>::value && !is_tuple_like<T>::value>::type> {
497 static constexpr int value{subtype_count_min<typename T::value_type>::value};
501template <
typename T, std::
size_t I>
502constexpr typename std::enable_if<I == type_count_base<T>::value,
int>::type tuple_type_size_min() {
507template <
typename T, std::
size_t I>
508 constexpr typename std::enable_if < I<type_count_base<T>::value,
int>::type tuple_type_size_min() {
509 return subtype_count_min<typename std::tuple_element<I, T>::type>::value + tuple_type_size_min<T, I + 1>();
513template <
typename T>
struct type_count_min<T, typename std::enable_if<is_tuple_like<T>::value>::type> {
514 static constexpr int value{tuple_type_size_min<T, 0>()};
518template <
typename T>
struct subtype_count_min {
519 static constexpr int value{is_mutable_container<T>::value
521 : type_count_min<T>::value};
525template <
typename T,
typename Enable =
void>
struct expected_count {
526 static const int value{0};
531struct expected_count<T,
532 typename std::enable_if<!is_mutable_container<T>::value && !is_wrapper<T>::value &&
533 !std::is_void<T>::value>::type> {
534 static constexpr int value{1};
537template <
typename T>
struct expected_count<T, typename std::enable_if<is_mutable_container<T>::value>::type> {
543struct expected_count<T, typename std::enable_if<!is_mutable_container<T>::value && is_wrapper<T>::value>::type> {
544 static constexpr int value{expected_count<typename T::value_type>::value};
548enum class object_category :
int {
551 unsigned_integral = 4,
555 number_constructible = 12,
556 double_constructible = 14,
557 integer_constructible = 16,
559 string_assignable = 23,
560 string_constructible = 24,
561 wstring_assignable = 25,
562 wstring_constructible = 26,
568 container_value = 80,
575template <
typename T,
typename Enable =
void>
struct classify_object {
576 static constexpr object_category value{object_category::other};
581struct classify_object<
583 typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, char>::value && std::is_signed<T>::value &&
584 !is_bool<T>::value && !std::is_enum<T>::value>::type> {
585 static constexpr object_category value{object_category::integral_value};
590struct classify_object<T,
591 typename std::enable_if<std::is_integral<T>::value && std::is_unsigned<T>::value &&
592 !std::is_same<T, char>::value && !is_bool<T>::value>::type> {
593 static constexpr object_category value{object_category::unsigned_integral};
598struct classify_object<T, typename std::enable_if<std::is_same<T, char>::value && !std::is_enum<T>::value>::type> {
599 static constexpr object_category value{object_category::char_value};
603template <
typename T>
struct classify_object<T, typename std::enable_if<is_bool<T>::value>::type> {
604 static constexpr object_category value{object_category::boolean_value};
608template <
typename T>
struct classify_object<T, typename std::enable_if<std::is_floating_point<T>::value>::type> {
609 static constexpr object_category value{object_category::floating_point};
614#define WIDE_STRING_CHECK \
615 !std::is_assignable<T &, std::wstring>::value && !std::is_constructible<T, std::wstring>::value
616#define STRING_CHECK true
618#define WIDE_STRING_CHECK true
619#define STRING_CHECK !std::is_assignable<T &, std::string>::value && !std::is_constructible<T, std::string>::value
624struct classify_object<
626 typename std::enable_if<!std::is_floating_point<T>::value && !std::is_integral<T>::value && WIDE_STRING_CHECK &&
627 std::is_assignable<T &, std::string>::value>::type> {
628 static constexpr object_category value{object_category::string_assignable};
633struct classify_object<
635 typename std::enable_if<!std::is_floating_point<T>::value && !std::is_integral<T>::value &&
636 !std::is_assignable<T &, std::string>::value && (type_count<T>::value == 1) &&
637 WIDE_STRING_CHECK && std::is_constructible<T, std::string>::value>::type> {
638 static constexpr object_category value{object_category::string_constructible};
643struct classify_object<T,
644 typename std::enable_if<!std::is_floating_point<T>::value && !std::is_integral<T>::value &&
645 STRING_CHECK && std::is_assignable<T &, std::wstring>::value>::type> {
646 static constexpr object_category value{object_category::wstring_assignable};
650struct classify_object<
652 typename std::enable_if<!std::is_floating_point<T>::value && !std::is_integral<T>::value &&
653 !std::is_assignable<T &, std::wstring>::value && (type_count<T>::value == 1) &&
654 STRING_CHECK && std::is_constructible<T, std::wstring>::value>::type> {
655 static constexpr object_category value{object_category::wstring_constructible};
659template <
typename T>
struct classify_object<T, typename std::enable_if<std::is_enum<T>::value>::type> {
660 static constexpr object_category value{object_category::enumeration};
663template <
typename T>
struct classify_object<T, typename std::enable_if<is_complex<T>::value>::type> {
664 static constexpr object_category value{object_category::complex_number};
669template <
typename T>
struct uncommon_type {
670 using type =
typename std::conditional<
671 !std::is_floating_point<T>::value && !std::is_integral<T>::value &&
672 !std::is_assignable<T &, std::string>::value && !std::is_constructible<T, std::string>::value &&
673 !std::is_assignable<T &, std::wstring>::value && !std::is_constructible<T, std::wstring>::value &&
674 !is_complex<T>::value && !is_mutable_container<T>::value && !std::is_enum<T>::value,
676 std::false_type>::type;
677 static constexpr bool value = type::value;
682struct classify_object<T,
683 typename std::enable_if<(!is_mutable_container<T>::value && is_wrapper<T>::value &&
684 !is_tuple_like<T>::value && uncommon_type<T>::value)>::type> {
685 static constexpr object_category value{object_category::wrapper_value};
690struct classify_object<T,
691 typename std::enable_if<uncommon_type<T>::value && type_count<T>::value == 1 &&
692 !is_wrapper<T>::value && is_direct_constructible<T, double>::value &&
693 is_direct_constructible<T, int>::value>::type> {
694 static constexpr object_category value{object_category::number_constructible};
699struct classify_object<T,
700 typename std::enable_if<uncommon_type<T>::value && type_count<T>::value == 1 &&
701 !is_wrapper<T>::value && !is_direct_constructible<T, double>::value &&
702 is_direct_constructible<T, int>::value>::type> {
703 static constexpr object_category value{object_category::integer_constructible};
708struct classify_object<T,
709 typename std::enable_if<uncommon_type<T>::value && type_count<T>::value == 1 &&
710 !is_wrapper<T>::value && is_direct_constructible<T, double>::value &&
711 !is_direct_constructible<T, int>::value>::type> {
712 static constexpr object_category value{object_category::double_constructible};
717struct classify_object<
719 typename std::enable_if<is_tuple_like<T>::value &&
720 ((type_count<T>::value >= 2 && !is_wrapper<T>::value) ||
721 (uncommon_type<T>::value && !is_direct_constructible<T, double>::value &&
722 !is_direct_constructible<T, int>::value) ||
723 (uncommon_type<T>::value && type_count<T>::value >= 2))>::type> {
724 static constexpr object_category value{object_category::tuple_value};
733template <
typename T>
struct classify_object<T, typename std::enable_if<is_mutable_container<T>::value>::type> {
734 static constexpr object_category value{object_category::container_value};
750 enable_if_t<classify_object<T>::value == object_category::integral_value ||
751 classify_object<T>::value == object_category::integer_constructible,
764 enable_if_t<classify_object<T>::value == object_category::floating_point ||
765 classify_object<T>::value == object_category::number_constructible ||
766 classify_object<T>::value == object_category::double_constructible,
795 enable_if_t<classify_object<T>::value >= object_category::string_assignable &&
796 classify_object<T>::value <= object_category::other,
809 enable_if_t<classify_object<T>::value == object_category::container_value ||
810 classify_object<T>::value == object_category::wrapper_value,
819 return type_name<typename std::decay<typename std::tuple_element<0, T>::type>::type>();
823template <
typename T, std::
size_t I>
824inline typename std::enable_if<I == type_count_base<T>::value, std::string>::type tuple_name() {
825 return std::string{};
829template <
typename T, std::
size_t I>
830inline typename std::enable_if<(I < type_count_base<T>::value), std::string>::type tuple_name() {
831 auto str = std::string{type_name<typename std::decay<typename std::tuple_element<I, T>::type>::type>()} +
',' +
832 tuple_name<T, I + 1>();
833 if(str.back() ==
',')
843 auto tname = std::string(1,
'[') + tuple_name<T, 0>();
844 tname.push_back(
']');
851 classify_object<T>::value == object_category::wrapper_value,
854 return type_name<typename T::value_type>();
862 if(input.empty() || input.front() ==
'-') {
867 std::uint64_t output_ll = std::strtoull(input.c_str(), &val, 0);
868 if(errno == ERANGE) {
871 output =
static_cast<T
>(output_ll);
872 if(val == (input.c_str() + input.size()) &&
static_cast<std::uint64_t
>(output) == output_ll) {
876 std::int64_t output_sll = std::strtoll(input.c_str(), &val, 0);
877 if(val == (input.c_str() + input.size())) {
878 output = (output_sll < 0) ? static_cast<T>(0) :
static_cast<T
>(output_sll);
879 return (
static_cast<std::int64_t
>(output) == output_sll);
882 if(input.find_first_of(
"_'") != std::string::npos) {
883 std::string nstring = input;
884 nstring.erase(std::remove(nstring.begin(), nstring.end(),
'_'), nstring.end());
885 nstring.erase(std::remove(nstring.begin(), nstring.end(),
'\''), nstring.end());
888 if(input.compare(0, 2,
"0o") == 0) {
891 output_ll = std::strtoull(input.c_str() + 2, &val, 8);
892 if(errno == ERANGE) {
895 output =
static_cast<T
>(output_ll);
896 return (val == (input.c_str() + input.size()) &&
static_cast<std::uint64_t
>(output) == output_ll);
898 if(input.compare(0, 2,
"0b") == 0) {
901 output_ll = std::strtoull(input.c_str() + 2, &val, 2);
902 if(errno == ERANGE) {
905 output =
static_cast<T
>(output_ll);
906 return (val == (input.c_str() + input.size()) &&
static_cast<std::uint64_t
>(output) == output_ll);
919 std::int64_t output_ll = std::strtoll(input.c_str(), &val, 0);
920 if(errno == ERANGE) {
923 output =
static_cast<T
>(output_ll);
924 if(val == (input.c_str() + input.size()) &&
static_cast<std::int64_t
>(output) == output_ll) {
927 if(input ==
"true") {
929 output =
static_cast<T
>(1);
933 if(input.find_first_of(
"_'") != std::string::npos) {
934 std::string nstring = input;
935 nstring.erase(std::remove(nstring.begin(), nstring.end(),
'_'), nstring.end());
936 nstring.erase(std::remove(nstring.begin(), nstring.end(),
'\''), nstring.end());
939 if(input.compare(0, 2,
"0o") == 0) {
942 output_ll = std::strtoll(input.c_str() + 2, &val, 8);
943 if(errno == ERANGE) {
946 output =
static_cast<T
>(output_ll);
947 return (val == (input.c_str() + input.size()) &&
static_cast<std::int64_t
>(output) == output_ll);
949 if(input.compare(0, 2,
"0b") == 0) {
952 output_ll = std::strtoll(input.c_str() + 2, &val, 2);
953 if(errno == ERANGE) {
956 output =
static_cast<T
>(output_ll);
957 return (val == (input.c_str() + input.size()) &&
static_cast<std::int64_t
>(output) == output_ll);
964 static const std::string trueString(
"true");
965 static const std::string falseString(
"false");
966 if(val == trueString) {
969 if(val == falseString) {
973 std::int64_t ret = 0;
974 if(val.size() == 1) {
975 if(val[0] >=
'1' && val[0] <=
'9') {
976 return (
static_cast<std::int64_t
>(val[0]) -
'0');
996 if(val == trueString || val ==
"on" || val ==
"yes" || val ==
"enable") {
998 }
else if(val == falseString || val ==
"off" || val ==
"no" || val ==
"disable") {
1001 char *loc_ptr{
nullptr};
1002 ret = std::strtoll(val.c_str(), &loc_ptr, 0);
1003 if(loc_ptr != (val.c_str() + val.size()) && errno == 0) {
1011template <
typename T,
1013 classify_object<T>::value == object_category::unsigned_integral,
1020template <
typename T,
1022bool lexical_cast(
const std::string &input, T &output) {
1023 if(input.size() == 1) {
1024 output =
static_cast<T
>(input[0]);
1031template <
typename T,
1033bool lexical_cast(
const std::string &input, T &output) {
1038 }
else if(errno == ERANGE) {
1039 output = (input[0] !=
'-');
1047template <
typename T,
1049bool lexical_cast(
const std::string &input, T &output) {
1053 char *val =
nullptr;
1054 auto output_ld = std::strtold(input.c_str(), &val);
1055 output =
static_cast<T
>(output_ld);
1056 if(val == (input.c_str() + input.size())) {
1060 if(input.find_first_of(
"_'") != std::string::npos) {
1061 std::string nstring = input;
1062 nstring.erase(std::remove(nstring.begin(), nstring.end(),
'_'), nstring.end());
1063 nstring.erase(std::remove(nstring.begin(), nstring.end(),
'\''), nstring.end());
1070template <
typename T,
1072bool lexical_cast(
const std::string &input, T &output) {
1076 bool worked =
false;
1077 auto nloc = str1.find_last_of(
"+-");
1078 if(nloc != std::string::npos && nloc > 0) {
1080 str1 = str1.substr(nloc);
1081 if(str1.back() ==
'i' || str1.back() ==
'j')
1085 if(str1.back() ==
'i' || str1.back() ==
'j') {
1102template <
typename T,
1104bool lexical_cast(
const std::string &input, T &output) {
1113bool lexical_cast(
const std::string &input, T &output) {
1122bool lexical_cast(
const std::string &input, T &output) {
1123 output =
widen(input);
1130bool lexical_cast(
const std::string &input, T &output) {
1131 output = T{
widen(input)};
1136template <
typename T,
1138bool lexical_cast(
const std::string &input, T &output) {
1139 typename std::underlying_type<T>::type val;
1143 output =
static_cast<T
>(val);
1148template <
typename T,
1149 enable_if_t<classify_object<T>::value == object_category::wrapper_value &&
1150 std::is_assignable<T &, typename T::value_type>::value,
1152bool lexical_cast(
const std::string &input, T &output) {
1153 typename T::value_type val;
1161template <
typename T,
1162 enable_if_t<classify_object<T>::value == object_category::wrapper_value &&
1163 !std::is_assignable<T &, typename T::value_type>::value && std::is_assignable<T &, T>::value,
1165bool lexical_cast(
const std::string &input, T &output) {
1166 typename T::value_type val;
1178bool lexical_cast(
const std::string &input, T &output) {
1198bool lexical_cast(
const std::string &input, T &output) {
1211bool lexical_cast(
const std::string &input, T &output) {
1221template <
typename T,
1222 enable_if_t<classify_object<T>::value == object_category::other && std::is_assignable<T &, int>::value,
1224bool lexical_cast(
const std::string &input, T &output) {
1228#pragma warning(push)
1229#pragma warning(disable : 4800)
1247template <
typename T,
1248 enable_if_t<classify_object<T>::value == object_category::other && !std::is_assignable<T &, int>::value,
1250bool lexical_cast(
const std::string &input, T &output) {
1252 "option object type must have a lexical cast overload or streaming input operator(>>) defined, if it "
1253 "is convertible from another type use the add_option<T, XC>(...) with XC being the known type");
1259template <
typename AssignTo,
1261 enable_if_t<std::is_same<AssignTo, ConvertTo>::value &&
1262 (classify_object<AssignTo>::value == object_category::string_assignable ||
1263 classify_object<AssignTo>::value == object_category::string_constructible ||
1264 classify_object<AssignTo>::value == object_category::wstring_assignable ||
1265 classify_object<AssignTo>::value == object_category::wstring_constructible),
1272template <
typename AssignTo,
1275 classify_object<AssignTo>::value != object_category::string_assignable &&
1276 classify_object<AssignTo>::value != object_category::string_constructible &&
1277 classify_object<AssignTo>::value != object_category::wstring_assignable &&
1278 classify_object<AssignTo>::value != object_category::wstring_constructible,
1282 output = AssignTo{};
1290template <
typename AssignTo,
1292 enable_if_t<std::is_same<AssignTo, ConvertTo>::value && !std::is_assignable<AssignTo &, AssignTo>::value &&
1293 classify_object<AssignTo>::value == object_category::wrapper_value,
1297 typename AssignTo::value_type emptyVal{};
1306template <
typename AssignTo,
1308 enable_if_t<std::is_same<AssignTo, ConvertTo>::value && !std::is_assignable<AssignTo &, AssignTo>::value &&
1309 classify_object<AssignTo>::value != object_category::wrapper_value &&
1310 std::is_assignable<AssignTo &, int>::value,
1319#if defined(__clang__)
1321#pragma clang diagnostic push
1322#pragma clang diagnostic ignored "-Wsign-conversion"
1325#if defined(__clang__)
1326#pragma clang diagnostic pop
1334template <
typename AssignTo,
1336 enable_if_t<!std::is_same<AssignTo, ConvertTo>::value && std::is_assignable<AssignTo &, ConvertTo &>::value,
1340 bool parse_result = (!input.empty()) ?
lexical_cast(input, val) :
true;
1344 return parse_result;
1351 enable_if_t<!std::is_same<AssignTo, ConvertTo>::value && !std::is_assignable<AssignTo &, ConvertTo &>::value &&
1352 std::is_move_assignable<AssignTo>::value,
1356 bool parse_result = input.empty() ? true :
lexical_cast(input, val);
1358 output = AssignTo(val);
1360 return parse_result;
1364template <
typename AssignTo,
1366 enable_if_t<classify_object<ConvertTo>::value <= object_category::other &&
1367 classify_object<AssignTo>::value <= object_category::wrapper_value,
1369bool lexical_conversion(
const std::vector<std ::string> &strings, AssignTo &output) {
1370 return lexical_assign<AssignTo, ConvertTo>(strings[0], output);
1375template <
typename AssignTo,
1380bool lexical_conversion(
const std::vector<std ::string> &strings, AssignTo &output) {
1382 using FirstType =
typename std::remove_const<typename std::tuple_element<0, ConvertTo>::type>::type;
1383 using SecondType =
typename std::tuple_element<1, ConvertTo>::type;
1386 bool retval = lexical_assign<FirstType, FirstType>(strings[0], v1);
1387 retval = retval && lexical_assign<SecondType, SecondType>((strings.size() > 1) ? strings[1] : std::string{}, v2);
1389 output = AssignTo{v1, v2};
1395template <
class AssignTo,
1397 enable_if_t<is_mutable_container<AssignTo>::value && is_mutable_container<ConvertTo>::value &&
1400bool lexical_conversion(
const std::vector<std ::string> &strings, AssignTo &output) {
1401 output.erase(output.begin(), output.end());
1402 if(strings.empty()) {
1405 if(strings.size() == 1 && strings[0] ==
"{}") {
1408 bool skip_remaining =
false;
1409 if(strings.size() == 2 && strings[0] ==
"{}" &&
is_separator(strings[1])) {
1410 skip_remaining =
true;
1412 for(
const auto &elem : strings) {
1413 typename AssignTo::value_type out;
1414 bool retval = lexical_assign<typename AssignTo::value_type, typename ConvertTo::value_type>(elem, out);
1418 output.insert(output.end(), std::move(out));
1419 if(skip_remaining) {
1423 return (!output.empty());
1428bool lexical_conversion(
const std::vector<std::string> &strings, AssignTo &output) {
1430 if(strings.size() >= 2 && !strings[1].empty()) {
1433 auto str1 = strings[1];
1434 if(str1.back() ==
'i' || str1.back() ==
'j') {
1439 output = ConvertTo{x, y};
1443 return lexical_assign<AssignTo, ConvertTo>(strings[0], output);
1447template <
class AssignTo,
1449 enable_if_t<is_mutable_container<AssignTo>::value && (expected_count<ConvertTo>::value == 1) &&
1452bool lexical_conversion(
const std::vector<std ::string> &strings, AssignTo &output) {
1455 output.reserve(strings.size());
1456 for(
const auto &elem : strings) {
1458 output.emplace_back();
1459 retval = retval && lexical_assign<typename AssignTo::value_type, ConvertTo>(elem, output.back());
1461 return (!output.empty()) && retval;
1467template <
class AssignTo,
1469 enable_if_t<is_mutable_container<AssignTo>::value && is_mutable_container<ConvertTo>::value &&
1472bool lexical_conversion(std::vector<std::string> strings, AssignTo &output);
1475template <
class AssignTo,
1477 enable_if_t<is_mutable_container<AssignTo>::value && is_mutable_container<ConvertTo>::value &&
1482bool lexical_conversion(
const std::vector<std::string> &strings, AssignTo &output);
1485template <
class AssignTo,
1491bool lexical_conversion(
const std::vector<std::string> &strings, AssignTo &output);
1495template <
typename AssignTo,
1497 enable_if_t<!is_tuple_like<AssignTo>::value && !is_mutable_container<AssignTo>::value &&
1498 classify_object<ConvertTo>::value != object_category::wrapper_value &&
1501bool lexical_conversion(
const std::vector<std ::string> &strings, AssignTo &output) {
1503 if(strings.size() > 1 || (!strings.empty() && !(strings.front().empty()))) {
1505 auto retval = lexical_conversion<ConvertTo, ConvertTo>(strings, val);
1506 output = AssignTo{val};
1509 output = AssignTo{};
1514template <
class AssignTo,
class ConvertTo, std::
size_t I>
1516tuple_conversion(
const std::vector<std::string> &, AssignTo &) {
1521template <
class AssignTo,
class ConvertTo>
1523tuple_type_conversion(std::vector<std::string> &strings, AssignTo &output) {
1524 auto retval = lexical_assign<AssignTo, ConvertTo>(strings[0], output);
1525 strings.erase(strings.begin());
1530template <
class AssignTo,
class ConvertTo>
1534tuple_type_conversion(std::vector<std::string> &strings, AssignTo &output) {
1535 auto retval = lexical_conversion<AssignTo, ConvertTo>(strings, output);
1541template <
class AssignTo,
class ConvertTo>
1542inline typename std::enable_if<is_mutable_container<ConvertTo>::value ||
1545tuple_type_conversion(std::vector<std::string> &strings, AssignTo &output) {
1547 std::size_t index{subtype_count_min<ConvertTo>::value};
1548 const std::size_t mx_count{subtype_count<ConvertTo>::value};
1549 const std::size_t mx{(std::min)(mx_count, strings.size() - 1)};
1557 bool retval = lexical_conversion<AssignTo, ConvertTo>(
1558 std::vector<std::string>(strings.begin(), strings.begin() +
static_cast<std::ptrdiff_t
>(index)), output);
1559 if(strings.size() > index) {
1560 strings.erase(strings.begin(), strings.begin() +
static_cast<std::ptrdiff_t
>(index) + 1);
1568template <
class AssignTo,
class ConvertTo, std::
size_t I>
1569inline typename std::enable_if<(I < type_count_base<AssignTo>::value),
bool>::type
1570tuple_conversion(std::vector<std::string> strings, AssignTo &output) {
1572 using ConvertToElement =
typename std::
1573 conditional<is_tuple_like<ConvertTo>::value,
typename std::tuple_element<I, ConvertTo>::type, ConvertTo>::type;
1574 if(!strings.empty()) {
1575 retval = retval && tuple_type_conversion<typename std::tuple_element<I, AssignTo>::type, ConvertToElement>(
1576 strings, std::get<I>(output));
1578 retval = retval && tuple_conversion<AssignTo, ConvertTo, I + 1>(std::move(strings), output);
1583template <
class AssignTo,
1585 enable_if_t<is_mutable_container<AssignTo>::value && is_mutable_container<ConvertTo>::value &&
1588bool lexical_conversion(std::vector<std::string> strings, AssignTo &output) {
1590 while(!strings.empty()) {
1592 typename std::remove_const<typename std::tuple_element<0, typename ConvertTo::value_type>::type>::type v1;
1593 typename std::tuple_element<1, typename ConvertTo::value_type>::type v2;
1594 bool retval = tuple_type_conversion<decltype(v1), decltype(v1)>(strings, v1);
1595 if(!strings.empty()) {
1596 retval = retval && tuple_type_conversion<decltype(v2), decltype(v2)>(strings, v2);
1599 output.insert(output.end(),
typename AssignTo::value_type{v1, v2});
1604 return (!output.empty());
1608template <
class AssignTo,
1614bool lexical_conversion(
const std::vector<std ::string> &strings, AssignTo &output) {
1617 "if the conversion type is defined as a tuple it must be the same size as the type you are converting to");
1618 return tuple_conversion<AssignTo, ConvertTo, 0>(strings, output);
1622template <
class AssignTo,
1624 enable_if_t<is_mutable_container<AssignTo>::value && is_mutable_container<ConvertTo>::value &&
1629bool lexical_conversion(
const std::vector<std ::string> &strings, AssignTo &output) {
1632 std::vector<std::string> temp;
1634 std::size_t icount{0};
1636 auto ii_max = strings.size();
1637 while(ii < ii_max) {
1638 temp.push_back(strings[ii]);
1641 if(icount == xcm ||
is_separator(temp.back()) || ii == ii_max) {
1642 if(
static_cast<int>(xcm) > type_count_min<ConvertTo>::value &&
is_separator(temp.back())) {
1645 typename AssignTo::value_type temp_out;
1647 lexical_conversion<typename AssignTo::value_type, typename ConvertTo::value_type>(temp, temp_out);
1652 output.insert(output.end(), std::move(temp_out));
1660template <
typename AssignTo,
1662 enable_if_t<classify_object<ConvertTo>::value == object_category::wrapper_value &&
1663 std::is_assignable<ConvertTo &, ConvertTo>::value,
1665bool lexical_conversion(
const std::vector<std::string> &strings, AssignTo &output) {
1666 if(strings.empty() || strings.front().empty()) {
1667 output = ConvertTo{};
1670 typename ConvertTo::value_type val;
1671 if(lexical_conversion<typename ConvertTo::value_type, typename ConvertTo::value_type>(strings, val)) {
1672 output = ConvertTo{val};
1679template <
typename AssignTo,
1681 enable_if_t<classify_object<ConvertTo>::value == object_category::wrapper_value &&
1682 !std::is_assignable<AssignTo &, ConvertTo>::value,
1684bool lexical_conversion(
const std::vector<std::string> &strings, AssignTo &output) {
1685 using ConvertType =
typename ConvertTo::value_type;
1686 if(strings.empty() || strings.front().empty()) {
1687 output = ConvertType{};
1691 if(lexical_conversion<typename ConvertTo::value_type, typename ConvertTo::value_type>(strings, val)) {
1699inline std::string sum_string_vector(
const std::vector<std::string> &values) {
1703 for(
const auto &arg : values) {
1709 fail = (errno != 0);
1713 tv =
static_cast<double>(fv);
1718 for(
const auto &arg : values) {
1722 std::ostringstream out;
Check for complex.
Definition TypeTools.hpp:216
static constexpr bool value
Definition TypeTools.hpp:223
Definition TypeTools.hpp:158
static constexpr bool value
Definition TypeTools.hpp:185
Check for input streamability.
Definition TypeTools.hpp:205
static constexpr bool value
Definition TypeTools.hpp:212
Definition TypeTools.hpp:194
static constexpr bool value
Definition TypeTools.hpp:201
Definition TypeTools.hpp:280
static constexpr bool value
Definition TypeTools.hpp:288
constexpr enabler dummy
An instance to use in EnableIf.
Definition TypeTools.hpp:37
auto to_string(T &&value) -> decltype(std::forward< T >(value))
Convert an object to a string (directly forward if this can become a string)
Definition TypeTools.hpp:293
auto checked_to_string(T &&value) -> decltype(to_string(std::forward< T >(value)))
special template overload
Definition TypeTools.hpp:349
bool is_separator(const std::string &str)
check if a string is a container segment separator (empty or "%%")
Definition StringTools.hpp:168
bool from_stream(const std::string &istring, T &obj)
Templated operation to get a value from a stream.
Definition TypeTools.hpp:228
constexpr int expected_max_vector_size
Definition StringTools.hpp:45
std::string value_string(const T &value)
get a string as a convertible value for arithmetic types
Definition TypeTools.hpp:363
std::string join(const T &v, std::string delim=",")
Simple function to join a string.
Definition StringTools.hpp:51
bool lexical_assign(const std::string &input, AssignTo &output)
Assign a value through lexical cast operations.
Definition TypeTools.hpp:1267
std::int64_t to_flag_value(std::string val) noexcept
Convert a flag into an integer value typically binary flags sets errno to nonzero if conversion faile...
Definition TypeTools.hpp:963
constexpr std::enable_if< I< type_count_base< T >::value, int >::type tuple_type_size() { return subtype_count< typename std::tuple_element< I, T >::type >::value+tuple_type_size< T, I+1 >();}template< typename T > struct type_count< T, typename std::enable_if< is_tuple_like< T >::value >::type > { static constexpr int value{tuple_type_size< T, 0 >()};};template< typename T > struct subtype_count { static constexpr int value{is_mutable_container< T >::value ? expected_max_vector_size :type_count< T >::value};};template< typename T, typename Enable=void > struct type_count_min { static const int value{0};};template< typename T >struct type_count_min< T, typename std::enable_if<!is_mutable_container< T >::value &&!is_tuple_like< T >::value &&!is_wrapper< T >::value &&!is_complex< T >::value &&!std::is_void< T >::value >::type > { static constexpr int value{type_count< T >::value};};template< typename T > struct type_count_min< T, typename std::enable_if< is_complex< T >::value >::type > { static constexpr int value{1};};template< typename T >struct type_count_min< T, typename std::enable_if< is_wrapper< T >::value &&!is_complex< T >::value &&!is_tuple_like< T >::value >::type > { static constexpr int value{subtype_count_min< typename T::value_type >::value};};template< typename T, std::size_t I >constexpr typename std::enable_if< I==type_count_base< T >::value, int >::type tuple_type_size_min() { return 0;}template< typename T, std::size_t I > constexpr typename std::enable_if< I< type_count_base< T >::value, int >::type tuple_type_size_min() { return subtype_count_min< typename std::tuple_element< I, T >::type >::value+tuple_type_size_min< T, I+1 >();}template< typename T > struct type_count_min< T, typename std::enable_if< is_tuple_like< T >::value >::type > { static constexpr int value{tuple_type_size_min< T, 0 >()};};template< typename T > struct subtype_count_min { static constexpr int value{is_mutable_container< T >::value ?((type_count< T >::value< expected_max_vector_size) ? type_count< T >::value :0) :type_count_min< T >::value};};template< typename T, typename Enable=void > struct expected_count { static const int value{0};};template< typename T >struct expected_count< T, typename std::enable_if<!is_mutable_container< T >::value &&!is_wrapper< T >::value &&!std::is_void< T >::value >::type > { static constexpr int value{1};};template< typename T > struct expected_count< T, typename std::enable_if< is_mutable_container< T >::value >::type > { static constexpr int value{expected_max_vector_size};};template< typename T >struct expected_count< T, typename std::enable_if<!is_mutable_container< T >::value &&is_wrapper< T >::value >::type > { static constexpr int value{expected_count< typename T::value_type >::value};};enum class object_category :int { char_value=1, integral_value=2, unsigned_integral=4, enumeration=6, boolean_value=8, floating_point=10, number_constructible=12, double_constructible=14, integer_constructible=16, string_assignable=23, string_constructible=24, wstring_assignable=25, wstring_constructible=26, other=45, wrapper_value=50, complex_number=60, tuple_value=70, container_value=80,};template< typename T, typename Enable=void > struct classify_object { static constexpr object_category value{object_category::other};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_integral< T >::value &&!std::is_same< T, char >::value &&std::is_signed< T >::value &&!is_bool< T >::value &&!std::is_enum< T >::value >::type > { static constexpr object_category value{object_category::integral_value};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_integral< T >::value &&std::is_unsigned< T >::value &&!std::is_same< T, char >::value &&!is_bool< T >::value >::type > { static constexpr object_category value{object_category::unsigned_integral};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_same< T, char >::value &&!std::is_enum< T >::value >::type > { static constexpr object_category value{object_category::char_value};};template< typename T > struct classify_object< T, typename std::enable_if< is_bool< T >::value >::type > { static constexpr object_category value{object_category::boolean_value};};template< typename T > struct classify_object< T, typename std::enable_if< std::is_floating_point< T >::value >::type > { static constexpr object_category value{object_category::floating_point};};#define WIDE_STRING_CHECK #define STRING_CHECK template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&WIDE_STRING_CHECK &&std::is_assignable< T &, std::string >::value >::type > { static constexpr object_category value{object_category::string_assignable};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&(type_count< T >::value==1) &&WIDE_STRING_CHECK &&std::is_constructible< T, std::string >::value >::type > { static constexpr object_category value{object_category::string_constructible};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&STRING_CHECK &&std::is_assignable< T &, std::wstring >::value >::type > { static constexpr object_category value{object_category::wstring_assignable};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::wstring >::value &&(type_count< T >::value==1) &&STRING_CHECK &&std::is_constructible< T, std::wstring >::value >::type > { static constexpr object_category value{object_category::wstring_constructible};};template< typename T > struct classify_object< T, typename std::enable_if< std::is_enum< T >::value >::type > { static constexpr object_category value{object_category::enumeration};};template< typename T > struct classify_object< T, typename std::enable_if< is_complex< T >::value >::type > { static constexpr object_category value{object_category::complex_number};};template< typename T > struct uncommon_type { using type=typename std::conditional< !std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&!std::is_constructible< T, std::string >::value &&!std::is_assignable< T &, std::wstring >::value &&!std::is_constructible< T, std::wstring >::value &&!is_complex< T >::value &&!is_mutable_container< T >::value &&!std::is_enum< T >::value, std::true_type, std::false_type >::type;static constexpr bool value=type::value;};template< typename T >struct classify_object< T, typename std::enable_if<(!is_mutable_container< T >::value &&is_wrapper< T >::value &&!is_tuple_like< T >::value &&uncommon_type< T >::value)>::type > { static constexpr object_category value{object_category::wrapper_value};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type > { static constexpr object_category value{object_category::number_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&!is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type > { static constexpr object_category value{object_category::integer_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value >::type > { static constexpr object_category value{object_category::double_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< is_tuple_like< T >::value &&((type_count< T >::value >=2 &&!is_wrapper< T >::value)||(uncommon_type< T >::value &&!is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value)||(uncommon_type< T >::value &&type_count< T >::value >=2))>::type > { static constexpr object_category value{object_category::tuple_value};};template< typename T > struct classify_object< T, typename std::enable_if< is_mutable_container< T >::value >::type > { static constexpr object_category value{object_category::container_value};};template< typename T, enable_if_t< classify_object< T >::value==object_category::char_value, detail::enabler >=detail::dummy >constexpr const char *type_name() { return "CHAR";}template< typename T, enable_if_t< classify_object< T >::value==object_category::integral_value||classify_object< T >::value==object_category::integer_constructible, detail::enabler >=detail::dummy >constexpr const char *type_name() { return "INT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::unsigned_integral, detail::enabler >=detail::dummy >constexpr const char *type_name() { return "UINT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::floating_point||classify_object< T >::value==object_category::number_constructible||classify_object< T >::value==object_category::double_constructible, detail::enabler >=detail::dummy >constexpr const char *type_name() { return "FLOAT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::enumeration, detail::enabler >=detail::dummy >constexpr const char *type_name() { return "ENUM";}template< typename T, enable_if_t< classify_object< T >::value==object_category::boolean_value, detail::enabler >=detail::dummy >constexpr const char *type_name() { return "BOOLEAN";}template< typename T, enable_if_t< classify_object< T >::value==object_category::complex_number, detail::enabler >=detail::dummy >constexpr const char *type_name() { return "COMPLEX";}template< typename T, enable_if_t< classify_object< T >::value >=object_category::string_assignable &&classify_object< T >::value<=object_category::other, detail::enabler >=detail::dummy >constexpr const char *type_name() { return "TEXT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value >=2, detail::enabler >=detail::dummy >std::string type_name();template< typename T, enable_if_t< classify_object< T >::value==object_category::container_value||classify_object< T >::value==object_category::wrapper_value, detail::enabler >=detail::dummy >std::string type_name();template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value==1, detail::enabler >=detail::dummy >inline std::string type_name() { return type_name< typename std::decay< typename std::tuple_element< 0, T >::type >::type >();}template< typename T, std::size_t I >inline typename std::enable_if< I==type_count_base< T >::value, std::string >::type tuple_name() { return std::string{};}template< typename T, std::size_t I >inline typename std::enable_if<(I< type_count_base< T >::value), std::string >::type tuple_name() { auto str=std::string{type_name< typename std::decay< typename std::tuple_element< I, T >::type >::type >()}+','+tuple_name< T, I+1 >();if(str.back()==',') str.pop_back();return str;}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value >=2, detail::enabler > > std::string type_name()
Recursively generate the tuple type name.
Definition TypeTools.hpp:842
std::string to_lower(std::string str)
Return a lower case version of a string.
Definition StringTools.hpp:179
enabler
Simple empty scoped class.
Definition TypeTools.hpp:34
bool lexical_cast(const std::string &input, T &output)
Integer conversion.
Definition TypeTools.hpp:1015
bool integral_conversion(const std::string &input, T &output) noexcept
Convert to an unsigned integral.
Definition TypeTools.hpp:861
constexpr std::enable_if< I==type_count_base< T >::value, int >::type tuple_type_size()
0 if the index > tuple size
Definition TypeTools.hpp:453
typename std::enable_if< B, T >::type enable_if_t
Definition TypeTools.hpp:45
typename std::conditional< B, T, F >::type conditional_t
A copy of std::conditional_t from C++14 - same reasoning as enable_if_t, it does not hurt to redefine...
Definition TypeTools.hpp:56
typename make_void< Ts... >::type void_t
A copy of std::void_t from C++17 - same reasoning as enable_if_t, it does not hurt to redefine.
Definition TypeTools.hpp:53
CLI11_INLINE std::wstring widen(const std::string &str)
Convert a narrow string to a wide string.
std::string type
Definition TypeTools.hpp:85
This can be specialized to override the type deduction for IsMember.
Definition TypeTools.hpp:79
T type
Definition TypeTools.hpp:80
typename std::pointer_traits< T >::element_type type
Definition TypeTools.hpp:101
not a pointer
Definition TypeTools.hpp:96
T type
Definition TypeTools.hpp:97
Definition TypeTools.hpp:106
typename element_type< T >::type::value_type type
Definition TypeTools.hpp:107
Definition TypeTools.hpp:241
Definition TypeTools.hpp:261
Definition TypeTools.hpp:273
typename std::remove_const< typename value_type::first_type >::type first_type
Definition TypeTools.hpp:134
static auto first(Q &&pair_value) -> decltype(std::get< 0 >(std::forward< Q >(pair_value)))
Get the first value (really just the underlying value)
Definition TypeTools.hpp:138
static auto second(Q &&pair_value) -> decltype(std::get< 1 >(std::forward< Q >(pair_value)))
Get the second value (really just the underlying value)
Definition TypeTools.hpp:142
typename T::value_type value_type
Definition TypeTools.hpp:133
typename std::remove_const< typename value_type::second_type >::type second_type
Definition TypeTools.hpp:135
Adaptor for set-like structure: This just wraps a normal container in a few utilities that do almost ...
Definition TypeTools.hpp:111
typename T::value_type value_type
Definition TypeTools.hpp:112
typename std::remove_const< value_type >::type second_type
Definition TypeTools.hpp:114
static auto second(Q &&pair_value) -> decltype(std::forward< Q >(pair_value))
Get the second value (really just the underlying value)
Definition TypeTools.hpp:121
typename std::remove_const< value_type >::type first_type
Definition TypeTools.hpp:113
static auto first(Q &&pair_value) -> decltype(std::forward< Q >(pair_value))
Get the first value (really just the underlying value)
Definition TypeTools.hpp:117
forward declare the subtype_count_min structure
Definition TypeTools.hpp:418
Set of overloads to get the type size of an object.
Definition TypeTools.hpp:415
This will only trigger for actual void type.
Definition TypeTools.hpp:389
static const int value
Definition TypeTools.hpp:390
This will only trigger for actual void type.
Definition TypeTools.hpp:421
static const int value
Definition TypeTools.hpp:422
typename T::value_type type
Definition TypeTools.hpp:385
template to get the underlying value type if it exists or use a default
Definition TypeTools.hpp:379
def type
Definition TypeTools.hpp:380
Check to see if something is bool (fail check by default)
Definition TypeTools.hpp:59
Check to see if something is copyable pointer.
Definition TypeTools.hpp:74
static bool const value
Definition TypeTools.hpp:75
Check to see if something is a shared pointer.
Definition TypeTools.hpp:65
A copy of std::void_t from C++17 (helper for C++11 and C++14)
Definition TypeTools.hpp:48
void type
Definition TypeTools.hpp:49