I'm designing a class that has to get ownership of a unique_ptr and do sth with it. Here is a minimized version of the code:
Chunk.h:
class Chunk { public: Chunk(std::unique_ptr<unsigned char[]> contents); std::unique_ptr<char[]> contents; }; Chunk.cpp:
Chunk::Chunk(std::unique_ptr<unsigned char[]> content): contents(std::move(content)){ } but it couldn't compiled though to this error:
no matching function for call to ‘std::unique_ptr<char []>::unique_ptr(std::remove_reference<std::unique_ptr<unsigned char []>&>::type)’
<unsigned char[]>template as argument and<char[]>template as member?unique_ptr, or an rvalue reference(&&)?