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");
printf("\n");
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");
printf("\n");
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!
Best,
Tjark