16 #include <forward_list>
19 #pragma pack(push,_CRT_PACKING)
21 #pragma warning (push)
22 #pragma warning (disable: 4510 4512 4610) // disable warnings for compiler unable to generate constructor
29 template<
class _Mylist>
34 typedef std::_Flist_const_iterator<_Mylist>
_Mybase;
40 typedef typename _Mylist::const_pointer
pointer;
41 typedef typename _Mylist::const_reference
reference;
55 this->_Ptr = _Right._Ptr;
66 return ((reference)**(_Mybase *)
this);
80 while (this->_Mynode() !=
NULL && this->_Mynode()->_Is_dummy());
92 while (this->_Mynode() !=
NULL && this->_Mynode()->_Is_dummy());
98 template<
class _Mylist>
inline
104 template<
class _Mylist>
inline
111 template<
class _Mylist>
137 this->_Ptr = _Right._Ptr;
148 return ((reference)**(_Mybase *)
this);
160 ++(*(_Mybase *)
this);
162 while (this->_Mynode() !=
NULL && this->_Mynode()->_Is_dummy());
169 _Myiter _Tmp = *
this;
174 while (this->_Mynode() !=
NULL && this->_Mynode()->_Is_dummy());
180 template<
class _Mylist>
inline
186 template<
class _Mylist>
inline
197 template<
typename _Element_type,
typename _Allocator_type>
201 typedef typename _Allocator_type::template rebind<_Element_type>::other
_Allocator_type;
213 void _Init(_Split_order_key _Order_key)
231 if (_Exchange_node == _Current_node)
239 return _Exchange_node;
258 #if _ITERATOR_DEBUG_LEVEL == 0
265 typename _Allocator_type::template rebind<std::_Container_proxy>::other _Alproxy(
_M_node_allocator);
266 _Myproxy = _Alproxy.allocate(1);
267 _Alproxy.construct(_Myproxy, std::_Container_proxy());
268 _Myproxy->_Mycont =
this;
273 typename _Allocator_type::template rebind<std::_Container_proxy>::other _Alproxy(
_M_node_allocator);
275 _Alproxy.destroy(_Myproxy);
276 _Alproxy.deallocate(_Myproxy, 1);
284 return &(
reinterpret_cast<_Node&
>(
const_cast<_Nodeptr&
>(
_Myhead)));
292 template<
typename _Element_type,
typename _Allocator_type>
299 typedef typename _Allocator_type::template rebind<_Element_type>::other
_Allocator_type;
303 typedef typename _Allocator_type::pointer
pointer;
321 template<
typename _ValTy>
329 _Pnode->_Init(_Order_key);
344 _Pnode->_Init(_Order_key);
352 return ((_Nodepref)(*_Pnode)._M_next);
358 return ((reference)(*_Pnode)._M_element);
363 template <
typename _Element_type,
typename _Element_allocator_type = std::allocator<_Element_type> >
375 typedef typename _Allocator_type::pointer
pointer;
397 _Nodeptr _Pnode = this->
_Myhead;
400 _ASSERT_EXPR(_Pnode !=
NULL && this->
_Nextnode(_Pnode) ==
NULL, L
"Invalid head list node");
414 #if _ITERATOR_DEBUG_LEVEL == 2
415 _Orphan_ptr(*
this, 0);
419 _Nodeptr _Pnode = this->
_Myhead;
421 _ASSERT_EXPR(this->
_Myhead !=
NULL, L
"Invalid head list node");
423 _Pnode->_M_next =
NULL;
426 while (_Pnode !=
NULL)
439 _Full_iterator _Iterator =
_Begin();
446 _Full_const_iterator _Iterator =
_Begin();
455 const_iterator
end()
const
462 return (((
const _Mytype *)
this)->
begin());
467 return (((
const _Mytype *)
this)->
end());
499 this->_Swap_all(_Right);
531 _Full_const_iterator
_End()
const
536 static _Split_order_key
_Get_key(
const _Full_const_iterator& _Iterator)
538 return _Iterator._Mynode()->_Get_order_key();
545 _ASSERT_EXPR(_Iterator._Mynode() !=
NULL && !_Iterator._Mynode()->_Is_dummy(), L
"Invalid user node (dummy)");
546 return iterator(_Iterator._Mynode(),
this);
553 _ASSERT_EXPR(_Iterator._Mynode() !=
NULL && !_Iterator._Mynode()->_Is_dummy(), L
"Invalid user node (dummy)");
566 return iterator(_Iterator._Mynode(),
this);
574 while (_Iterator !=
_End() && _Iterator._Mynode()->_Is_dummy())
579 return iterator(_Iterator._Mynode(),
this);
587 while (_Iterator !=
_End() && _Iterator._Mynode()->_Is_dummy())
598 if (!_Delete_node->_Is_dummy())
608 _Nodeptr
_Insert(_Nodeptr _Previous, _Nodeptr _New_node, _Nodeptr _Current_node)
610 _New_node->_M_next = _Current_node;
611 return _Previous->_Atomic_set_next(_New_node, _Current_node);
615 _Pairib
_Insert(_Full_iterator _Iterator, _Full_iterator _Next, _Nodeptr
_List_node,
long * _New_count)
617 _Nodeptr _Inserted_node =
_Insert(_Iterator._Mynode(), _List_node, _Next._Mynode());
619 if (_Inserted_node == _List_node)
633 _Full_iterator
_Insert_dummy(_Full_iterator _Iterator, _Split_order_key _Order_key)
636 _Full_iterator _Where = _Iterator;
638 _ASSERT_EXPR(_Where != _Last, L
"Invalid head node");
643 _Nodeptr _Dummy_node =
_Buynode(_Order_key);
647 _ASSERT_EXPR(_Iterator != _Last, L
"Invalid head list node");
651 if (_Where == _Last ||
_Get_key(_Where) > _Order_key)
653 _ASSERT_EXPR(
_Get_key(_Iterator) < _Order_key, L
"Invalid node order in the list");
656 _Nodeptr _Inserted_node =
_Insert(_Iterator._Mynode(), _Dummy_node, _Where._Mynode());
658 if (_Inserted_node == _Dummy_node)
676 else if (
_Get_key(_Where) == _Order_key)
691 void _Erase(_Full_iterator _Previous, _Full_const_iterator& _Where)
693 #if _ITERATOR_DEBUG_LEVEL == 2
694 if (_Where._Getcont() !=
this || _Where._Ptr == this->
_Myhead)
698 _Nodeptr _Pnode = (_Where++)._Mynode();
699 _Orphan_ptr(*
this, _Pnode);
701 _Nodeptr _Pnode = (_Where++)._Mynode();
704 _Nodeptr _Prevnode = _Previous._Mynode();
705 _ASSERT_EXPR(_Prevnode->_M_next == _Pnode, L
"Erase must take consecutive iterators");
706 _Prevnode->_M_next = _Pnode->_M_next;
712 iterator
_Erase(_Full_iterator _Previous, const_iterator _Where)
714 _Full_const_iterator _Iterator = _Where;
715 _Erase(_Previous, _Iterator);
724 _Full_const_iterator _First = _Source_list.
_Begin();
725 _Full_const_iterator
_Last = _Source_list.
_End();
732 _Nodeptr _Previous_node = this->
_Myhead;
733 _Full_const_iterator _Begin_iterator = _First++;
736 for (_Full_const_iterator _Iterator = _First; _Iterator !=
_Last;)
738 _Nodeptr _Node = _Iterator._Mynode();
740 _Nodeptr _Dummy_node = _Node->_Is_dummy() ?
_Buynode(_Node->_Get_order_key()) :
_Buynode(_Node->_Get_order_key(), this->
_Myval(_Node));
741 _Previous_node =
_Insert(_Previous_node, _Dummy_node,
NULL);
742 _ASSERT_EXPR(_Previous_node !=
NULL, L
"Insertion must succeed");
743 _Full_const_iterator _Where = _Iterator++;
754 for (_Full_iterator _Iterator =
_Begin(); _Iterator !=
_End(); _Iterator++)
756 _Full_iterator _Next_iterator = _Iterator;
759 _ASSERT_EXPR(_Next_iterator ==
end() || _Next_iterator._Mynode()->_Get_order_key() >= _Iterator._Mynode()->_Get_order_key(), L
"!!! List order inconsistency !!!");
764 #if _ITERATOR_DEBUG_LEVEL == 2
765 void _Orphan_ptr(_Mytype& _Cont, _Nodeptr _Ptr)
const
768 const_iterator **_Pnext = (const_iterator **)_Cont._Getpfirst();
773 if ((*_Pnext)->_Ptr == (_Nodeptr)&this->_Myhead || _Ptr != 0 && (*_Pnext)->_Ptr != _Ptr)
775 _Pnext = (const_iterator **)(*_Pnext)->_Getpnext();
779 (*_Pnext)->_Clrcont();
780 *_Pnext = *(const_iterator **)(*_Pnext)->_Getpnext();
795 #pragma warning (push)
std::pair< iterator, bool > _Pairib
Definition: internal_split_ordered_list.h:385
_Split_order_list_value< _Element_type, _Element_allocator_type > _Mybase
Definition: internal_split_ordered_list.h:368
Definition: internal_split_ordered_list.h:293
_Allocator_type::reference reference
Definition: internal_split_ordered_list.h:377
_Solist_const_iterator< _Mylist > _Unchecked_type
Definition: internal_split_ordered_list.h:51
_Solist_const_iterator< _Mylist > & _Rechecked(_Solist_const_iterator< _Mylist > &_Iterator, typename _Solist_const_iterator< _Mylist >::_Unchecked_type _Right)
Definition: internal_split_ordered_list.h:105
_Full_iterator _Begin()
Definition: internal_split_ordered_list.h:515
iterator _Get_iterator(const_iterator _Iterator)
Definition: internal_split_ordered_list.h:564
_Mylist::pointer pointer
Definition: internal_split_ordered_list.h:122
#define NULL
Definition: vcruntime.h:236
_Mybase::_Nodeptr _Nodeptr
Definition: internal_split_ordered_list.h:297
static _Split_order_key _Get_key(const _Full_const_iterator &_Iterator)
Definition: internal_split_ordered_list.h:536
_Allocator_type::size_type size_type
Definition: internal_split_ordered_list.h:301
const_iterator cend() const
Definition: internal_split_ordered_list.h:465
_Solist_iterator< _Mylist > _Unchecked_type
Definition: internal_split_ordered_list.h:133
size_t _Map_key
Definition: internal_split_ordered_list.h:194
_Element_type value_type
Definition: internal_split_ordered_list.h:203
_Full_iterator _Insert_dummy(_Full_iterator _Iterator, _Split_order_key _Order_key)
Definition: internal_split_ordered_list.h:633
_Solist_const_iterator< _Mylist >::_Unchecked_type _Unchecked(_Solist_const_iterator< _Mylist > _Iterator)
Definition: internal_split_ordered_list.h:99
_Full_const_iterator _End() const
Definition: internal_split_ordered_list.h:531
_Allocator_type::reference reference
Definition: internal_split_ordered_list.h:305
_Unchecked_type _Unchecked() const
Definition: internal_split_ordered_list.h:59
Definition: internal_split_ordered_list.h:112
_Allocator_type allocator_type
Definition: internal_split_ordered_list.h:372
constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:723
_Full_const_iterator _Begin() const
Definition: internal_split_ordered_list.h:521
_Split_ordered_list(_Allocator_type _Allocator=allocator_type())
Definition: internal_split_ordered_list.h:387
allocator_type get_allocator() const
Definition: internal_split_ordered_list.h:407
_Solist_const_iterator(_Nodeptr _Pnode, const _Mylist *_Plist)
Definition: internal_split_ordered_list.h:47
_Nodeptr & _Nodepref
Definition: internal_split_ordered_list.h:207
_Mybase::_Nodepref _Nodepref
Definition: internal_split_ordered_list.h:298
_Split_ordered_list< _Element_type, _Element_allocator_type > _Mytype
Definition: internal_split_ordered_list.h:367
_Mylist::difference_type difference_type
Definition: internal_split_ordered_list.h:121
std::_Flist_iterator< _Mybase > _Full_iterator
Definition: internal_split_ordered_list.h:384
_Allocator_type::value_type value_type
Definition: internal_split_ordered_list.h:379
_Mylist::_Nodeptr _Nodeptr
Definition: internal_split_ordered_list.h:119
_Nodeptr _Before_head() const _NOEXCEPT
Definition: internal_split_ordered_list.h:281
_Solist_const_iterator< _Mylist > _Myiter
Definition: internal_split_ordered_list.h:33
const_iterator _Get_first_real_iterator(_Full_const_iterator _Iterator) const
Definition: internal_split_ordered_list.h:584
pointer operator->() const
Definition: internal_split_ordered_list.h:69
#define _NOEXCEPT
Definition: yvals.h:25
_Split_order_key _M_order_key
Definition: internal_split_ordered_list.h:255
pointer operator->() const
Definition: internal_split_ordered_list.h:151
_Mylist::reference reference
Definition: internal_split_ordered_list.h:123
The Concurrency namespace provides classes and functions that provide access to the Concurrency Runti...
Definition: agents.h:43
_Full_iterator _End()
Definition: internal_split_ordered_list.h:526
_Allocator_type::size_type size_type
Definition: internal_split_ordered_list.h:202
_Allocator_type::const_pointer const_pointer
Definition: internal_split_ordered_list.h:304
_Solist_iterator()
Definition: internal_split_ordered_list.h:125
std::forward_iterator_tag iterator_category
Definition: internal_split_ordered_list.h:35
std::_Flist_const_iterator< _Mylist > _Mybase
Definition: internal_split_ordered_list.h:34
_Mylist::_Nodeptr _Nodeptr
Definition: internal_split_ordered_list.h:37
_Container_base0 _Container_base
Definition: xutility:246
bool empty() const
Definition: internal_split_ordered_list.h:471
volatile long _M_element_count
Definition: internal_split_ordered_list.h:787
_Allocator_type::const_reference const_reference
Definition: internal_split_ordered_list.h:378
void _Erase(_Nodeptr _Delete_node)
Definition: internal_split_ordered_list.h:596
_Allocator_type::template rebind< _Element_type >::other _Allocator_type
Definition: internal_split_ordered_list.h:299
_Allocator_type::size_type size_type
Definition: internal_split_ordered_list.h:373
const_iterator end() const
Definition: internal_split_ordered_list.h:455
_Split_order_key _Get_order_key() const
Definition: internal_split_ordered_list.h:220
_Mylist::const_pointer pointer
Definition: internal_split_ordered_list.h:40
reference operator*() const
Definition: internal_split_ordered_list.h:64
iterator end()
Definition: internal_split_ordered_list.h:450
_Unchecked_type _Unchecked() const
Definition: internal_split_ordered_list.h:141
Definition: internal_split_ordered_list.h:30
void _Move_all(_Mytype &_Source_list)
Definition: internal_split_ordered_list.h:722
#define _LOCK_DEBUG
Definition: yvals.h:607
_Nodeptr _Insert(_Nodeptr _Previous, _Nodeptr _New_node, _Nodeptr _Current_node)
Definition: internal_split_ordered_list.h:608
size_type size() const
Definition: internal_split_ordered_list.h:477
_Myiter & _Rechecked(_Unchecked_type _Right)
Definition: internal_split_ordered_list.h:135
std::forward_iterator_tag iterator_category
Definition: internal_split_ordered_list.h:117
Definition: internal_split_ordered_list.h:198
_Full_iterator _Get_iterator(_Full_const_iterator _Iterator)
Definition: internal_split_ordered_list.h:558
~_Split_ordered_list()
Definition: internal_split_ordered_list.h:391
void swap(array< _Ty, _Size > &_Left, array< _Ty, _Size > &_Right) _NOEXCEPT_OP(_NOEXCEPT_OP(_Left.swap(_Right)))
Definition: array:433
_Allocator_type::difference_type difference_type
Definition: internal_split_ordered_list.h:302
_Mylist::value_type value_type
Definition: internal_split_ordered_list.h:38
_Nodeptr _Myhead
Definition: internal_split_ordered_list.h:287
void _Init(_Split_order_key _Order_key)
Definition: internal_split_ordered_list.h:213
_Mylist::const_reference reference
Definition: internal_split_ordered_list.h:41
iterator _Get_first_real_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:571
size_type max_size() const
Definition: internal_split_ordered_list.h:483
_Nodeptr _Buynode(_Split_order_key _Order_key)
Definition: internal_split_ordered_list.h:341
_Myiter operator++(int)
Definition: internal_split_ordered_list.h:85
void * _InterlockedCompareExchangePointer(void *volatile *, void *, void *)
_Nodeptr _Buynode(_Split_order_key _Order_key, _ValTy &&_Value)
Definition: internal_split_ordered_list.h:322
_Mylist::difference_type difference_type
Definition: internal_split_ordered_list.h:39
void swap(_Mytype &_Right)
Definition: internal_split_ordered_list.h:489
_Solist_iterator< _Mybase > iterator
Definition: internal_split_ordered_list.h:382
_Allocator_type::value_type value_type
Definition: internal_split_ordered_list.h:307
_Node * _Nodeptr
Definition: internal_split_ordered_list.h:205
_Allocator_type::difference_type difference_type
Definition: internal_split_ordered_list.h:374
_Split_order_list_value(_Allocator_type _Allocator=_Allocator_type())
Definition: internal_split_ordered_list.h:309
_Allocator_type::const_reference const_reference
Definition: internal_split_ordered_list.h:306
static reference _Myval(_Nodeptr _Pnode)
Definition: internal_split_ordered_list.h:356
_Myiter & operator++()
Definition: internal_split_ordered_list.h:74
_Nodeptr _Atomic_set_next(_Nodeptr _New_node, _Nodeptr _Current_node)
Definition: internal_split_ordered_list.h:226
_Mybase::_Allocator_type _Allocator_type
Definition: internal_split_ordered_list.h:369
_Map_key _Split_order_key
Definition: internal_split_ordered_list.h:195
_Allocator_type::pointer pointer
Definition: internal_split_ordered_list.h:303
iterator _Erase(_Full_iterator _Previous, const_iterator _Where)
Definition: internal_split_ordered_list.h:712
_Split_order_list_node< _Element_type, _Allocator_type > _Mybase
Definition: internal_split_ordered_list.h:296
_Myiter & _Rechecked(_Unchecked_type _Right)
Definition: internal_split_ordered_list.h:53
reference operator*() const
Definition: internal_split_ordered_list.h:146
_Allocator_type::template rebind< _Node >::other _M_node_allocator
Definition: internal_split_ordered_list.h:288
_Myiter operator++(int)
Definition: internal_split_ordered_list.h:167
const_iterator begin() const
Definition: internal_split_ordered_list.h:444
iterator begin()
Definition: internal_split_ordered_list.h:437
value_type _M_element
Definition: internal_split_ordered_list.h:254
_Allocator_type _M_value_allocator
Definition: internal_split_ordered_list.h:289
~_Split_order_list_value()
Definition: internal_split_ordered_list.h:316
void _Erase(_Full_iterator _Previous, _Full_const_iterator &_Where)
Definition: internal_split_ordered_list.h:691
void _Check_range()
Definition: internal_split_ordered_list.h:751
_Solist_const_iterator()
Definition: internal_split_ordered_list.h:43
_Split_order_list_node(_Allocator_type _Allocator)
Definition: internal_split_ordered_list.h:259
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
_Mybase::_Nodeptr _Nodeptr
Definition: internal_split_ordered_list.h:370
static _Nodepref _Nextnode(_Nodeptr _Pnode)
Definition: internal_split_ordered_list.h:350
iterator _Get_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:543
std::_Flist_const_iterator< _Mybase > _Full_const_iterator
Definition: internal_split_ordered_list.h:383
_Myiter & operator++()
Definition: internal_split_ordered_list.h:156
long __cdecl _InterlockedIncrement(long volatile *)
_Solist_iterator< _Mylist > _Myiter
Definition: internal_split_ordered_list.h:115
_Solist_const_iterator< _Mybase > const_iterator
Definition: internal_split_ordered_list.h:381
const_iterator cbegin() const
Definition: internal_split_ordered_list.h:460
Definition: internal_split_ordered_list.h:210
_Pairib _Insert(_Full_iterator _Iterator, _Full_iterator _Next, _Nodeptr _List_node, long *_New_count)
Definition: internal_split_ordered_list.h:615
_Allocator_type::pointer pointer
Definition: internal_split_ordered_list.h:375
Definition: internal_split_ordered_list.h:364
_In_ int _Value
Definition: setjmp.h:173
_Nodeptr _M_next
Definition: internal_split_ordered_list.h:253
void clear()
Definition: internal_split_ordered_list.h:412
_Solist_const_iterator< _Mylist > _Mybase
Definition: internal_split_ordered_list.h:116
_FwdIt _Last
Definition: algorithm:1936
const_iterator _Get_iterator(_Full_const_iterator _Iterator) const
Definition: internal_split_ordered_list.h:551
_Allocator_type::const_pointer const_pointer
Definition: internal_split_ordered_list.h:376
constexpr const _Ty &() _Right
Definition: algorithm:3591
_Allocator_type::template rebind< _Element_type >::other _Allocator_type
Definition: internal_split_ordered_list.h:201
_Solist_iterator(_Nodeptr _Pnode, const _Mylist *_Plist)
Definition: internal_split_ordered_list.h:129
bool _Is_dummy() const
Definition: internal_split_ordered_list.h:245
_Mylist::value_type value_type
Definition: internal_split_ordered_list.h:120