专攻 std::decay 有意义吗?

Does it make sense to specialize std::decay?

我有 class 表示数组引用 (class array_ref) 和另一个 (即 holds/own/contains) 数组 (class array). array_ref 表现得像引用。

std::decay 专门化为 class array_ref 成为 array 是否有意义?

namespace std{
template<> class decay<arra_ref>{typedef array type;};
}

我还有什么其他选择可以告诉通用程序 arrayarray_ref 的 "value type"?

是否在任何STL算法中使用了std::decay

标准库算法是否使用它并不重要。重要的是标准在 [meta.type.synop]/1:

中所说的内容

The behavior of a program that adds specializations for any of the templates defined in this subclause is undefined unless otherwise specified.

"this subclause" 中包含所有类型特征 类,包括 decay。所以不要专门化它。曾经.