initialize vector of pairs
问题 I wanted to initialize a vector of pairs with something like this std::vector< std::pair<bool, bool> > myvector(initSequence.size(), X ); what shall I substitute in place of X, if I want to initialize every pair with (false, false)? Thank you 回答1: std::pair<bool,bool>(false, false) or std::make_pair(false, false) 回答2: Nothing. std::pair<bool, bool> will be default constructed as make_pair(false, false) . 来源: https://stackoverflow.com/questions/4405630/initialize-vector-of-pairs