std::shared_ptr compile error for 2D array type (G++7.2)
goldenhawking
goldenhawking@163.com
Fri Oct 6 08:47:00 GMT 2017
We use std::shared_ptr to hold 2D array like this:
std::shared_ptr< int[24] > bar(new int[N][24], [=](int(*p)[24])->void {
delete[] p; } );
GNU C++ 4/5/6 is ok . GNU C++ 7.2 gives an error message:
error: no matching function for call to 'std::shared_ptr<int
[24]>::shared_ptr(int (*)[24])'Â shared_ptr< int [24] > pt (new int
[4096][24]);
This may be a problem caused by default construct mechanism of a 2D array.
More information about the Libstdc++
mailing list