Why can't I replace std::map with std::unordered_map

后端 未结 2 1342
一向
一向 2020-12-02 00:14

This question might be a bit sketchy because I do not have the code available at home, but I know this thing otherwise will bug me the whole weekend.

When I tried to

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 00:39

    Using both map and unordered_map with incomplete types involves undefined-behavior:

    In particular, the effects are undefined in the following cases:

    [...]

    — if an incomplete type (3.9) is used as a template argument when instantiating a template component, unless specifically allowed for that component.

提交回复
热议问题