草庐IT

Josuttis

全部标签

c++ - 从 Josuttis : Do different template functions, 实例化到给定特定类型的相同函数签名,导致 ODR 无效?

在Josuttis和Vandevoorde关于模板的著名著作中,C++Templates:TheCompleteGuide,他们讨论了有关函数模板重载的细节。在他们的一个示例中,与函数签名和重载函数模板的讨论相关,他们提供了用以下术语描述的代码:Thisprogramisvalidandproducesthefollowingoutput:(Note:Outputshownbelow)但是,当我在VisualStudio2010中构建和编译相同的代码时,我得到了不同的结果。这让我相信要么是VS2010编译器生成了错误的代码,要么是Josuttis错误地认为代码有效。这是代码。(Josu

c++ - 从 Josuttis : Do different template functions, 实例化到给定特定类型的相同函数签名,导致 ODR 无效?

在Josuttis和Vandevoorde关于模板的著名著作中,C++Templates:TheCompleteGuide,他们讨论了有关函数模板重载的细节。在他们的一个示例中,与函数签名和重载函数模板的讨论相关,他们提供了用以下术语描述的代码:Thisprogramisvalidandproducesthefollowingoutput:(Note:Outputshownbelow)但是,当我在VisualStudio2010中构建和编译相同的代码时,我得到了不同的结果。这让我相信要么是VS2010编译器生成了错误的代码,要么是Josuttis错误地认为代码有效。这是代码。(Josu

c++ - CppCon 2018,尼古拉 Josuttis : Why are these interpreted as iterators?

NicolaiJosuttis在CppCon2018上的“C++初始化的噩梦”演讲曾一度包含以下代码:std::vectorv07={{"1","2"}};尼古拉saidthefollowing(我的转录本):Theproblemis,whathappenshereis,weinterpretthesetwoparametersasiterators.Sotheseareiterators,sothisisthebeginningoftherange,andthisistheendoftherange,andtheyshouldrefertothesamerangeofcharacte