是否可以便携地执行以下操作:
struct structure {
structure() {}
private:
// only allow container copy construct
structure(const structure&) {}
// in general, does not work because allocator (not vector) calls copy construct
friend class std::vector<structure>;
};
上面尝试编译的示例消息:
In member function void __gnu_cxx::new_allocator<_Tp>::construct(_Tp*, const _Tp&)
[with _Tp = kernel_data<const double*>::block]:
...
/usr/include/c++/4.3/ext/new_allocator.h:108: error: within this context
谢谢
我确实有解决方法,但我很好奇这怎么可能