...
[ISO/IEC 14882-2014] | Subclause 6.8, "Ambiguity Resolution" Subclause 8.2, "Ambiguity Resolution" |
[Meyers 01] | Item 6, "Be Alert for C++'s Most Vexing Parse" |
...
#include <mutex>
#include <thread>
#include <vector>
static std::mutex m;
static int shared_resource;
void increment_by_42() {
{ std::unique_lock<std::mutex>(m);
shared_resource += 42;
}
}