I would like to initialize a std::map. For now I am using ::insert but I feel I am wasting some computational time since I already know the size I
std::map
::insert
No, the members of the map are internally stored in a tree structure. There is no way to build the tree until you know the keys and values that are to be stored.