| OLD | NEW |
| 1 // -*- C++ -*- | 1 // -*- C++ -*- |
| 2 //===----------------------------- map ------------------------------------===// | 2 //===----------------------------- map ------------------------------------===// |
| 3 // | 3 // |
| 4 // The LLVM Compiler Infrastructure | 4 // The LLVM Compiler Infrastructure |
| 5 // | 5 // |
| 6 // This file is dual licensed under the MIT and the University of Illinois Open | 6 // This file is dual licensed under the MIT and the University of Illinois Open |
| 7 // Source Licenses. See LICENSE.TXT for details. | 7 // Source Licenses. See LICENSE.TXT for details. |
| 8 // | 8 // |
| 9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
| 10 | 10 |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 typedef typename __alloc_traits::pointer pointer; | 565 typedef typename __alloc_traits::pointer pointer; |
| 566 private: | 566 private: |
| 567 typedef typename value_type::value_type::first_type first_type; | 567 typedef typename value_type::value_type::first_type first_type; |
| 568 typedef typename value_type::value_type::second_type second_type; | 568 typedef typename value_type::value_type::second_type second_type; |
| 569 | 569 |
| 570 allocator_type& __na_; | 570 allocator_type& __na_; |
| 571 | 571 |
| 572 __map_node_destructor& operator=(const __map_node_destructor&); | 572 __map_node_destructor& operator=(const __map_node_destructor&); |
| 573 | 573 |
| 574 public: | 574 public: |
| 575 bool __first_constructed; | 575 bool __constructed; |
| 576 bool __second_constructed; | |
| 577 | 576 |
| 578 _LIBCPP_INLINE_VISIBILITY | 577 _LIBCPP_INLINE_VISIBILITY |
| 579 explicit __map_node_destructor(allocator_type& __na) _NOEXCEPT | 578 explicit __map_node_destructor(allocator_type& __na) _NOEXCEPT |
| 580 : __na_(__na), | 579 : __na_(__na), |
| 581 __first_constructed(false), | 580 __constructed(false) |
| 582 __second_constructed(false) | |
| 583 {} | 581 {} |
| 584 | 582 |
| 585 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | 583 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| 586 _LIBCPP_INLINE_VISIBILITY | 584 _LIBCPP_INLINE_VISIBILITY |
| 587 __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEP
T | 585 __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEP
T |
| 588 : __na_(__x.__na_), | 586 : __na_(__x.__na_), |
| 589 __first_constructed(__x.__value_constructed), | 587 __constructed(__x.__value_constructed) |
| 590 __second_constructed(__x.__value_constructed) | |
| 591 { | 588 { |
| 592 __x.__value_constructed = false; | 589 __x.__value_constructed = false; |
| 593 } | 590 } |
| 594 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | 591 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| 595 | 592 |
| 596 _LIBCPP_INLINE_VISIBILITY | 593 _LIBCPP_INLINE_VISIBILITY |
| 597 void operator()(pointer __p) _NOEXCEPT | 594 void operator()(pointer __p) _NOEXCEPT |
| 598 { | 595 { |
| 599 if (__second_constructed) | 596 if (__constructed) |
| 600 __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__cc.s
econd)); | 597 __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_)); |
| 601 if (__first_constructed) | |
| 602 __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__cc.f
irst)); | |
| 603 if (__p) | 598 if (__p) |
| 604 __alloc_traits::deallocate(__na_, __p, 1); | 599 __alloc_traits::deallocate(__na_, __p, 1); |
| 605 } | 600 } |
| 606 }; | 601 }; |
| 607 | 602 |
| 608 template <class _Key, class _Tp, class _Compare, class _Allocator> | 603 template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 609 class map; | 604 class map; |
| 610 template <class _Key, class _Tp, class _Compare, class _Allocator> | 605 template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 611 class multimap; | 606 class multimap; |
| 612 template <class _TreeIterator> class __map_const_iterator; | 607 template <class _TreeIterator> class __map_const_iterator; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 friend _LIBCPP_INLINE_VISIBILITY | 814 friend _LIBCPP_INLINE_VISIBILITY |
| 820 bool operator!=(const __map_const_iterator& __x, const __map_const_iterator&
__y) | 815 bool operator!=(const __map_const_iterator& __x, const __map_const_iterator&
__y) |
| 821 {return __x.__i_ != __y.__i_;} | 816 {return __x.__i_ != __y.__i_;} |
| 822 | 817 |
| 823 template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map
; | 818 template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map
; |
| 824 template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY mul
timap; | 819 template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY mul
timap; |
| 825 template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY __tree_con
st_iterator; | 820 template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY __tree_con
st_iterator; |
| 826 }; | 821 }; |
| 827 | 822 |
| 828 template <class _Key, class _Tp, class _Compare = less<_Key>, | 823 template <class _Key, class _Tp, class _Compare = less<_Key>, |
| 829 class _Allocator = allocator<pair<const _Key, _Tp> > > | 824 class _Allocator = counting_allocator<pair<const _Key, _Tp>, allocatio
n_group::map> > |
| 830 class _LIBCPP_TYPE_VIS_ONLY map | 825 class _LIBCPP_TYPE_VIS_ONLY map |
| 831 { | 826 { |
| 832 public: | 827 public: |
| 833 // types: | 828 // types: |
| 834 typedef _Key key_type; | 829 typedef _Key key_type; |
| 835 typedef _Tp mapped_type; | 830 typedef _Tp mapped_type; |
| 836 typedef pair<const key_type, mapped_type> value_type; | 831 typedef pair<const key_type, mapped_type> value_type; |
| 837 typedef pair<key_type, mapped_type> __nc_value_type; | 832 typedef pair<key_type, mapped_type> __nc_value_type; |
| 838 typedef _Compare key_compare; | 833 typedef _Compare key_compare; |
| 839 typedef _Allocator allocator_type; | 834 typedef _Allocator allocator_type; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 854 public: | 849 public: |
| 855 _LIBCPP_INLINE_VISIBILITY | 850 _LIBCPP_INLINE_VISIBILITY |
| 856 bool operator()(const value_type& __x, const value_type& __y) const | 851 bool operator()(const value_type& __x, const value_type& __y) const |
| 857 {return comp(__x.first, __y.first);} | 852 {return comp(__x.first, __y.first);} |
| 858 }; | 853 }; |
| 859 | 854 |
| 860 private: | 855 private: |
| 861 | 856 |
| 862 typedef _VSTD::__value_type<key_type, mapped_type> __value_type; | 857 typedef _VSTD::__value_type<key_type, mapped_type> __value_type; |
| 863 typedef __map_value_compare<key_type, __value_type, key_compare> __vc; | 858 typedef __map_value_compare<key_type, __value_type, key_compare> __vc; |
| 864 typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, | 859 typedef typename __rebind_counting_alloc_helper<allocator_traits<allocator_t
ype>, |
| 865 __value_type>::type __allocator
_type; | 860 __value_type>::type __allocator_type; |
| 866 typedef __tree<__value_type, __vc, __allocator_type> __base; | 861 typedef __tree<__value_type, __vc, __allocator_type> __base; |
| 867 typedef typename __base::__node_traits __node_traits; | 862 typedef typename __base::__node_traits __node_traits; |
| 868 typedef allocator_traits<allocator_type> __alloc_traits; | 863 typedef allocator_traits<allocator_type> __alloc_traits; |
| 869 | 864 |
| 870 __base __tree_; | 865 __base __tree_; |
| 871 | 866 |
| 872 public: | 867 public: |
| 873 typedef typename __alloc_traits::pointer pointer; | 868 typedef typename __alloc_traits::pointer pointer; |
| 874 typedef typename __alloc_traits::const_pointer const_pointer; | 869 typedef typename __alloc_traits::const_pointer const_pointer; |
| 875 typedef typename __alloc_traits::size_type size_type; | 870 typedef typename __alloc_traits::size_type size_type; |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 _VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_))
; | 1450 _VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_))
; |
| 1456 } | 1451 } |
| 1457 } | 1452 } |
| 1458 | 1453 |
| 1459 template <class _Key, class _Tp, class _Compare, class _Allocator> | 1454 template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1460 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder | 1455 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder |
| 1461 map<_Key, _Tp, _Compare, _Allocator>::__construct_node() | 1456 map<_Key, _Tp, _Compare, _Allocator>::__construct_node() |
| 1462 { | 1457 { |
| 1463 __node_allocator& __na = __tree_.__node_alloc(); | 1458 __node_allocator& __na = __tree_.__node_alloc(); |
| 1464 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); | 1459 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); |
| 1465 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first)); | 1460 __node_traits::construct(__na, _VSTD::addressof(__h->__value_)); |
| 1466 __h.get_deleter().__first_constructed = true; | 1461 __h.get_deleter().__constructed = true; |
| 1467 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second)); | |
| 1468 __h.get_deleter().__second_constructed = true; | |
| 1469 return __h; | 1462 return __h; |
| 1470 } | 1463 } |
| 1471 | 1464 |
| 1472 template <class _Key, class _Tp, class _Compare, class _Allocator> | 1465 template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1473 template <class _A0> | 1466 template <class _A0> |
| 1474 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder | 1467 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder |
| 1475 map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0) | 1468 map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0) |
| 1476 { | 1469 { |
| 1477 __node_allocator& __na = __tree_.__node_alloc(); | 1470 __node_allocator& __na = __tree_.__node_alloc(); |
| 1478 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); | 1471 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); |
| 1479 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forwa
rd<_A0>(__a0)); | 1472 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forwa
rd<_A0>(__a0)); |
| 1480 __h.get_deleter().__first_constructed = true; | 1473 __h.get_deleter().__constructed = true; |
| 1481 __h.get_deleter().__second_constructed = true; | |
| 1482 return __h; | 1474 return __h; |
| 1483 } | 1475 } |
| 1484 | 1476 |
| 1485 template <class _Key, class _Tp, class _Compare, class _Allocator> | 1477 template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1486 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder | 1478 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder |
| 1487 map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(key_type&& __k) | 1479 map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(key_type&& __k) |
| 1488 { | 1480 { |
| 1489 __node_allocator& __na = __tree_.__node_alloc(); | 1481 __node_allocator& __na = __tree_.__node_alloc(); |
| 1490 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); | 1482 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); |
| 1491 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), _
VSTD::move(__k)); | 1483 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::piece
wise_construct, |
| 1492 __h.get_deleter().__first_constructed = true; | 1484 _VSTD::forward_as_tuple(_VSTD::move(__k)), _VSTD::f
orward_as_tuple()); |
| 1493 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second)); | 1485 __h.get_deleter().__constructed = true; |
| 1494 __h.get_deleter().__second_constructed = true; | |
| 1495 return __h; | 1486 return __h; |
| 1496 } | 1487 } |
| 1497 | 1488 |
| 1498 #ifndef _LIBCPP_HAS_NO_VARIADICS | 1489 #ifndef _LIBCPP_HAS_NO_VARIADICS |
| 1499 | 1490 |
| 1500 template <class _Key, class _Tp, class _Compare, class _Allocator> | 1491 template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1501 template <class _A0, class _A1, class ..._Args> | 1492 template <class _A0, class _A1, class ..._Args> |
| 1502 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder | 1493 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder |
| 1503 map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _
Args&& ...__args) | 1494 map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _
Args&& ...__args) |
| 1504 { | 1495 { |
| 1505 __node_allocator& __na = __tree_.__node_alloc(); | 1496 __node_allocator& __na = __tree_.__node_alloc(); |
| 1506 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); | 1497 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); |
| 1507 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), | 1498 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), |
| 1508 _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1
), | 1499 _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1
), |
| 1509 _VSTD::forward<_Args>(__args)...); | 1500 _VSTD::forward<_Args>(__args)...); |
| 1510 __h.get_deleter().__first_constructed = true; | 1501 __h.get_deleter().__constructed = true; |
| 1511 __h.get_deleter().__second_constructed = true; | |
| 1512 return __h; | 1502 return __h; |
| 1513 } | 1503 } |
| 1514 | 1504 |
| 1505 template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1506 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder |
| 1507 map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type&
__k) |
| 1508 { |
| 1509 __node_allocator& __na = __tree_.__node_alloc(); |
| 1510 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); |
| 1511 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::piece
wise_construct, |
| 1512 _VSTD::forward_as_tuple(__k), _VSTD::forward_as_tup
le()); |
| 1513 __h.get_deleter().__constructed = true; |
| 1514 return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 |
| 1515 } |
| 1516 |
| 1515 #endif // _LIBCPP_HAS_NO_VARIADICS | 1517 #endif // _LIBCPP_HAS_NO_VARIADICS |
| 1516 | 1518 |
| 1517 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | 1519 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| 1518 | 1520 |
| 1519 template <class _Key, class _Tp, class _Compare, class _Allocator> | 1521 template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1520 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder | |
| 1521 map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type&
__k) | |
| 1522 { | |
| 1523 __node_allocator& __na = __tree_.__node_alloc(); | |
| 1524 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); | |
| 1525 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), _
_k); | |
| 1526 __h.get_deleter().__first_constructed = true; | |
| 1527 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second)); | |
| 1528 __h.get_deleter().__second_constructed = true; | |
| 1529 return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 | |
| 1530 } | |
| 1531 | |
| 1532 template <class _Key, class _Tp, class _Compare, class _Allocator> | |
| 1533 _Tp& | 1522 _Tp& |
| 1534 map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) | 1523 map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) |
| 1535 { | 1524 { |
| 1536 __node_base_pointer __parent; | 1525 __node_base_pointer __parent; |
| 1537 __node_base_pointer& __child = __find_equal_key(__parent, __k); | 1526 __node_base_pointer& __child = __find_equal_key(__parent, __k); |
| 1538 __node_pointer __r = static_cast<__node_pointer>(__child); | 1527 __node_pointer __r = static_cast<__node_pointer>(__child); |
| 1539 if (__child == nullptr) | 1528 if (__child == nullptr) |
| 1540 { | 1529 { |
| 1541 __node_holder __h = __construct_node_with_key(__k); | 1530 __node_holder __h = __construct_node_with_key(__k); |
| 1542 __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_poin
ter>(__h.get())); | 1531 __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_poin
ter>(__h.get())); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1678 inline _LIBCPP_INLINE_VISIBILITY | 1667 inline _LIBCPP_INLINE_VISIBILITY |
| 1679 void | 1668 void |
| 1680 swap(map<_Key, _Tp, _Compare, _Allocator>& __x, | 1669 swap(map<_Key, _Tp, _Compare, _Allocator>& __x, |
| 1681 map<_Key, _Tp, _Compare, _Allocator>& __y) | 1670 map<_Key, _Tp, _Compare, _Allocator>& __y) |
| 1682 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) | 1671 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) |
| 1683 { | 1672 { |
| 1684 __x.swap(__y); | 1673 __x.swap(__y); |
| 1685 } | 1674 } |
| 1686 | 1675 |
| 1687 template <class _Key, class _Tp, class _Compare = less<_Key>, | 1676 template <class _Key, class _Tp, class _Compare = less<_Key>, |
| 1688 class _Allocator = allocator<pair<const _Key, _Tp> > > | 1677 class _Allocator = counting_allocator<pair<const _Key, _Tp>, allocatio
n_group::multimap > > |
| 1689 class _LIBCPP_TYPE_VIS_ONLY multimap | 1678 class _LIBCPP_TYPE_VIS_ONLY multimap |
| 1690 { | 1679 { |
| 1691 public: | 1680 public: |
| 1692 // types: | 1681 // types: |
| 1693 typedef _Key key_type; | 1682 typedef _Key key_type; |
| 1694 typedef _Tp mapped_type; | 1683 typedef _Tp mapped_type; |
| 1695 typedef pair<const key_type, mapped_type> value_type; | 1684 typedef pair<const key_type, mapped_type> value_type; |
| 1696 typedef pair<key_type, mapped_type> __nc_value_type; | 1685 typedef pair<key_type, mapped_type> __nc_value_type; |
| 1697 typedef _Compare key_compare; | 1686 typedef _Compare key_compare; |
| 1698 typedef _Allocator allocator_type; | 1687 typedef _Allocator allocator_type; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1714 public: | 1703 public: |
| 1715 _LIBCPP_INLINE_VISIBILITY | 1704 _LIBCPP_INLINE_VISIBILITY |
| 1716 bool operator()(const value_type& __x, const value_type& __y) const | 1705 bool operator()(const value_type& __x, const value_type& __y) const |
| 1717 {return comp(__x.first, __y.first);} | 1706 {return comp(__x.first, __y.first);} |
| 1718 }; | 1707 }; |
| 1719 | 1708 |
| 1720 private: | 1709 private: |
| 1721 | 1710 |
| 1722 typedef _VSTD::__value_type<key_type, mapped_type> __value_type; | 1711 typedef _VSTD::__value_type<key_type, mapped_type> __value_type; |
| 1723 typedef __map_value_compare<key_type, __value_type, key_compare> __vc; | 1712 typedef __map_value_compare<key_type, __value_type, key_compare> __vc; |
| 1724 typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, | 1713 typedef typename __rebind_counting_alloc_helper<allocator_traits<allocator_t
ype>, |
| 1725 __value_type>::type __allocator
_type; | 1714 __value_type>::type __allocator
_type; |
| 1726 typedef __tree<__value_type, __vc, __allocator_type> __base; | 1715 typedef __tree<__value_type, __vc, __allocator_type> __base; |
| 1727 typedef typename __base::__node_traits __node_trait
s; | 1716 typedef typename __base::__node_traits __node_trait
s; |
| 1728 typedef allocator_traits<allocator_type> __alloc_trai
ts; | 1717 typedef allocator_traits<allocator_type> __alloc_trai
ts; |
| 1729 | 1718 |
| 1730 __base __tree_; | 1719 __base __tree_; |
| 1731 | 1720 |
| 1732 public: | 1721 public: |
| 1733 typedef typename __alloc_traits::pointer pointer; | 1722 typedef typename __alloc_traits::pointer pointer; |
| 1734 typedef typename __alloc_traits::const_pointer const_pointer; | 1723 typedef typename __alloc_traits::const_pointer const_pointer; |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2093 _VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_))
; | 2082 _VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_))
; |
| 2094 } | 2083 } |
| 2095 } | 2084 } |
| 2096 | 2085 |
| 2097 template <class _Key, class _Tp, class _Compare, class _Allocator> | 2086 template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 2098 typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder | 2087 typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder |
| 2099 multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node() | 2088 multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node() |
| 2100 { | 2089 { |
| 2101 __node_allocator& __na = __tree_.__node_alloc(); | 2090 __node_allocator& __na = __tree_.__node_alloc(); |
| 2102 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); | 2091 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); |
| 2103 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first)); | 2092 __node_traits::construct(__na, _VSTD::addressof(__h->__value_)); |
| 2104 __h.get_deleter().__first_constructed = true; | 2093 __h.get_deleter().__constructed = true; |
| 2105 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second)); | |
| 2106 __h.get_deleter().__second_constructed = true; | |
| 2107 return __h; | 2094 return __h; |
| 2108 } | 2095 } |
| 2109 | 2096 |
| 2110 template <class _Key, class _Tp, class _Compare, class _Allocator> | 2097 template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 2111 template <class _A0> | 2098 template <class _A0> |
| 2112 typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder | 2099 typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder |
| 2113 multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0) | 2100 multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0) |
| 2114 { | 2101 { |
| 2115 __node_allocator& __na = __tree_.__node_alloc(); | 2102 __node_allocator& __na = __tree_.__node_alloc(); |
| 2116 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); | 2103 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); |
| 2117 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forwa
rd<_A0>(__a0)); | 2104 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forwa
rd<_A0>(__a0)); |
| 2118 __h.get_deleter().__first_constructed = true; | 2105 __h.get_deleter().__constructed = true; |
| 2119 __h.get_deleter().__second_constructed = true; | |
| 2120 return __h; | 2106 return __h; |
| 2121 } | 2107 } |
| 2122 | 2108 |
| 2123 #ifndef _LIBCPP_HAS_NO_VARIADICS | 2109 #ifndef _LIBCPP_HAS_NO_VARIADICS |
| 2124 | 2110 |
| 2125 template <class _Key, class _Tp, class _Compare, class _Allocator> | 2111 template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 2126 template <class _A0, class _A1, class ..._Args> | 2112 template <class _A0, class _A1, class ..._Args> |
| 2127 typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder | 2113 typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder |
| 2128 multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __
a1, _Args&& ...__args) | 2114 multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __
a1, _Args&& ...__args) |
| 2129 { | 2115 { |
| 2130 __node_allocator& __na = __tree_.__node_alloc(); | 2116 __node_allocator& __na = __tree_.__node_alloc(); |
| 2131 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); | 2117 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); |
| 2132 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), | 2118 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), |
| 2133 _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1
), | 2119 _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1
), |
| 2134 _VSTD::forward<_Args>(__args)...); | 2120 _VSTD::forward<_Args>(__args)...); |
| 2135 __h.get_deleter().__first_constructed = true; | 2121 __h.get_deleter().__constructed = true; |
| 2136 __h.get_deleter().__second_constructed = true; | |
| 2137 return __h; | 2122 return __h; |
| 2138 } | 2123 } |
| 2139 | 2124 |
| 2140 #endif // _LIBCPP_HAS_NO_VARIADICS | 2125 #endif // _LIBCPP_HAS_NO_VARIADICS |
| 2141 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | 2126 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| 2142 | 2127 |
| 2143 #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIAD
ICS) | 2128 #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIAD
ICS) |
| 2144 | 2129 |
| 2145 template <class _Key, class _Tp, class _Compare, class _Allocator> | 2130 template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 2146 template <class ..._Args> | 2131 template <class ..._Args> |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2227 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, | 2212 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, |
| 2228 multimap<_Key, _Tp, _Compare, _Allocator>& __y) | 2213 multimap<_Key, _Tp, _Compare, _Allocator>& __y) |
| 2229 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) | 2214 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) |
| 2230 { | 2215 { |
| 2231 __x.swap(__y); | 2216 __x.swap(__y); |
| 2232 } | 2217 } |
| 2233 | 2218 |
| 2234 _LIBCPP_END_NAMESPACE_STD | 2219 _LIBCPP_END_NAMESPACE_STD |
| 2235 | 2220 |
| 2236 #endif // _LIBCPP_MAP | 2221 #endif // _LIBCPP_MAP |
| OLD | NEW |