Here is a smaller version of a use case that I am working on.
#include <mutex>
template<typename T = float>
class Foo
{
public:
Foo(int x, int y):m_mutex(){}
private:
std::mutex m_mutex; // This is must have in my project
};
typedef Foo<float> Foo_typedef;
class Func
{
public:
static Foo_typedef static_array[2];
};
Foo_typedef Func::static_array[2] = { Foo_typedef(2,3), Foo_typedef(2,3) };
int main()
{
return 0;
}
After compiling this VS 2015 Update 2 emits following errors.
error C2280: 'Foo<float>::Foo(const Foo<float> &)': attempting to reference a deleted function
note: see declaration of 'Foo<float>::Foo'
I looked around and I suspected that there might one of the two reasons this.
1) Copy constructor member for std::mutex
is deleted
2) This which I thought might be similar to what I am seeing.
Which one is it? What can I do to bypass this error thrown by VS 2015 Update 2 compiler?
UPDATE:Updated the constructor which takes in some parameters that are needed to be passed to Foo_typedef
.