D
Dan Smithers
Is there a way of specifying the contents of a vector in the constructor
when the elements are not identical?
I would like to be able to construct a static const vector that contains
pre-determined values.
class CFoo
{
static const std::vector<int> m_foo;
static const int *const m_bar;
....
};
const std::vector<int> CFoo::m_foo({1, 2, 3});
const int *const CFoo::m_bar = {10, 20, 30};
As I want a static member, it needs to be all done through the constructor.
Would it be easier just to declare a const array as in m_bar?
thanks
dan
when the elements are not identical?
I would like to be able to construct a static const vector that contains
pre-determined values.
class CFoo
{
static const std::vector<int> m_foo;
static const int *const m_bar;
....
};
const std::vector<int> CFoo::m_foo({1, 2, 3});
const int *const CFoo::m_bar = {10, 20, 30};
As I want a static member, it needs to be all done through the constructor.
Would it be easier just to declare a const array as in m_bar?
thanks
dan