I have a simple function:
void foo(atomic<int> a) { }
It occurs that I can call foo() in this way:
foo({ });
but I can't do it in a such way:
foo(atomic<int>{ }); due to an error message copy constructor is a deleted function. I have compiled with C++14.
- What constructor is called in the first way: create constructor or move constructor?
- Why in the second way is not called for example a move constructor?
- These two calls of
foo()compiles fine with C++17 - why?