Skip to content

Commit a427b1e

Browse files
committed
reorder the lexical_conversion definitions
1 parent 94a2fe5 commit a427b1e

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

include/CLI/TypeTools.hpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -749,23 +749,6 @@ bool lexical_conversion(const std::vector<std ::string> &strings, T &output) {
749749
return lexical_assign<T, XC>(strings[0], output);
750750
}
751751

752-
/// Lexical conversion if there is only one element but the conversion type is a vector
753-
template <typename T,
754-
typename XC,
755-
enable_if_t<!is_tuple_like<T>::value && !is_vector<T>::value && is_vector<XC>::value, detail::enabler> =
756-
detail::dummy>
757-
bool lexical_conversion(const std::vector<std ::string> &strings, T &output) {
758-
759-
if(strings.size() > 1 || (!strings.empty() && !(strings.front().empty()))) {
760-
XC val;
761-
auto retval = lexical_conversion<XC, XC>(strings, val);
762-
output = T{val};
763-
return retval;
764-
}
765-
output = T{};
766-
return true;
767-
}
768-
769752
/// Lexical conversion if there is only one element but the conversion type is for two call a two element constructor
770753
template <typename T,
771754
typename XC,
@@ -844,6 +827,23 @@ bool lexical_conversion(const std::vector<std ::string> &strings, T &output) {
844827
}
845828
return (!output.empty()) && retval;
846829
}
830+
// This one is last since it can call other lexical_conversion functions
831+
/// Lexical conversion if there is only one element but the conversion type is a vector
832+
template <typename T,
833+
typename XC,
834+
enable_if_t<!is_tuple_like<T>::value && !is_vector<T>::value && is_vector<XC>::value, detail::enabler> =
835+
detail::dummy>
836+
bool lexical_conversion(const std::vector<std ::string> &strings, T &output) {
837+
838+
if(strings.size() > 1 || (!strings.empty() && !(strings.front().empty()))) {
839+
XC val;
840+
auto retval = lexical_conversion<XC, XC>(strings, val);
841+
output = T{val};
842+
return retval;
843+
}
844+
output = T{};
845+
return true;
846+
}
847847

848848
/// function template for converting tuples if the static Index is greater than the tuple size
849849
template <class T, class XC, std::size_t I>

0 commit comments

Comments
 (0)