Hi!
I am going to make a vector derived class
Code:
class flagvec: public vector<bool> {
public:
//Constructors
flagvec(unsigned int);
};
It is gonna take the ones and zeroes from the unsigned int and extract them to flags. The last one in the variable will be the last element in the flagvec.
Now I'm not sure how the vector part of my class is going to behave when I use my own constructor. If a constructor that I have declared is called, how is the vector initiated? How long will it be, or isn't it initiated at all?
Here's my constructor:
Code:
flagvec::flagvec(unsigned int a) {
//Here I want the vector to get a start length at 0, but I'm not sure how to call it's constructor
while (a) {
push_back(a & 1);
a >>= 1;
}
}
Thanks!