TProcura
Biblioteca em C++ para testes paramétricos de algoritmos, e coleção de algoritmos de procura e otimização
Loading...
Searching...
No Matches
TVector.h
Go to the documentation of this file.
1#pragma once
2
15#include <stdlib.h>
16#include <string.h>
17#include <stdio.h>
18#include <initializer_list>
19#include "TRand.h"
20
22 // TVector
24
25template <class Item>
27{
28private:
29 TVector<int>* idx = nullptr;
30 Item* v = nullptr;
31 int sz = 0;
32 int count = 0;
35 void Size(int size);
36
38 void QuickSort(int start, int end);
39
41 void Insertion(int start, int end);
42
44 void Exch(int i, int j) { Item a = v[i]; v[i] = v[j]; v[j] = a; }
45
47 void QuickSortIdx(int start, int end);
48
50 void ExchIdx(int i, int j) { int a = (*idx)[i]; (*idx)[i] = (*idx)[j]; (*idx)[j] = a; }
51
53 static inline int Min(int a, int b) noexcept { return (a < b) ? a : b; }
54
56 static inline int Max(int a, int b) noexcept { return (a > b) ? a : b; }
57
58public:
59 static Item erro;
63
64 TVector(int size = 0);
65
67 TVector(int size, Item const* init);
68
70 virtual ~TVector() noexcept;
71
74
79 TVector(const TVector& o);
80
86 TVector& operator=(const TVector& o);
87
93 TVector(TVector&& o) noexcept;
94
99 TVector(std::initializer_list<Item> init) {
100 Count(static_cast<int>(init.size())); // ajusta capacidade
101 int i = 0;
102 for (const auto& val : init)
103 v[i++] = val;
104 }
105
106
126 TVector(const char* str) {}
127
133 TVector& operator=(TVector&& o) noexcept;
135
136
146
152 TVector& operator+=(std::initializer_list<Item> init) {
153 int oldCount = Count();
154 Count(oldCount + static_cast<int>(init.size()));
155 int i = 0;
156 for (const auto& val : init)
157 v[oldCount + i++] = val;
158 return *this;
159 }
160
171 TVector<Item>& operator+=(const char* str) {}
172
174
177
178 inline TVector<Item>& Add(Item a) { operator[](count) = a; return *this; }
179
181 TVector<Item>& Insert(Item a, int index = 0);
182
184 TVector<Item>& Insert(TVector<Item>& v, int index = 0);
185
187 inline TVector<Item>& Push(Item a) { return Add(a); }
188
190 inline Item& Pop() { return (count > 0 ? v[--count] : TVector<Item>::erro); }
191
203 Item& operator[](int i);
204
213 const Item& operator[](int i) const;
214
216 Item* Data() { return v; }
218 const Item* Data() const { return v; }
219
221 inline Item& First() { return (count > 0 ? v[0] : TVector<Item>::erro); }
222
224 inline Item& Last() { return (count > 0 ? v[count - 1] : TVector<Item>::erro); }
225
227 int Count() const { return count; }
228
230 bool Empty() const { return (count == 0); }
231
242 {
243 if (value > sz)
244 Size(value);
245 count = value;
246 return *this;
247 }
248
250 Item& Random() { return (count > 0 ? operator[](TRand::rand() % count) : TVector<Item>::erro); }
252
255
257
260
263
266
268 bool Equal(const TVector<Item>& v) const;
269
271 bool Contained(const TVector<Item>& v) const;
273
276
278
280 TVector<Item>& Remove(Item const& i);
281
283 int Find(Item& i, bool binary = false, int left = 0, int right = -1);
284
286 TVector<Item>& Replace(Item const& iold, Item const& inew);
287
289 TVector<Item>& Sort(TVector<int>* idxvect = nullptr);
290
292 void Sort(int start, int end = -1);
293
296
299
301 TVector<Item>& Reset(Item const& i);
302
311 int Distance(TVector<Item>& v, int type = 0);
313
316 Item* begin() noexcept { return v; }
317 Item* end() noexcept { return v + count; }
318 const Item* begin() const noexcept { return v; }
319 const Item* end() const noexcept { return v + count; }
321
324
325 TVector<Item>& operator+=(const Item& x) { return Add(x); }
326
328 TVector<Item>& operator-=(const Item& x) { return Remove(x); }
329
331 friend TVector<Item> operator+(TVector<Item> a, const TVector<Item>& b) { a += b; return a; }
332
334 friend bool operator==(const TVector<Item>& a, const TVector<Item>& b) { return a.Equal(b); }
335
337 friend bool operator!=(const TVector<Item>& a, const TVector<Item>& b) { return !a.Equal(b); }
339};
340
341//----------------------------------------------------------------------------
342// instanciação da variável com o conteúdo de erro
343//----------------------------------------------------------------------------
344
349template <class Item>
351
352
353
354
355//----------------------------------------------------------------------------
356// Redimensionamento interno
357//----------------------------------------------------------------------------
358
368template <class Item>
369void TVector<Item>::Size(int size)
370{
371 Item* aux = new Item[size];
372 if (v != nullptr) {
373 int limite = (count < size ? count : size);
374 for (int k = limite - 1; k >= 0; --k)
375 aux[k] = v[k];
376 delete[] v;
377 }
378 v = aux;
379 sz = size;
380}
381
382
383//----------------------------------------------------------------------------
384// Construtor com inicialização
385//----------------------------------------------------------------------------
386
387
393template <class Item>
395 : idx(nullptr), v(nullptr), sz(0), count(0)
396{
397 if (size > 0)
398 Size(size);
399}
400
401
411template <class Item>
412TVector<Item>::TVector(int size, Item const* init)
413{
414 v = nullptr;
415 sz = 0;
416 count = 0;
417 if (size > 0) {
418 Size(size);
419 for (int k = 0; k < size; ++k)
420 operator[](k) = init[k];
421 }
422}
423
429template <class Item>
431{
432 delete[] v;
433}
434
435
436template <class Item>
442{
443 *this = o;
444}
445
446template <class Item>
453{
454 if (this != &o) {
455 // garante capacidade e atualiza count
456 Count(o.count);
457 // copia elementos
458 for (int i = 0; i < o.count; ++i) {
459 v[i] = o.v[i];
460 }
461 }
462 return *this;
463}
464
465template <class Item>
472 : v(o.v), sz(o.sz), count(o.count)
473{
474 o.v = nullptr;
475 o.sz = 0;
476 o.count = 0;
477}
478
479template <class Item>
486{
487 if (this != &o) {
488 delete[] v;
489 v = o.v;
490 sz = o.sz;
491 count = o.count;
492 o.v = nullptr;
493 o.sz = 0;
494 o.count = 0;
495 }
496 return *this;
497}
498
499template <class Item>
509{
510 int oldCount = count;
511 // ajusta tamanho lógico e realoca se necessário
512 Count(oldCount + o.count);
513 // copia elementos
514 for (int k = 0; k < o.count; ++k) {
515 v[oldCount + k] = o.v[k];
516 }
517 return *this;
518}
519
520
521
522//----------------------------------------------------------------------------
523// Implementação de operator[] para auto-expansão
524//----------------------------------------------------------------------------
525
529template <class Item>
531{
532 if (i >= sz)
533 Size(2 * (i + 1));
534
535 if (i >= count)
536 count = i + 1;
537
538 return v[i];
539}
540
541
545template <class Item>
546const Item& TVector<Item>::operator[](int i) const
547{
548 if (i < 0 || i >= count)
549 return TVector<Item>::erro;
550
551 return v[i];
552}
553
554//----------------------------------------------------------------------------
555// Pesquisa de elementos
556//----------------------------------------------------------------------------
557
566template <class Item>
567int TVector<Item>::Find(Item& i, bool binary, int left, int right)
568{
569 if (binary) {
570 if (right < 0 || right > count - 1) right = count - 1;
571 if (left < 0 || left > right) left = 0;
572 while (left <= right) {
573 int mid = (left + right) >> 1;
574 if (v[mid] == i) return mid;
575 if (v[mid] < i) left = mid + 1;
576 else right = mid - 1;
577 }
578 }
579 else {
580 for (int k = 0; k < count; ++k)
581 if (v[k] == i)
582 return k;
583 }
584 return -1;
585}
586
587//----------------------------------------------------------------------------
588// Ordenação
589//----------------------------------------------------------------------------
590
596template <class Item>
598{
599 if (idxvect == nullptr) {
600 QuickSort(0, count - 1);
601 Insertion(0, count - 1);
602 }
603 else {
604 idx = idxvect;
605 idx->Count(count);
606 for (int k = 0; k < count; ++k)
607 (*idx)[k] = k;
608 QuickSortIdx(0, count - 1);
609 }
610 return *this;
611}
612
613
619template <class Item>
620void TVector<Item>::Sort(int start, int end)
621{
622 if (end > count - 1 || end < 0) end = count - 1;
623 if (start < 0) start = 0;
624 if (start < end) {
625 QuickSort(start, end);
626 Insertion(start, end);
627 }
628}
629
630
637template <class Item>
638void TVector<Item>::QuickSort(int start, int end)
639{
640 if (end - start > 32) {
641 // pivôs median-of-three
642 Exch((start + end) >> 1, end - 1);
643 if (v[end - 1] < v[start]) Exch(end - 1, start);
644 if (v[end] < v[start]) Exch(end, start);
645 if (v[end] < v[end - 1]) Exch(end, end - 1);
646
647 start++; end--;
648
649 // partição
650 int i = start - 1, j = end;
651 Item pivot = v[end];
652 for (;;) {
653 while (v[++i] < pivot);
654 while (pivot < v[--j] && j > start);
655 if (i >= j) break;
656 Exch(i, j);
657 }
658 Exch(i, end);
659
660 QuickSort(start - 1, i - 1);
661 QuickSort(i + 1, end + 1);
662 }
663}
664
665
671template <class Item>
672void TVector<Item>::Insertion(int start, int end)
673{
674 for (int i = end; i > start; --i)
675 if (v[i - 1] > v[i])
676 Exch(i - 1, i);
677
678 for (int i = start + 2; i <= end; ++i) {
679 Item tmp = v[i];
680 int j = i;
681 while (tmp < v[j - 1]) {
682 v[j] = v[j - 1];
683 --j;
684 }
685 v[j] = tmp;
686 }
687}
688
689
690
696template <class Item>
697void TVector<Item>::QuickSortIdx(int start, int end)
698{
699 if (end - start < 3) {
700 // pequenos casos
701 if (end - start == 1) {
702 if (v[(*idx)[end]] < v[(*idx)[start]])
703 ExchIdx(end, start);
704 }
705 else if (end - start == 2) {
706 if (v[(*idx)[end - 1]] < v[(*idx)[start]])
707 ExchIdx(end - 1, start);
708 if (v[(*idx)[end]] < v[(*idx)[start]])
709 ExchIdx(end, start);
710 if (v[(*idx)[end]] < v[(*idx)[end - 1]])
711 ExchIdx(end, end - 1);
712 }
713 }
714 else {
715 // pivôs median-of-three em idx
716 ExchIdx((start + end) >> 1, end - 1);
717 if (v[(*idx)[end - 1]] < v[(*idx)[start]])
718 ExchIdx(end - 1, start);
719 if (v[(*idx)[end]] < v[(*idx)[start]])
720 ExchIdx(end, start);
721 if (v[(*idx)[end]] < v[(*idx)[end - 1]])
722 ExchIdx(end, end - 1);
723
724 start++; end--;
725
726 // partição em idx
727 int i = start - 1, j = end;
728 Item pivot = v[(*idx)[end]];
729 for (;;) {
730 while (v[(*idx)[++i]] < pivot);
731 while (pivot < v[(*idx)[--j]] && j > start);
732 if (i >= j) break;
733 ExchIdx(i, j);
734 }
735 ExchIdx(i, end);
736
737 if (i > start) QuickSortIdx(start - 1, i - 1);
738 if (i < end) QuickSortIdx(i + 1, end + 1);
739 }
740}
741
742
743//----------------------------------------------------------------------------
744// Baralhar
745//----------------------------------------------------------------------------
746
751template <class Item>
753{
754 for (int k = count - 1; k > 0; --k)
755 Exch(k, TRand::rand() % (k + 1));
756 return *this;
757}
758
764template <class Item>
766{
767 int k = 0;
768 for (int w = 0; w < count; ++w) {
769 if (v[w] != i) {
770 v[k++] = v[w];
771 }
772 }
773 count = k;
774 return *this;
775}
776
777
783template <class Item>
785{
786 for (int j = 0; j < count; ++j) {
787 v[j] = i;
788 }
789 return *this;
790}
791
792
799template <class Item>
800TVector<Item>& TVector<Item>::Replace(const Item& iold, const Item& inew)
801{
802 for (int k = 0; k < count; ++k) {
803 if (v[k] == iold) {
804 v[k] = inew;
805 }
806 }
807 return *this;
808}
809
810
816template <class Item>
818{
819 for (int k = i; k < count - 1; ++k) {
820 v[k] = v[k + 1];
821 }
822 --count;
823 return *this;
824}
825
826
835template <class Item>
837{
838 if (count > 0) {
839 Sort();
840 int k = 0, w = 1;
841 while (w < count) {
842 if (v[k] != v[w]) {
843 v[++k] = v[w];
844 }
845 ++w;
846 }
847 count = k + 1;
848 }
849 return *this;
850}
851
852
858template <class Item>
860{
861 int k = 0, w = 0, s = Count();
862 while (k < other.Count()) {
863 while (w < s && operator[](w) < other[k]) {
864 ++w;
865 }
866 if (w >= s || operator[](w) > other[k]) {
867 Add(other[k++]);
868 }
869 else {
870 ++k;
871 }
872 }
873 Sort();
874 return *this;
875}
876
877
883template <class Item>
885{
886 int k = 0, w = 0, z = 0;
887 while (k < other.Count() && w < Count()) {
888 if (operator[](w) < other[k]) {
889 ++w;
890 }
891 else if (operator[](w) == other[k]) {
892 v[z++] = v[w++];
893 ++k;
894 }
895 else {
896 ++k;
897 }
898 }
899 Count(z);
900 return *this;
901}
902
903
909template <class Item>
911{
912 int k = 0, w = 0, z = 0;
913 while (k < other.Count() && w < Count()) {
914 if (v[w] < other[k]) {
915 v[z++] = v[w++];
916 }
917 else if (v[w] == other[k]) {
918 ++w; ++k;
919 }
920 else {
921 ++k;
922 }
923 }
924 while (w < Count()) {
925 v[z++] = v[w++];
926 }
927 Count(z);
928 return *this;
929}
930
936template <class Item>
937bool TVector<Item>::Equal(const TVector<Item>& other) const
938{
939 if (count != other.Count()) return false;
940 for (int k = 0; k < count; ++k) {
941 if (v[k] != other[k]) return false;
942 }
943 return true;
944}
945
946
952template <class Item>
954{
955 if (count > other.Count()) return false;
956 int k2 = 0;
957 for (int k = 0; k < count; ++k) {
958 while (k2 < other.Count() && v[k2] < v[k]) {
959 ++k2;
960 }
961 if (k2 >= other.Count() || other[k2] != v[k]) {
962 return false;
963 }
964 }
965 return true;
966}
967
968
975template <class Item>
977{
978 if (index < 0) index = Count();
979 int w = src.Count();
980 if (w > 0) {
981 int oldCount = Count();
982 Count(oldCount + w);
983 if (index > oldCount) index = oldCount;
984 for (int k = oldCount - 1; k >= index; --k) {
985 v[k + w] = v[k];
986 }
987 for (int k = 0; k < w; ++k) {
988 v[index + k] = src[k];
989 }
990 }
991 return *this;
992}
993
994
1001template <class Item>
1003{
1004 if (index < 0) index = Count();
1005 int oldCount = Count();
1006 Count(oldCount + 1);
1007 if (index > oldCount) index = oldCount;
1008 for (int k = oldCount - 1; k >= index; --k) {
1009 v[k + 1] = v[k];
1010 }
1011 v[index] = a;
1012 return *this;
1013}
1014
1019template <class Item>
1021{
1022 for (int k = 0; k < count / 2; ++k) {
1023 Exch(k, count - 1 - k);
1024 }
1025 return *this;
1026}
1027
1028
1039template <class Item>
1041{
1042 int result = 0;
1043 int n1 = Count(), n2 = other.Count();
1044
1045 if (type == 0) {
1046 result = abs(n1 - n2);
1047 int m = Min(n1, n2);
1048 for (int i = 0; i < m; ++i) {
1049 if (v[i] != other[i]) ++result;
1050 }
1051 }
1052 else if (type == 1) {
1053 int m = Min(n1, n2);
1054 for (int i = 0; i < m; ++i) {
1055 result += abs(v[i] - other[i]);
1056 }
1057 }
1058 else if (type == 2) {
1059 result = Max(n1, n2);
1060 for (int i = 0; i + 1 < n1; ++i) {
1061 int j = other.Find(v[i]);
1062 if (j >= 0 && j + 1 < n2 && v[i + 1] == other[j + 1]) {
1063 --result;
1064 }
1065 }
1066 }
1067 else if (type == 3) {
1068 int rows = n1 + 1, cols = n2 + 1;
1069 TVector<int> mtx(rows * cols);
1070 // inicialização da matriz
1071 for (int i = 0; i < rows; ++i) mtx[i] = i;
1072 for (int j = 1; j < cols; ++j) mtx[j * rows] = j;
1073 // cálculo da distância de edição
1074 for (int i = 1; i < rows; ++i) {
1075 for (int j = 1; j < cols; ++j) {
1076 int cost = (v[i - 1] == other[j - 1] ? 0 : 1);
1077 int val = mtx[(i - 1) + rows * (j - 1)] + cost;
1078 val = Min(val, mtx[(i - 1) + rows * j] + 1);
1079 val = Min(val, mtx[i + rows * (j - 1)] + 1);
1080 mtx[i + rows * j] = val;
1081 }
1082 }
1083 result = mtx[n1 + rows * n2];
1084 }
1085
1086 return result;
1087}
1088
1089template<>
1090inline TVector<int>::TVector(const char* str) {
1091 char buf[256] = "", * bufferGrande = nullptr;
1092 char* token = buf;
1093 char* pt;
1094 size_t tamanho = 0;
1095 if (!str || *str == '\0')
1096 return;
1097
1098 if ((tamanho = (int)strlen(str)) < 256)
1099 snprintf(buf, sizeof(buf), "%s", str);
1100 else {
1101 if ((bufferGrande = new char[tamanho + 1]) == nullptr)
1102 return;
1103 snprintf(bufferGrande, tamanho + 1, "%s", str);
1104 token = bufferGrande;
1105 }
1106
1107 // separar por vírgulas
1108 if ((pt = strchr(token, ','))) {
1109 *pt = 0;
1110 *this = TVector(token);
1111 do {
1112 token = pt + 1;
1113 if ((pt = strchr(token, ',')))
1114 *pt = 0;
1115 *this += TVector(token);
1116 } while (pt);
1117 }
1118 else {
1119 // procurar por : (intervalo)
1120 if ((pt = strchr(token, ':'))) {
1121 char* pt2;
1122 *pt = 0;
1123 int A = atoi(token);
1124 int C = 1;
1125 if ((pt2 = strchr(pt + 1, ':'))) { // A:B:C
1126 *pt2 = 0;
1127 if ((C = atoi(pt2 + 1)) <= 0)
1128 C = 1;
1129 } // c.c. A:B
1130 int B = atoi(pt + 1);
1131 if (A > B) { // ordem não interessa
1132 int aux = A;
1133 A = B;
1134 B = aux;
1135 }
1136 for (int i = A; i <= B; i += C)
1137 *this += i;
1138 }
1139 else // inteiro apenas
1140 *this += atoi(token);
1141 }
1142 BeASet();
1143 if (bufferGrande)
1144 delete[] bufferGrande;
1145}
1146
1147template<>
1148inline TVector<int>& TVector<int>::operator+=(const char* str) {
1149 *this += TVector<int>(str);
1150 return *this;
1151}
1152
1153// permite fazer for(auto x : _TV("1:10,15:50:3,73")) printf("%d ", x);
1154inline TVector<int> _TV(const char* str) {
1155 return TVector<int>(str);
1156}
Interface para geração de números aleatórios independentes do sistema operativo.
TVector< int > _TV(const char *str)
Definition TVector.h:1154
friend bool operator!=(const TVector< Item > &a, const TVector< Item > &b)
Definition TVector.h:337
Item * end() noexcept
Definition TVector.h:317
Item & First()
Definition TVector.h:221
TVector< Item > & Count(int value)
Ajusta o tamanho lógico do vetor para value.
Definition TVector.h:241
TVector< Item > & BeASet()
Converte o vetor num conjunto: remove duplicados e ordena.
Definition TVector.h:836
virtual ~TVector() noexcept
Destrutor.
Definition TVector.h:430
static Item erro
Valor retornado em casos de acesso inválido.
Definition TVector.h:59
bool Equal(const TVector< Item > &v) const
Verifica se dois vetores-conjunto são iguais.
Definition TVector.h:937
friend TVector< Item > operator+(TVector< Item > a, const TVector< Item > &b)
Definition TVector.h:331
TVector & operator=(TVector &&o) noexcept
Operador de atribuição por movimentação.
Definition TVector.h:485
Item & Pop()
Definition TVector.h:190
TVector< Item > & Replace(Item const &iold, Item const &inew)
Substitui todas as ocorrências de um valor antigo por um novo.
Definition TVector.h:800
Item & operator[](int i)
Acesso por índice com auto-expansão.
Definition TVector.h:530
TVector & operator=(const TVector &o)
Operador de atribuição por cópia.
Definition TVector.h:452
TVector< Item > & operator+=(const char *str)
Acrescenta elementos a partir de uma string no formato de lista.
Definition TVector.h:171
const Item * begin() const noexcept
Definition TVector.h:318
bool Empty() const
Definition TVector.h:230
TVector< Item > & Insert(TVector< Item > &v, int index=0)
Insere um vetor de itens na posição indicada.
Definition TVector.h:976
TVector< Item > & RandomOrder()
Coloca os elementos em ordem aleatória (Fisher–Yates shuffle).
Definition TVector.h:752
TVector< Item > & Difference(const TVector< Item > &v)
Diferença deste conjunto em relação a outro.
Definition TVector.h:910
TVector< Item > & Sort(TVector< int > *idxvect=nullptr)
Ordena todo o vetor, opcionalmente devolvendo índices ordenados.
Definition TVector.h:597
TVector< Item > & operator+=(const Item &x)
Definition TVector.h:325
Item & Random()
Definition TVector.h:250
TVector & operator+=(const TVector &o)
Concatena outro vetor a este.
Definition TVector.h:508
TVector< Item > & operator-=(const Item &x)
Definition TVector.h:328
friend bool operator==(const TVector< Item > &a, const TVector< Item > &b)
Definition TVector.h:334
TVector(const char *str)
Constrói um vetor de inteiros a partir de uma string no formato de lista.
Definition TVector.h:126
TVector< Item > & Remove(Item const &i)
Remove todas as ocorrências de um dado elemento.
Definition TVector.h:765
TVector & operator+=(std::initializer_list< Item > init)
Adiciona múltiplos elementos ao final do vetor.
Definition TVector.h:152
int Distance(TVector< Item > &v, int type=0)
Calcula várias métricas de “distância” entre vetores.
Definition TVector.h:1040
TVector< Item > & Intersection(const TVector< Item > &v)
Interseção deste conjunto com outro.
Definition TVector.h:884
const Item & operator[](int i) const
Acesso constante por índice sem modificação de tamanho.
Definition TVector.h:546
const Item * Data() const
Acesso direto constante.
Definition TVector.h:218
bool Contained(const TVector< Item > &v) const
Verifica se este conjunto está contido no outro.
Definition TVector.h:953
TVector< Item > & Add(Item a)
Definition TVector.h:178
Item & Last()
Definition TVector.h:224
TVector< Item > & Reset(Item const &i)
Preenche todo o vetor com um mesmo valor.
Definition TVector.h:784
TVector< Item > & Invert()
Inverte a ordem dos elementos no vetor.
Definition TVector.h:1020
TVector< Item > & Insert(Item a, int index=0)
Insere um único elemento na posição indicada.
Definition TVector.h:1002
void Sort(int start, int end=-1)
Ordena um subintervalo [start,end] do vetor.
Definition TVector.h:620
TVector< Item > & Delete(int i)
Remove o elemento na posição i deslocando os seguintes.
Definition TVector.h:817
Item * begin() noexcept
Definition TVector.h:316
int Count() const
Definition TVector.h:227
Item * Data()
Acesso direto.
Definition TVector.h:216
int Find(Item &i, bool binary=false, int left=0, int right=-1)
Procura um elemento no vetor.
Definition TVector.h:567
TVector(int size, Item const *init)
Constrói um vetor pré-carregado a partir de um array.
Definition TVector.h:412
TVector< Item > & Union(const TVector< Item > &v)
Realiza a união deste conjunto com outro.
Definition TVector.h:859
TVector(int size=0)
Construtor.
Definition TVector.h:394
const Item * end() const noexcept
Definition TVector.h:319
TVector< Item > & Push(Item a)
Definition TVector.h:187
unsigned int rand(int seq)
Retorna o próximo valor pseudo-aleatório.
Definition TRand.cpp:46