-
11 votesanswersviews
两个函数模板何时被视为部分有序且何时不明确?
在阅读了问题How to make these std::function parameters unambiguous?后,我完全感到困惑,到目前为止,我认为我理解了函数模板的部分排序,但是在阅读了这个问题后,我写了三个例子来检查编译器的行为,并且收到的结果很难我理解 . 示例#1 template <class T> void foo(T) {} template <cla... -
19 votesanswersviews
模板偏序 - 为什么部分演绎在这里成功
考虑以下简单(在模板问题的范围内)示例: #include <iostream> template <typename T> struct identity; template <> struct identity<int> { using type = int; }; template<typename T> void b... -
19 votesanswersviews
模板偏序 - 为什么部分演绎在这里成功
考虑以下简单(在模板问题的范围内)示例: #include <iostream> template <typename T> struct identity; template <> struct identity<int> { using type = int; }; template<typename T> void b... -
43 votesanswersviews
类模板特化部分排序和函数合成
选择哪个类模板特化的首选规则包括将特化重写为函数模板,并通过函数模板[temp.class.order]的排序规则确定哪个函数模板更加专业化 . 考虑这个例子,然后: #include <iostream> template <class T> struct voider { using type = void; }; template <class T> u...