I am getting a compilation error on this C++11 code but I dont know why. This is the code:
Visual Studio 2015 fails with the following error:
error C2280: 'std::condition_variable::condition_variable(const std::condition_variable &)': attempting to reference a deleted function
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\mutex(550): note: see declaration of 'std::condition_variable::condition_variable'.
If I change the
Test constructor to not use C++11 uniform initialization of the
Struct it compiles OK.
myStruct() // <--- CHANGE
I am not getting why for
Struct type uses copy constructor but the
Class seems OK. It only happends with
Struct having non-copiable members.
I also noted that if I init the
Struct outside of the
Test Class member initializer list It works:
Any idea Why is this code failing?. What is going on under the hood? What is the difference between
myClass initialization and
myStruct initialization?. Why it won't compile if used on the class member
initializer list but is it okay I use it outside? I have tried on
GCC and it seems to be okay.