Question: Need help on how to correctly initialize pixels_ as a vector(int) constructor as asked in Part 2. using UC = unsigned char; struct Pixel {UC
Need help on how to correctly initialize pixels_ as a vector(int) constructor as asked in Part 2.

using UC = unsigned char; struct Pixel {UC red=0, green=0, blue=0, alpha=255;};
class Image { public: //Initializors Image() = default; Image(unsigned width, unsigned height); Image(const std::string& path); //Accessors unsigned width() const; unsigned height() const; unsigned size() const; //Mutators void fill(const Pixel& color); //Overloaded functions Pixel& at(unsigned pos); Pixel& at(unsigned x, unsigned y);
bool load(const std::string& path); bool save(const std::string& path); private: unsigned width_ = 0, height_ = 0; vector
Image::Image(unsigned width, unsigned height) { width_ = width; height_ = height; vector
Sorry this is not complete source code, but I just want to know again how to correctly initialize for pixels_ as per the instructions.
2. The two-argument constructor needs to initialize width_ and height, as well as pixels. Initialize pixels using the vector(int) constructor which creates a vector containing width * height Pixels
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
