Typo in Example 6.7.1

Hi all,

I believe there is a small typo in Example 6.7.1 of the Advanced Modern C++ for Robotics Course, in the section Why can we omit all these elements?.
In the dummy bool example I was wondering why the code

auto dummy_positive = []() -> bool { return false; };

bool dummy_x = dummy_positive;
printf(dummy_x ? "true" : "false");

should evaluate to true in the output as expected according to the notebook.
I believe what the code is supposed to do is the following. Otherwise, we are evaluating the lambda object instead of the return value (intersting enough that it can be casted to bool, apparently).

auto dummy_positive = []() -> bool { return false; };

bool dummy_x = dummy_positive();
printf(dummy_x ? "true" : "false");

The output of this snipped would then be “false” as I would expect from a lambda function that always returns false.

Anyway, thanks a lot for the great course!



Hello @tschuette ,

Many thanks for your feedback. We will review this and update it accordingly.

Hello @tschuette,

thank you very much for reporting this issue. It has been fixed now.

1 Like