C++ const static member array initialization -
i have class foo member variable bar big array of dynamic_bitset. make variable bar static sake of memory, const. value of bar stored in predefined file. should put code reading file , initializing bar?
madsciencedreams's solution work, can more simply:
in header
class { static const vector<dynamic_bitset> s; public: // ... };
in implementation file
vector<dynamic_bitset> loadbitsets() { //... return something; } const vector<dynamic_bitset> a::s(loadbitsets());
the move constructor should used automatically.
Comments
Post a Comment