Ticket #8262: average_fix.patch
File average_fix.patch, 1.1 KB (added by , 10 years ago) |
---|
-
functional.hpp
246 246 247 247 template<typename Left, typename Right, typename EnableIf> 248 248 struct average_base 249 : functional::divides<Left, Right> 250 {}; 249 { 250 // Define the type of the result 251 typedef typename functional::divides<Left, Right>::result_type result_type; 251 252 253 result_type operator()(Left & left, Right & right) const 254 { 255 return numeric::divides(numeric::plus(left, right), 2); 256 } 257 }; 258 252 259 // partial specialization that promotes the arguments to double for 253 260 // integral division. 254 261 template<typename Left, typename Right> 255 262 struct average_base<Left, Right, typename enable_if<are_integral<Left, Right> >::type> 256 : functional::divides<double const, double const>263 : average_base<double const, double const> 257 264 {}; 258 265 259 266 template<typename To, typename From, typename EnableIf>