Visual Studio 2012 是否正确执行此操作?标准::移动
Does Visual Studio 2012 do this correctly? std::move
我最近试图回答的一个问题似乎是vs2012的c ++ 11支持中的错误。
具体来说,它无法使用不可复制构造的value_type编译 std::map,尽管只有 std::move 用于插入到映射中。要么选择了错误的插入重载,要么编译器不考虑替代。
基本上,我不知道以下代码是否:
#include <iostream>
#include <memory>
#include <utility>
#include <type_traits>
class Foo {
};
using namespace std;
int main() {
cout << is_constructible<pair<const int,unique_ptr<Foo> >, pair<const int,unique_ptr<Foo> >& >::value << 'n';
cout << is_constructible<pair<const int,unique_ptr<Foo> >, pair<const int,unique_ptr<Foo> >&& >::value << 'n';
}
给出输出 01。
Visual Studio
输出(现场观看):
1
1
这显然是错误的,gcc
和clang
都给出了预期的结果。此错误和您看到的原始问题可能与这两个接受的错误报告有关。is_constructible的错误结果实际上可能与原始错误无关:
- std::is_*constructible::value == true 对于抽象类。
- VC11:map 和 unordered_map 操作器[] 要求mapped_type是 CopyConstructible 或 MoveConstructible b
相关文章:
- 为什么在popback()操作之后,它仍然打印完整的矢量
- 标准输入输出操作如何C++完成
- 对标准类型使用原子操作
- 标准上的 OMP 和并行操作::set<...>::迭代器
- 为什么C++标准指定有符号整数在具有混合符号的二进制操作中强制转换为无符号整数
- 如何在标准库C/C++函数中进行gdb单步执行操作
- 标准::atomic_应该如何...<std::shared_ptr>用于线程安全类的复制和移动操作?
- Visual Studio 2012 是否正确执行此操作?标准::移动
- 位操作的标准(跨平台)方法
- 在 C++ 中执行此操作的视觉更好方法?标准::字符串
- C++11:常量和引用类型上“auto”操作的标准引用
- C++ 11 标准是否保证 std::atomic<> 作为无锁操作实现?
- 对于 C++11,我是否仍然需要一个用于 Unicode 文本的非标准字符串操作库
- 是否允许抛出标准迭代器操作
- 具有c++标准规定的时间复杂度的操作能否动态分配内存?
- 通过对dll的标准调用操作字符串的问题
- 删除复制构造函数/赋值会破坏标准库操作吗?
- c++ 11标准中的消费操作是什么?
- 编译器用来决定移动操作是否安全的标准是什么
- 标准函数和操作在类构造函数中不起作用