Prevent MSVC from issuing warnings about possible value truncations.

This commit is contained in:
kosak 2015-07-28 00:15:20 +00:00
parent f253efc20e
commit 0b10cfd582

View File

@ -230,7 +230,7 @@ class RangeGenerator : public ParamGeneratorInterface<T> {
return base_; return base_;
} }
virtual void Advance() { virtual void Advance() {
value_ = value_ + step_; value_ = static_cast<T>(value_ + step_);
index_++; index_++;
} }
virtual ParamIteratorInterface<T>* Clone() const { virtual ParamIteratorInterface<T>* Clone() const {
@ -267,7 +267,7 @@ class RangeGenerator : public ParamGeneratorInterface<T> {
const T& end, const T& end,
const IncrementT& step) { const IncrementT& step) {
int end_index = 0; int end_index = 0;
for (T i = begin; i < end; i = i + step) for (T i = begin; i < end; i = static_cast<T>(i + step))
end_index++; end_index++;
return end_index; return end_index;
} }