Skip to content

Commit 5c3eb88

Browse files
committed
Add vector with allocator rules
1 parent 88046fd commit 5c3eb88

6 files changed

Lines changed: 1453 additions & 2 deletions

File tree

rules/vector/src.cpp

Lines changed: 269 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ 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+
16+
#if defined(__linux__)
17+
template <typename T1, typename T2 = std::allocator<T1>>
18+
using t6 = typename std::vector<T1, T2>::iterator;
19+
template <typename T1, typename T2 = std::allocator<T1>>
20+
using t7 = typename std::vector<T1, T2>::const_iterator;
21+
#endif
22+
1323
template <typename T1>
1424
typename std::vector<T1>::iterator
1525
f1(std::vector<T1> &o, typename std::vector<T1>::const_iterator it) {
@@ -171,8 +181,7 @@ std::vector<T1> f36(const std::initializer_list<T1> &a0) {
171181
return std::vector<T1>(a0);
172182
}
173183

174-
template <typename T1, typename T2>
175-
std::vector<T1> f37(T2 *first, T2 *last) {
184+
template <typename T1, typename T2> std::vector<T1> f37(T2 *first, T2 *last) {
176185
return std::vector<T1>(first, last);
177186
}
178187

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

0 commit comments

Comments
 (0)