FEAT: Added assign and resize functions

API: Fixed CMAKELISTS.txt to work without the encapsulation as it will not work or be viable right now
This commit is contained in:
Andrew Haynes
2026-05-31 21:15:58 -04:00
parent aa7d2f37bf
commit 261e672237
4 changed files with 163 additions and 16 deletions
+35 -5
View File
@@ -15,7 +15,7 @@
#include <stddef.h>
#include <stdio.h>
#include "lib/char/char.h"
#include "char.h"
int
main()
@@ -27,18 +27,48 @@ main()
{
vec = add_back(&vec, 'a');
}
print_vec(&vec);
printf("\n");
for (int i = 0; i < 5; i++)
{
other = add_back(&other, 'b');
}
print_vec(&other);
printf("Vec: ");
print_vec(&vec);
printf("\n");
pop_back(&vec);
printf("Vec: ");
// for (int i = 0; i < vec.size; i++)
// {
// printf("%i ", at(&vec, i));
// }
print_vec(&vec);
printf("\n");
// vec = resize(&vec, 12, 'a');
printf("Vec: ");
vec = assign(&vec, &other, begin(&other) + 2, end(&other) + 1);
vec = shrink_to_fit(&vec);
print_vec(&vec);
// for (int i = 0; i < vec.size; i++)
// {
// printf("%i ", at(&vec, i));
// }
// printf("\n");
// print_vec(&vec);
// pop_back(&vec);
// printf("Other: ");
// print_vec(&other);
// printf("\n");
//
// printf("Vec: ");
// print_vec(&vec);
// printf("\n");
// pop_back(&vec);
// printf("Other: ");
// print_vec(&other);
// printf("\n");
//
// int error = swap(&vec, &other);
// if (error)
// {