c++ - 可以给 `std`命名空间添加推导指南吗?

标签 c++ language-lawyer c++-faq deduction-guide template-argument-deduction

假设我想制作一个新的演绎指南,使以下内容成为可能?

std::string str;
std::basic_string_view sv = str;

这是一个好的定制吗?

最佳答案

[namespace.std]/2.4 :

The behavior of a C++ program is undefined if it declares [...] a deduction guide for any standard library class template.

关于c++ - 可以给 `std`命名空间添加推导指南吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58992794/

相关文章:

c++ - constexpr 函数中的嵌套结构,在 clang 中编译,在 gcc 中失败

c++ - 未定义的行为和顺序点

c++ - 试图引用对象工厂中已删除的函数

c++ - union 中的标量成员是否计入公共(public)初始序列?

c++ - 所有异常都是 C++ 中的对象?

syntax-error - 内置fc的手册页使用-而不是-作为选项

c++ - 为什么在宏中使用明显无意义的 do-while 和 if-else 语句?

c++ - 我应该如何编写符合 ISO C++ 标准的自定义 new 和 delete 运算符?

c++ - MFC 列表框中的复选框在 VS2015 中显示不同

c++ - 我可以在不修改 QWidget 子类 PIMPL 样式的情况下包装它吗