Why aren't C++14 standard-defined literals in the global namespace by default?

前端 未结 3 1603
你的背包
你的背包 2021-01-01 14:22

C++14 includes standard-defined literals for, amongst other things, std::string and various timespans from the header.

To us

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-01 14:38

    Look at paper N2765. UDLs are hooked into the regular name lookup process. As string literals have common string types, there's a large chance of a collision if you ignored namespaces.

提交回复
热议问题