std :: scoped_allocator_adaptor和std :: pair

时间:2014-12-01 01:44:18

标签: c++11 allocator std-pair adaptor

为容器使用std :: scoped_allocator_adaptor'ed分配器时,为什么std :: pair和std :: tuple的行为不同?

std :: pair失败:

std::vector<std::pair<std::string, std::string>,
 std::scoped_allocator_adaptor<std::allocator<std::pair<std::string, std::string>>>> v;
v.push_back(std::make_pair( "one", "two" ));    // <--- does not compile

而std :: tuple工作

std::vector<std::tuple<std::string, std::string>,  
std::scoped_allocator_adaptor<std::allocator<std::tuple<std::string, std::string>>>> v2;
v2.push_back(std::make_tuple("one", "two"));     // <- no problem

这是否与std :: tuple具有uses_allocator而std_pair不具有这一事实有关?

0 个答案:

没有答案