【发布时间】:2015-12-29 09:17:25
【问题描述】:
考虑以下类:
struct C
{
/* Class contents, without any arithmetic operator... */
constexpr operator int() noexcept; // Implicit conversion to int
};
我的问题是:
- C 是否可用于标准算法,例如
std::sort,目前使用默认的 - C 是否满足
LessThanComparable概念? - C 是否满足假设的概念化算法库的要求,该算法库要求类型为
LessThanComparable。
【问题讨论】:
-
我很好奇并尝试了它。在这里使用 C++14:cpp.sh/4hdh
标签: c++ implicit-conversion stl-algorithm c++17 c++-concepts