c++ - How to set default value of a vector of int pairs to be empty? -


i want gave default value (of empty) vector of int pairs in constructor (c++ 98). i've tried things along following , (obviously) doesn't work. point me in right direction?

someclassname( const int replace = 1,  const std::vector<std::pair<int, int> > node = std::vector<std::pair<int, int>() >() ); 

std::vector<std::pair<int, int>() >() value-initialized (empty std::vector) instance of vector of functions taking nothing , returning std::pair<int, int>. remove inner () vector of pairs:

const std::vector<std::pair<int, int> > node = std::vector<std::pair<int, int> >() 

you might want consider typedef because there's lot of noise:

typedef std::vector<std::pair<int, int> > node; ... const node node = node() 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -