mirror of
https://github.com/boostorg/gil.git
synced 2026-02-01 08:32:10 +00:00
Add explicit conversion of arithmetic result to expected result type
Fixes warnings due to implicit promotion of operands, then implicit conversion.
This commit is contained in:
@@ -27,10 +27,17 @@ void error_if(bool condition);
|
||||
struct increment {
|
||||
template <typename Incrementable> void operator()(Incrementable& x) const { ++x; }
|
||||
};
|
||||
struct prev {
|
||||
|
||||
struct prev
|
||||
{
|
||||
template <typename Subtractable>
|
||||
typename channel_traits<Subtractable>::value_type operator()(const Subtractable& x) const { return x-1; }
|
||||
auto operator()(const Subtractable& x) const -> typename channel_traits<Subtractable>::value_type
|
||||
{
|
||||
using return_type = typename channel_traits<Subtractable>::value_type;
|
||||
return static_cast<return_type>(x - 1);
|
||||
}
|
||||
};
|
||||
|
||||
struct set_to_one{ int operator()() const { return 1; } };
|
||||
|
||||
// Construct with two pixel types. They must be compatible and the second must be mutable
|
||||
|
||||
Reference in New Issue
Block a user