Ticket #13405: boost_container_move_fix.diff
File boost_container_move_fix.diff, 2.9 KB (added by , 5 years ago) |
---|
-
boost/container/detail/tree.hpp
354 354 typedef typename AllocHolder::intrusive_container intrusive_container; 355 355 typedef typename AllocHolder::Node node_t; 356 356 typedef typename AllocHolder::NodePtr node_ptr_type; 357 typedef typename boost::container::container_detail::if_c< 358 DoMove, 359 node_t, 360 const node_t>::type node_param_t; 357 361 358 362 public: 359 363 RecyclingCloner(AllocHolder &holder, intrusive_container &itree) 360 364 : m_holder(holder), m_icont(itree) 361 365 {} 362 366 363 BOOST_CONTAINER_FORCEINLINE static void do_assign(node_ptr_type &p, constnode_t &other, bool_<true>)364 { p->do_move_assign( const_cast<node_t &>(other).m_data); }367 BOOST_CONTAINER_FORCEINLINE static void do_assign(node_ptr_type &p, node_t &other, bool_<true>) 368 { p->do_move_assign(other.m_data); } 365 369 366 370 BOOST_CONTAINER_FORCEINLINE static void do_assign(node_ptr_type &p, const node_t &other, bool_<false>) 367 371 { p->do_assign(other.m_data); } 368 372 369 node_ptr_type operator()(const node_t &other) const 373 BOOST_CONTAINER_FORCEINLINE static node_ptr_type do_create_node(AllocHolder &holder, node_t &other, bool_<true>) 374 { return holder.create_node(::boost::move(other.m_data)); } 375 376 BOOST_CONTAINER_FORCEINLINE static node_ptr_type do_create_node(AllocHolder &holder, const node_t &other, bool_<false>) 377 { return holder.create_node(other.m_data); } 378 379 node_ptr_type operator()(node_param_t &other) const 370 380 { 371 381 if(node_ptr_type p = m_icont.unlink_leftmost_without_rebalance()){ 372 382 //First recycle a node (this can't throw) … … 386 396 BOOST_CATCH_END 387 397 } 388 398 else{ 389 return m_holder.create_node(other.m_data);399 return this->do_create_node(m_holder, other, bool_<DoMove>()); 390 400 } 391 401 } 392 402 -
libs/container/test/map_test.cpp
339 339 test_move<map<recursive_map, recursive_map> >(); 340 340 test_move<multimap<recursive_multimap, recursive_multimap> >(); 341 341 } 342 //Same, but with a move-only content. 343 { 344 test_move<map<test::movable_int, test::movable_int> >(); 345 test_move<multimap<test::movable_int, test::movable_int> >(); 346 } 342 347 343 348 //Test std::pair value type as tree has workarounds to make old std::pair 344 349 //implementations movable that can break things -
libs/container/test/set_test.cpp
335 335 test_move<set<recursive_set> >(); 336 336 test_move<multiset<recursive_multiset> >(); 337 337 } 338 //Same, but with a move-only content. 339 { 340 test_move<set<test::movable_int> >(); 341 test_move<multiset<test::movable_int> >(); 342 } 338 343 //Test std::pair value type as tree has workarounds to make old std::pair 339 344 //implementations movable that can break things 340 345 {