std::scoped_allocator_adaptor and std::pair

147 views Asked by At

Why do std::pair and std::tuple behave differently when using std::scoped_allocator_adaptor'ed allocators for the containers?

std::pair fails:

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

while std::tuple works

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

Is this related to the fact that std::tuple has uses_allocator while std_pair does not?

0

There are 0 answers