I am following a c++
course and there is something I would like to be able to do in one line. I have the following class:
class example {
private:
int height, width;
std::unique_ptr<uint8_t[]> pointer = nullptr;
public:
example()
:pointer(new uint8_t[height * width * 3]) // this works
{}
};
But I would rather initialize the pointer
member inline like:
unique_ptr<uint8_t[]> pointer = new uint8_t[height * width * 3]; // doesnt work
Is this possible?