I use Boost :: assign to initialize the structure vector as follows:
const std::vector<spriteInfo> Resources::hudObjectInfo = boost::assign::list_of
( spriteInfo(FALSE, SCORE_START_X, SCORE_START_Y, CENTER_ALIGN ))
( spriteInfo(FALSE, SCORE_START_X+NUM_DIFF, SCORE_START_Y, CENTER_ALIGN))
...
;
NB. The structure spriteInfonow looks like this:
struct spriteInfo
{
spriteInfo::spriteInfo(bool i, float x, float y, int align):
invisible(i), x1(x), y1(y), alignment(align){}
bool invisible;
float x1;
float y1;
int alignment;
};
However, I would like to make a std::vector<int>member spriteInfo.
If I do, what will the text above look like? Those. can you initialize a vector by passing it as a parameter to the constructor?
source
share