acme
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages Concepts
aaa__sort_array_impl.h
1#pragma once
2
3
4//template < class TYPE, class ARG_TYPE, class BASE_ARRAY >
5//index_array & sort_array < TYPE, ARG_TYPE, BASE_ARRAY >::
6//defer_update(const ::atom & atom)
7//{
8//
9// ::pointer<sort_index>& sortindex = m_indexmap[fCompare];
10//
11// if(sortindex.is_null())
12// sortindex = __allocate sort_index();
13//
14// if(!sortindex->m_bUpdated)
15// {
16// ::papaya::array::ensure_sequence(sortindex->m_indexa,(index) 0,(index)this->get_upper_bound());
17// ::sort::array::quick_sort((BASE_ARRAY &) *this, fCompare, sortindex->m_indexa);
18// sortindex->m_bUpdated = true;
19// }
20//
21// return sortindex->m_indexa;
22//
23//}
24
25
26//
27//template < typename ARG_TYPE >
28//bool default_less < ARG_TYPE > ::less(ARG_TYPE a1, ARG_TYPE a2)
29//{
30//
31// return a1 < a2;
32//
33//}
34//
35//
36//template < typename ARG_TYPE >
37//template < typename ARRAY >
38//void sort_data < ARG_TYPE > ::sort(ARRAY * parray)
39//{
40//
41// if (m_bSorted)
42// {
43//
44// return;
45//
46// }
47//
48// auto & pia = m_pindexa;
49//
50// if (!pia)
51// {
52//
53// pia = __allocate index_array();
54//
55// }
56//
57// ::papaya::array::ensure_sequence(*pia, (index)0, (index)parray->get_upper_bound());
58//
59// ::sort::array::quick_sort(*parray, m_pless, *pia);
60//
61// m_bSorted = true;
62//
63//}
64//
65//
66//template < typename ARG_TYPE >
67//inline void sort_map < ARG_TYPE > ::mark_dirty()
68//{
69//
70// for (auto & psort : this->values())
71// {
72//
73// psort->mark_dirty();
74//
75// }
76//
77//}
78//
79//
80//template < class TYPE, class ARG_TYPE, class BASE_ARRAY >
81//void sort_array < TYPE, ARG_TYPE, BASE_ARRAY >::copy(const BASE_ARRAY & src)
82//{
83//
84// ::papaya::array::copy(*m_parray, src);
85//
86// m_map.mark_dirty();
87//
88//}
89//
90//
91//namespace sort
92//{
93//
94//
95// template < class iterator, class COMPARE >
96// void quick_sort(const iterator& a, const iterator& b)
97// {
98// typename iterator::BASE_TYPE t;
99// raw_array < iterator > stackLowerBound;
100// raw_array < iterator > stackUpperBound;
101// iterator iLowerBound;
102// iterator iUpperBound;
103// iterator iLPos, iUPos, iMPos;
104// // unsigned int t;
105//
106// if (a.get_count() >= 2)
107// {
108// stackLowerBound.push(a);
109// stackUpperBound.push(b);
110// while (true)
111// {
112// iLowerBound = stackLowerBound.pop();
113// iUpperBound = stackUpperBound.pop();
114// iLPos = iLowerBound;
115// iMPos = iLowerBound;
116// iUPos = iUpperBound;
117// while (true)
118// {
119// while (true)
120// {
121// if (iMPos == iUPos)
122// break;
123// if (COMPARE().operator()(*iMPos, *iUPos))
124// --iUPos;
125// else
126// {
127// t = *iMPos;
128// *iMPos = *iUPos;
129// *iUPos = t;
130// break;
131// }
132// }
133// if (iMPos == iUPos)
134// break;
135// iMPos = iUPos;
136// while (true)
137// {
138// if (iMPos == iLPos)
139// break;
140// if (COMPARE().operator()(*iLPos, *iMPos))
141// ++iLPos;
142// else
143// {
144// t = *iMPos;
145// *iMPos = *iLPos;
146// *iLPos = t;
147// break;
148// }
149// }
150// if (iMPos == iLPos)
151// break;
152// iMPos = iLPos;
153// }
154// if (iLowerBound < iMPos - 1)
155// {
156// stackLowerBound.push(iLowerBound);
157// stackUpperBound.push(iMPos - 1);
158// }
159// if (iMPos + 1 < iUpperBound)
160// {
161// stackLowerBound.push(iMPos + 1);
162// stackUpperBound.push(iUpperBound);
163// }
164// if (stackLowerBound.get_size() == 0)
165// break;
166// }
167// }
168//
169// };
170//
171//
172//} // namespace sort