2 #include <samchon/library/CaseGenerator.hpp> 24 std::vector<size_t> dividers;
35 this->
size_ = (size_t)pow(n, r);
37 dividers.assign(r, 0);
38 for (
size_t i = 0; i <
r; i++)
40 size_t x = r - (i + 1);
41 dividers[i] = (size_t)pow(n, x);
46 virtual auto operator[](
size_t index)
const->std::vector<
size_t>
override 48 std::vector<size_t> row(
r_, 0);
50 for (
size_t i = 0; i < row.size(); i++)
51 row[i] = (index / dividers[i]) %
n_;
A combined-permutation case generator.
size_t size_
Size, the number of all cases.
size_t r_
R, size of elements of each case.
size_t n_
N, size of the candidates.
CombinedPermutationGenerator(size_t n, size_t r)
Construct from size of N and R.
auto r() const -> size_t
Get size of the R.
virtual auto operator[](size_t index) const -> std::vector< size_t > override
Get x'th case.
auto n() const -> size_t
Get size of the N.