23 template <
class Chunkedseq>
24 void pcopy(
typename Chunkedseq::iterator first,
25 typename Chunkedseq::iterator last,
26 Chunkedseq& destination) {
27 using iterator =
typename Chunkedseq::iterator;
28 using ptr =
typename Chunkedseq::const_pointer;
30 const long cutoff = 8192;
32 long sz = last.size() - first.size();
38 destination.pushn_back(lo, hi-lo);
44 iterator mid = first + (sz/2);
46 Chunkedseq destination2;
50 pcopy(first, mid, destination);
51 pcopy(mid, last, destination2);
54 destination.concat(destination2);
59 int main(
int argc,
const char * argv[]) {
61 const int chunk_size = 2;
69 std::cout <<
"mydeque2 contains:";
70 auto p = mydeque2.
begin();
71 while (p != mydeque2.
end())
72 std::cout <<
" " << *p++;
73 std::cout << std::endl;
iterator begin() const
Returns iterator to beginning.
void pcopy(typename Chunkedseq::iterator first, typename Chunkedseq::iterator last, Chunkedseq &destination)
[pcopy_example]
iterator end() const
Returns iterator to end.
int main(int argc, const char *argv[])
Chunked-sequence functor.