2

コンテナーに std::scoped_allocator_adaptor のアロケーターを使用すると、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 にはないという事実に関連していますか?

4

0 に答える 0