diff --git a/docs/cpp/lambdas.md b/docs/cpp/lambdas.md index 5cc62dc2..9af750f0 100644 --- a/docs/cpp/lambdas.md +++ b/docs/cpp/lambdas.md @@ -508,16 +508,19 @@ A strong reason to use generic lambdas is for visiting syntax. ```cpp boost::variant value; -apply_visitor(value, [&](auto&& e){ - std::cout << e; -}); +boost::apply_visitor( + [&](auto&& e){ + std::cout << e; + }, + value +); ``` Here we are visiting in a polymorphic manner; but in other contexts, the names of the type we are passing isn't interesting: ```cpp -mutex_wrapped os = std::cout; +mutex_wrapped os(std::cout); os.write([&](auto&& os){ os << "hello world\n"; });