Skip to content

Commit 12e5484

Browse files
committed
Add vector with allocator rules
1 parent 88046fd commit 12e5484

6 files changed

Lines changed: 1456 additions & 2 deletions

File tree

rules/vector/src.cpp

Lines changed: 268 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ template <typename T1> using t2 = typename std::vector<T1>::iterator;
1010
template <typename T1> using t3 = std::vector<std::vector<T1>>;
1111
template <typename T1> using t4 = typename std::vector<T1>::const_iterator;
1212

13+
template <typename T1, typename T2 = std::allocator<T1>>
14+
using t5 = std::vector<T1, T2>;
15+
template <typename T1, typename T2 = std::allocator<T1>>
16+
using t6 = typename std::vector<T1, T2>::iterator;
17+
template <typename T1, typename T2 = std::allocator<T1>>
18+
using t7 = std::vector<std::vector<T1, T2>>;
19+
template <typename T1, typename T2 = std::allocator<T1>>
20+
using t8 = typename std::vector<T1, T2>::const_iterator;
21+
1322
template <typename T1>
1423
typename std::vector<T1>::iterator
1524
f1(std::vector<T1> &o, typename std::vector<T1>::const_iterator it) {
@@ -171,8 +180,7 @@ std::vector<T1> f36(const std::initializer_list<T1> &a0) {
171180
return std::vector<T1>(a0);
172181
}
173182

174-
template <typename T1, typename T2>
175-
std::vector<T1> f37(T2 *first, T2 *last) {
183+
template <typename T1, typename T2> std::vector<T1> f37(T2 *first, T2 *last) {
176184
return std::vector<T1>(first, last);
177185
}
178186

@@ -260,3 +268,261 @@ std::vector<T1> &f58(std::vector<T1> &dst, const std::vector<T1> &src) {
260268
template <typename T1> void f59(std::vector<T1> &o) {
261269
return o.shrink_to_fit();
262270
}
271+
272+
template <typename T1, typename T2 = std::allocator<T1>>
273+
typename std::vector<T1, T2>::iterator
274+
f60(std::vector<T1, T2> &o, typename std::vector<T1, T2>::const_iterator it) {
275+
return o.erase(it);
276+
}
277+
278+
template <typename T1, typename T2 = std::allocator<T1>>
279+
std::size_t f61(const std::vector<T1, T2> &o) {
280+
return o.size();
281+
}
282+
283+
template <typename T1, typename T2 = std::allocator<T1>>
284+
bool f62(const std::vector<T1, T2> &o) {
285+
return o.empty();
286+
}
287+
288+
template <typename T1, typename T2 = std::allocator<T1>>
289+
std::vector<T1, T2> f63() {
290+
return std::vector<T1, T2>();
291+
}
292+
293+
template <typename T1, typename T2 = std::allocator<T1>>
294+
void f64(std::vector<T1, T2> &o) {
295+
return o.pop_back();
296+
}
297+
298+
template <typename T1, typename T2 = std::allocator<T1>>
299+
T1 *f65(std::vector<T1, T2> &o) {
300+
return o.data();
301+
}
302+
303+
template <typename T1, typename T2 = std::allocator<T1>>
304+
T1 &f66(std::vector<T1, T2> &o, std::size_t idx) {
305+
return o.at(idx);
306+
}
307+
308+
template <typename T1, typename T2 = std::allocator<T1>>
309+
std::vector<T1, T2> f67(std::size_t n) {
310+
return std::vector<T1, T2>(n);
311+
}
312+
313+
template <typename T1, typename T2 = std::allocator<T1>>
314+
T1 &f68(std::vector<T1, T2> &o) {
315+
return o.front();
316+
}
317+
318+
template <typename T1, typename T2 = std::allocator<T1>>
319+
T1 &f69(std::vector<T1, T2> &o) {
320+
return o.back();
321+
}
322+
323+
template <typename T1, typename T2 = std::allocator<T1>>
324+
std::size_t f70(const std::vector<T1, T2> &o) {
325+
return o.capacity();
326+
}
327+
328+
template <typename T1, typename T2 = std::allocator<T1>>
329+
void f71(std::vector<T1, T2> &o, std::size_t n) {
330+
return o.reserve(n);
331+
}
332+
333+
template <typename T1, typename T2 = std::allocator<T1>>
334+
typename std::vector<T1, T2>::iterator f72(std::vector<T1, T2> &o) {
335+
return o.begin();
336+
}
337+
338+
template <typename T1, typename T2 = std::allocator<T1>>
339+
void f73(std::vector<T1, T2> &o, T1 &&value) {
340+
return o.push_back(std::move(value));
341+
}
342+
343+
template <typename T1, typename T2 = std::allocator<T1>>
344+
void f74(std::vector<T1, T2> &o, std::size_t n) {
345+
return o.resize(n);
346+
}
347+
348+
template <typename T1, typename T2 = std::allocator<T1>>
349+
void f75(std::vector<T1, T2> &o) {
350+
return o.clear();
351+
}
352+
353+
template <typename T1, typename T2 = std::allocator<T1>>
354+
typename std::vector<T1, T2>::iterator f76(std::vector<T1, T2> &o) {
355+
return o.end();
356+
}
357+
358+
template <typename T1, typename T2 = std::allocator<T1>>
359+
typename std::vector<T1, T2>::iterator
360+
f77(std::vector<T1, T2> &o, typename std::vector<T1, T2>::const_iterator it,
361+
T1 &&value) {
362+
return o.insert(it, std::move(value));
363+
}
364+
365+
template <typename T1, typename T2 = std::allocator<T1>>
366+
std::vector<T1, T2> f78(std::size_t n, const T1 &value) {
367+
return std::vector<T1, T2>(n, value);
368+
}
369+
370+
template <typename T1, typename T2 = std::allocator<T1>>
371+
typename std::vector<T1, T2>::iterator
372+
f79(std::vector<T1, T2> &o, typename std::vector<T1, T2>::const_iterator it,
373+
const T1 &value) {
374+
return o.insert(it, value);
375+
}
376+
377+
template <typename T1, typename T2 = std::allocator<T1>>
378+
void f80(std::vector<T1, T2> &o, const T1 &value) {
379+
return o.push_back(value);
380+
}
381+
382+
template <typename T1, typename T2 = std::allocator<T1>>
383+
typename std::vector<T1, T2>::reference
384+
f81(typename std::vector<T1, T2>::iterator it) {
385+
return it.operator*();
386+
}
387+
388+
template <typename T1, typename T2 = std::allocator<T1>>
389+
typename std::vector<T1, T2>::iterator
390+
f82(const typename std::vector<T1, T2>::iterator &it) {
391+
return typename std::vector<T1, T2>::iterator(it);
392+
}
393+
394+
template <typename T1, typename T2 = std::allocator<T1>>
395+
typename std::vector<T1, T2>::const_iterator
396+
f83(const typename std::vector<T1, T2>::iterator &it) {
397+
return typename std::vector<T1, T2>::const_iterator(it);
398+
}
399+
400+
template <typename T1, typename T2 = std::allocator<T1>>
401+
typename std::vector<T1, T2>::iterator
402+
f84(typename std::vector<T1, T2>::iterator it, std::size_t n) {
403+
return it.operator+(n);
404+
}
405+
406+
template <typename T1, typename T2 = std::allocator<T1>>
407+
bool f85(const typename std::vector<T1, T2>::iterator &it1,
408+
const typename std::vector<T1, T2>::iterator &it2) {
409+
return operator!=(it1, it2);
410+
}
411+
412+
template <typename T1, typename T2 = std::allocator<T1>>
413+
bool f86(const typename std::vector<T1, T2>::iterator &it1,
414+
const typename std::vector<T1, T2>::iterator &it2) {
415+
return operator==(it1, it2);
416+
}
417+
418+
template <typename T1, typename T2 = std::allocator<T1>>
419+
typename std::vector<T1, T2>::iterator
420+
f87(typename std::vector<T1, T2>::iterator a0, int a1) {
421+
return a0.operator++(a1);
422+
}
423+
424+
template <typename T1, typename T2 = std::allocator<T1>>
425+
typename std::vector<T1, T2>::iterator::difference_type
426+
f88(const typename std::vector<T1, T2>::iterator &it1,
427+
const typename std::vector<T1, T2>::iterator &it2) {
428+
return operator-(it1, it2);
429+
}
430+
431+
template <typename T1, typename T2 = std::allocator<T1>>
432+
typename std::vector<T1, T2>::iterator &
433+
f89(typename std::vector<T1, T2>::iterator &it) {
434+
return it.operator++();
435+
}
436+
437+
template <typename T1, typename T2 = std::allocator<T1>>
438+
std::vector<T1, T2> f90(const T1 *first, const T1 *last) {
439+
return std::vector<T1, T2>(first, last);
440+
}
441+
442+
template <typename T1, typename T2 = std::allocator<T1>>
443+
std::vector<T1, T2> f91(const std::initializer_list<T1> &a0) {
444+
return std::vector<T1, T2>(a0);
445+
}
446+
447+
template <typename T1, typename T2 = std::allocator<T1>, typename T3>
448+
std::vector<T1, T2> f92(T3 *first, T3 *last) {
449+
return std::vector<T1, T2>(first, last);
450+
}
451+
452+
template <typename T1, typename T2 = std::allocator<T1>>
453+
const T1 *f93(const std::vector<T1, T2> &o) {
454+
return o.data();
455+
}
456+
457+
template <typename T1, typename T2 = std::allocator<T1>>
458+
typename std::vector<T1, T2>::const_iterator
459+
f94(typename std::vector<T1, T2>::const_iterator first,
460+
typename std::vector<T1, T2>::const_iterator last) {
461+
return std::max_element(first, last);
462+
}
463+
464+
template <typename T1, typename T2 = std::allocator<T1>>
465+
typename std::vector<T1, T2>::const_iterator f95(const std::vector<T1, T2> &o) {
466+
return o.begin();
467+
}
468+
469+
template <typename T1, typename T2 = std::allocator<T1>>
470+
typename std::vector<T1, T2>::const_iterator f96(const std::vector<T1, T2> &o) {
471+
return o.end();
472+
}
473+
474+
template <typename T1, typename T2 = std::allocator<T1>>
475+
void f97(std::vector<T1, T2> &o, std::vector<T1, T2> &a0) {
476+
return o.swap(a0);
477+
}
478+
479+
template <typename T1, typename T2 = std::allocator<T1>>
480+
const T1 &f98(const std::vector<T1, T2> &o, std::size_t idx) {
481+
return o.at(idx);
482+
}
483+
484+
template <typename T1, typename T2 = std::allocator<T1>>
485+
const T1 &f99(const std::vector<T1, T2> &o) {
486+
return o.back();
487+
}
488+
489+
template <typename T1, typename T2 = std::allocator<T1>>
490+
void f100(std::vector<std::vector<T1, T2>> &o,
491+
const std::vector<T1, T2> &value) {
492+
return o.push_back(value);
493+
}
494+
495+
template <typename T1, typename T2 = std::allocator<T1>>
496+
typename std::vector<T1, T2>::iterator
497+
f101(std::vector<T1, T2> &o, typename std::vector<T1, T2>::const_iterator pos,
498+
const T1 *first, const T1 *last) {
499+
return o.insert(pos, first, last);
500+
}
501+
502+
template <typename T1, typename T2 = std::allocator<T1>>
503+
void f102(std::vector<T1, T2> &o, std::size_t n,
504+
const typename std::vector<T1, T2>::value_type &value) {
505+
return o.resize(n, value);
506+
}
507+
508+
template <typename T1, typename T2 = std::allocator<T1>>
509+
std::vector<T1, T2> &f103(std::vector<T1, T2> &dst, std::vector<T1, T2> &&src) {
510+
return dst.operator=(std::move(src));
511+
}
512+
513+
template <typename T1, typename T2 = std::allocator<T1>>
514+
typename std::vector<T1, T2>::const_iterator
515+
f104(const std::vector<T1, T2> &o) {
516+
return o.cend();
517+
}
518+
519+
template <typename T1, typename T2 = std::allocator<T1>>
520+
std::vector<T1, T2> &f105(std::vector<T1, T2> &dst,
521+
const std::vector<T1, T2> &src) {
522+
return dst.operator=(src);
523+
}
524+
525+
template <typename T1, typename T2 = std::allocator<T1>>
526+
void f106(std::vector<T1, T2> &o) {
527+
return o.shrink_to_fit();
528+
}

0 commit comments

Comments
 (0)