Why doesn't the following code compile:
#include <array>
struct A
{
std::array<size_t, 5> i_;
A() {}
A( A const& a)
: i_{ a.i_ } {}
};
int main()
{
A a1;
A a2 = a1;
return 0;
}
GCC 4.8.1 says
error: cannot convert 'const std::array' to 'long unsigned int' in initialization : i_{ a.i_ }
std::array
. The entire array isn't an element. You don't even need to explicitly define that copy constructor.