Bug fix C4 class Foobar (#1143)
* Fixed bug in example code of C4 Expecptions. In C4, the class function void Foobar::foo(double x) is supposed to call the overloaded void Foobar::foo(int x), but in the call foo(std::round(x)), std::round returns a double. Hence, it will get stuck in an infinite recursive loop. Added static_cast<int>(..) to enforce the call to right overload. Added also keyword public to be more consistent. * Changed static_cast<int> to narrow_cast<int> following ES.46. * Modified C4 Foobar class, s.t, std::lround(x) is now called in void foo(double) and the overload is changed to void foo(long) from (int). Now there is no need for conversions.pull/1149/head
parent
da3b6b98bc
commit
6c55d4eaaf
Loading…
Reference in New Issue