I'm perplexed...
I have a piece of code thus;
class logger
{
public:
std::mutex mut;
unique_lock< std::mutex> lk(mut);
// ... snip ...
}
The line "unique_lock < std::mutex > lk (mut) " fails compilation with this error;
**g++ -pthread --std=c++11 main.cxx main.cxx:42:31: error: mut is not a type
unique_lock< std::mutex> lk(mut);**
However if I change it to... (note the brace initializer is the only difference)
unique_lock< std::mutex> lk(mut);
It compiles just fine.
I have other code that initialises using the non brace initializer that works/compiles fine. Why on earth is this the case, maybe I'm tired :)
Cheers
G