A map is a collection. You are creating a vector of collections, and make_pair() is used to create a single element of the map collection. instead, you should be inserting a map. If you don’t need a vector of collections and instead just a collection, just use map<,int, bool>,. It will make your life easier when initializing (don’t forget to delete your allocations before your vector goes out of scope). Also, make sure that vector of maps or pointer-to-maps is really what you need… …are there simpler structures which would do what you want to do? Due to the value-semantics of STL, I recommend that instead of trying to create a vector of maps, create a vector of pointers to maps. You don’t really give enough information but I am guessing that you may have not allocated any elements in your vector, and so you are getting some kind of out-of-bounds problem? Source.