2

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?

Bryan Chen
  • 42,570
  • 18
  • 109
  • 136
dorel bosu
  • 21
  • 2

0 Answers0