1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-29 12:13:52 +00:00

Explicit casts

This commit is contained in:
Henry Fredrick Schreiner 2017-05-31 11:28:46 -04:00
parent 786f99d09c
commit f24561f460
4 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
#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: '-*,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'
CheckOptions:
- key: readability-braces-around-statements.ShortStatementLines

View File

@ -307,7 +307,7 @@ public:
count = 0;
CLI::callback_t fun = [&count](CLI::results_t res){
count = (T) res.size();
count = static_cast<T>(res.size());
return true;
};

View File

@ -102,7 +102,7 @@ namespace detail {
template<typename T, enable_if_t<std::is_integral<T>::value, detail::enabler> = detail::dummy>
bool lexical_cast(std::string input, T& output) {
try{
output = (T) std::stoll(input);
output = static_cast<T>(std::stoll(input));
return true;
} catch (const std::invalid_argument&) {
return false;
@ -115,7 +115,7 @@ namespace detail {
template<typename T, enable_if_t<std::is_floating_point<T>::value, detail::enabler> = detail::dummy>
bool lexical_cast(std::string input, T& output) {
try{
output = (T) std::stold(input);
output =static_cast<T>(std::stold(input));
return true;
} catch (const std::invalid_argument&) {
return false;

View File

@ -81,7 +81,7 @@ std::function<bool(std::string)> Range(T min, T max) {
/// Range of one value is 0 to value
template<typename T>
std::function<bool(std::string)> Range(T max) {
return Range((T) 0, max);
return Range(static_cast<T>(0), max);
}
/// @}