Meh*_*dad 8 c++ language-lawyer defaulted-functions
Clang 编译得很好,但 GCC 和 MSVC 抱怨不能operator=默认:
#include <type_traits>
template<class T>
struct S
{
typedef typename std::enable_if<!std::is_enum<T>::value, S>::type Me;
S &operator=(Me const &) = default;
};
int main()
{
S<int> s1, s2;
s1 = s2;
}
Run Code Online (Sandbox Code Playgroud)
这段代码合法吗?如果不是,那么Me定义为是否合法typedef S Me;?
| 归档时间: |
|
| 查看次数: |
144 次 |
| 最近记录: |