42# include <gsl/gsl_rng.h>
54# include <gtest/gtest.h>
62using namespace std::chrono;
63using namespace testing;
67 vector <int>
a = {3, 2, 1, 0, 4, 5, 6, 7, 8, 9};
68 Array <int>
b = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
69 Array <string>
c = {
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j"};
77 for (
int i = 0;
i < n;
i++)
105 ASSERT_EQ(a, vector<int>({ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }));
107 ASSERT_EQ(
to_vector(b), vector<int>({ 3, 2, 1, 0, 4, 5, 6, 7, 8, 9 }));
110 vector<string>({
"d",
"c",
"b",
"a",
"e",
"f",
"g",
"h",
"i",
"j"}));
115 auto start = high_resolution_clock::now();
116 in_place_multisort_arrays(std::less <int>(), a, b, c, d, e, f, g,
h, i, j);
117 auto stop = high_resolution_clock::now();
119 cout <<
"Time taken by function: "
125 vector<int> keys = {2, 1, 2, 1, 2};
138 vector<int> keys = {1, 0};
139 vector<int> aux = {10};
Conversion utilities between Aleph-w containers and STL containers.
String manipulation utilities.
High-level sorting functions for Aleph containers.
Main namespace for Aleph-w library functions.
void in_place_multisort_arrays(Cmp cmp, C &first, Args &... args)
Sorts multiple arrays in place, using the first array as the key.
DynArray< T > sort(const DynArray< T > &a, Cmp &&cmp=Cmp())
Returns a sorted copy of a DynArray.
std::vector< typename C::Item_Type > to_vector(const C &c)
Convert a container to a std::vector.
DynList< T > maps(const C &c, Op op)
Classic map operation.
TEST_F(SimpleArray, sort)
static vector< int > rand_vec(int n, const gsl_rng *rng)