static const std::vector

c++, constants, private-members, static

Solution

Plain arrays do not have member functions. I believe you're looking for this:

int zooms[] = {1,2,3,4,5,6,7,8,9,10};
const std::vector ImageModel::mZoomLevels(zooms, zooms + 10);

Problem

I am writing an image viewer with Qt. I am trying to do the following in the header file: ``` class ImageModel { private: const static std::vector<int> mZoomLevels; } ``` in the source file: ``` int zooms[] = {1,2,3,4,5,6,7,8,9,10}; const std::vector<int> mZoomLevels(zooms.begin(),zooms.end()); ``` However I get the following error: request for member 'begin' in zooms which is of non-class type 'int[10]' request for member 'end' in zooms which is of non-class type 'int[10]' Does anyone know how to initialize this static const private member ?

Original source