mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-30 04:33:53 +00:00
Explicit casts
This commit is contained in:
parent
786f99d09c
commit
f24561f460
@ -1,6 +1,6 @@
|
|||||||
#Checks: '*,-clang-analyzer-alpha.*'
|
#Checks: '*,-clang-analyzer-alpha.*'
|
||||||
#Checks: '-*,google-readability-casting,llvm-namespace-comment,performance-unnecessary-value-param,llvm-include-order,misc-throw-by-value-catch-by-reference,readability-container-size-empty,google-runtime-references,modernize*'
|
#Checks: '-*,google-readability-casting,llvm-namespace-comment,performance-unnecessary-value-param,llvm-include-order,misc-throw-by-value-catch-by-reference,readability-container-size-empty,google-runtime-references,modernize*'
|
||||||
Checks: '-*,llvm-namespace-comment,llvm-include-order,readability-container-size-empty,misc-throw-by-value-catch-by-reference,modernize*'
|
Checks: '-*,llvm-namespace-comment,llvm-include-order,readability-container-size-empty,misc-throw-by-value-catch-by-reference,modernize*,google-readability-casting'
|
||||||
HeaderFilterRegex: '.*hpp'
|
HeaderFilterRegex: '.*hpp'
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: readability-braces-around-statements.ShortStatementLines
|
- key: readability-braces-around-statements.ShortStatementLines
|
||||||
|
@ -307,7 +307,7 @@ public:
|
|||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
CLI::callback_t fun = [&count](CLI::results_t res){
|
CLI::callback_t fun = [&count](CLI::results_t res){
|
||||||
count = (T) res.size();
|
count = static_cast<T>(res.size());
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ namespace detail {
|
|||||||
template<typename T, enable_if_t<std::is_integral<T>::value, detail::enabler> = detail::dummy>
|
template<typename T, enable_if_t<std::is_integral<T>::value, detail::enabler> = detail::dummy>
|
||||||
bool lexical_cast(std::string input, T& output) {
|
bool lexical_cast(std::string input, T& output) {
|
||||||
try{
|
try{
|
||||||
output = (T) std::stoll(input);
|
output = static_cast<T>(std::stoll(input));
|
||||||
return true;
|
return true;
|
||||||
} catch (const std::invalid_argument&) {
|
} catch (const std::invalid_argument&) {
|
||||||
return false;
|
return false;
|
||||||
@ -115,7 +115,7 @@ namespace detail {
|
|||||||
template<typename T, enable_if_t<std::is_floating_point<T>::value, detail::enabler> = detail::dummy>
|
template<typename T, enable_if_t<std::is_floating_point<T>::value, detail::enabler> = detail::dummy>
|
||||||
bool lexical_cast(std::string input, T& output) {
|
bool lexical_cast(std::string input, T& output) {
|
||||||
try{
|
try{
|
||||||
output = (T) std::stold(input);
|
output =static_cast<T>(std::stold(input));
|
||||||
return true;
|
return true;
|
||||||
} catch (const std::invalid_argument&) {
|
} catch (const std::invalid_argument&) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -81,7 +81,7 @@ std::function<bool(std::string)> Range(T min, T max) {
|
|||||||
/// Range of one value is 0 to value
|
/// Range of one value is 0 to value
|
||||||
template<typename T>
|
template<typename T>
|
||||||
std::function<bool(std::string)> Range(T max) {
|
std::function<bool(std::string)> Range(T max) {
|
||||||
return Range((T) 0, max);
|
return Range(static_cast<T>(0), max);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user