I want to gave a default value (of empty) for a vector of int pairs in a constructor (C++ 98). I've tried things along the following and it (obviously) doesn't work. Could anyone point me in the 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>() >()is a value-initialized (empty forstd::vector) instance of a vector of functions taking nothing and returningstd::pair<int, int>. Simply remove the inner()to get a vector of pairs:You might also want to consider a typedef because there's a lot of noise: