Initializing a std::map when the size is known in advance

后端 未结 5 1757
再見小時候
再見小時候 2020-12-30 19:00

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

5条回答
  •  情深已故
    2020-12-30 19:35

    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.

提交回复
热议问题