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
Post a Comment