【发布时间】:2016-10-24 16:42:13
【问题描述】:
clang-cl (4.0.0-trunk) 似乎认为是,而 vc2015 (update3) 认为不是。
此实现是否已定义或标准是否规定了 lambda 函数应如何实现?
#include <type_traits>
#include <iostream>
template <typename T>
void test_nothrow_move_assignable(T&&) {
std::cout << std::boolalpha
<< std::is_nothrow_move_assignable<T>::value
<< "\n";
}
int main() {
test_nothrow_move_assignable([]{});
return 0;
}
// $ clang-cl.exe scratch.cpp
// $ scratch.exe
// true
// $ cl /nologo /EHsc scratch.cpp
// scratch.cpp
// $ scratch.exe
// false
【问题讨论】:
-
我认为闭包类型根本不能移动分配。
标签: c++ lambda typetraits