diff --git a/include/CLI/Validators.hpp b/include/CLI/Validators.hpp index e3736845..b4586ed1 100644 --- a/include/CLI/Validators.hpp +++ b/include/CLI/Validators.hpp @@ -501,14 +501,14 @@ template std::string generate_map(const T &map, bool key_only = fal return out; } -template struct sfinae_true : std::true_type {}; -/// Function to check for the existence of a member find function which presumably is more efficient than looping over -/// everything -template -static auto test_find(int) -> sfinae_true().find(std::declval()))>; -template static auto test_find(long) -> std::false_type; +template struct has_find { + template + static auto test(int) -> decltype(std::declval().find(std::declval()), std::true_type()); + template static auto test(...) -> decltype(std::false_type()); -template struct has_find : decltype(test_find(0)) {}; + static const auto value = decltype(test(0))::value; + using type = std::integral_constant; +}; /// A search function template ::value, detail::enabler> = detail::dummy>