74 template <
typename T>
inline bool contains(
const std::vector<T>& k,
const T& kk)
noexcept;
83 template <
typename T>
inline int count(
const std::vector<T>& k,
const T& kk)
noexcept;
92 template <
typename T>
inline std::vector<T>&
unique(std::vector<T>& c,
const std::vector<T>& k);
100 template <
typename T>
inline std::vector<T>&
unique(std::vector<T>& k);
108 template <
typename T>
inline std::vector<T>
unique(std::vector<T>&& k);
117 template <
typename T>
inline std::vector<T>&
sort(std::vector<T>& c,
const std::vector<T>& k);
125 template <
typename T>
inline std::vector<T>&
sort(std::vector<T>& k);
133 template <
typename T>
inline std::vector<T>
sort(std::vector<T>&& k);
142 template <
typename T>
inline std::vector<T>&
rsort(std::vector<T>& c,
const std::vector<T>& k);
150 template <
typename T>
inline std::vector<T>&
rsort(std::vector<T>& k);
158 template <
typename T>
inline std::vector<T>
rsort(std::vector<T>&& k);
167 template <
typename T>
inline std::vector<T>&
reverse(std::vector<T>& c,
const std::vector<T>& k);
175 template <
typename T>
inline std::vector<T>&
reverse(std::vector<T>& k);
183 template <
typename T>
inline std::vector<T>
reverse(std::vector<T>&& k);
193 template <
typename T>
inline std::vector<T>&
sunion(std::vector<T>& c,
const std::vector<T>& k,
const std::vector<T>& kk);
202 template <
typename T>
inline std::vector<T>
sunion(
const std::vector<T>& k,
const std::vector<T>& kk);
211 template <
typename T>
inline std::vector<T>
sunion(std::vector<T>&& k,
const std::vector<T>&& kk);
221 template <
typename T>
inline std::vector<T>&
intersection(std::vector<T>& c,
const std::vector<T>& k,
const std::vector<T>& kk);
230 template <
typename T>
inline std::vector<T>
intersection(
const std::vector<T>& k,
const std::vector<T>& kk);
239 template <
typename T>
inline std::vector<T>
intersection(std::vector<T>&& k,
const std::vector<T>&& kk);
249 template <
typename T>
inline std::vector<T>&
diff(std::vector<T>& c,
const std::vector<T>& k,
const std::vector<T>& kk);
258 template <
typename T>
inline std::vector<T>
diff(
const std::vector<T>& k,
const std::vector<T>& kk);
267 template <
typename T>
inline std::vector<T>
diff(std::vector<T>&& k,
const std::vector<T>&& kk);
277 template <
typename T>
inline std::vector<T>&
sdiff(std::vector<T>& c,
const std::vector<T>& k,
const std::vector<T>& kk);
286 template <
typename T>
inline std::vector<T>
sdiff(
const std::vector<T>& k,
const std::vector<T>& kk);
295 template <
typename T>
inline std::vector<T>
sdiff(std::vector<T>&& k,
const std::vector<T>&& kk);
301 for (
const T& v: k) {
if(v == kk) {
return true;}}
307inline int set::count(
const std::vector<T>& k,
const T& kk)
noexcept {
309 for (
const T& v: k) {
if(v == kk) {c++;}}
315inline std::vector<T>&
set::unique(std::vector<T>& c,
const std::vector<T>& k) {
316 for (
const T& v: k) {
if(!
set::contains(c, v)) {c.push_back(v);}}
339inline std::vector<T>&
set::sort(std::vector<T>& c,
const std::vector<T>& k) {
341 std::sort(c.begin(), c.end());
348 std::sort(k.begin(), k.end());
355 std::sort(k.begin(), k.end());
361inline std::vector<T>&
set::rsort(std::vector<T>& c,
const std::vector<T>& k) {
363 std::sort(c.begin(), c.end(), std::greater<T>());
370 std::sort(k.begin(), k.end(), std::greater<T>());
377 std::sort(k.begin(), k.end(), std::greater<T>());
383inline std::vector<T>&
set::reverse(std::vector<T>& c,
const std::vector<T>& k) {
385 for (
unsigned int i = 0; i < (k.size() / 2); i++) {std::swap(c[i], c[c.size() - i - 1]);}
392 for (
unsigned int i = 0; i < (k.size() / 2); i++) {std::swap(k[i], k[k.size() - i - 1]);}
399 for (
unsigned int i = 0; i < (k.size() / 2); i++) {std::swap(k[i], k[k.size() - i - 1]);}
405inline std::vector<T>&
set::sunion(std::vector<T>& c,
const std::vector<T>& k,
const std::vector<T>& kk) {
406 for (
const T& v: k) {
if(!
set::contains(c, v)) {c.push_back(v);}}
407 for (
const T& vv: kk) {
if(!
set::contains(c, vv)) {c.push_back(vv);}}
413inline std::vector<T>
set::sunion(
const std::vector<T>& k,
const std::vector<T>& kk) {
421inline std::vector<T>
set::sunion(std::vector<T>&& k, std::vector<T>&& kk) {
429inline std::vector<T>&
set::intersection(std::vector<T>& c,
const std::vector<T>& k,
const std::vector<T>& kk) {
445inline std::vector<T>
set::intersection(std::vector<T>&& k, std::vector<T>&& kk) {
453inline std::vector<T>&
set::diff(std::vector<T>& c,
const std::vector<T>& k,
const std::vector<T>& kk) {
454 for (
const T& v: k) {
if(!
contains(kk, v)) {c.push_back(v);}}
460inline std::vector<T>
set::diff(
const std::vector<T>& k,
const std::vector<T>& kk) {
468inline std::vector<T>
set::diff(std::vector<T>&& k, std::vector<T>&& kk) {
476inline std::vector<T>&
set::sdiff(std::vector<T>& c,
const std::vector<T>& k,
const std::vector<T>& kk) {
484inline std::vector<T>
set::sdiff(
const std::vector<T>& k,
const std::vector<T>& kk) {
492inline std::vector<T>
set::sdiff(std::vector<T>&& k, std::vector<T>&& kk) {
Contains all the functions for performing set operations on std::vector.
std::vector< T > & diff(std::vector< T > &c, const std::vector< T > &k, const std::vector< T > &kk)
Obtains the set theory difference of two sets.
bool contains(const std::vector< T > &k, const T &kk) noexcept
Checks if an element is present in the set.
std::vector< T > & sdiff(std::vector< T > &c, const std::vector< T > &k, const std::vector< T > &kk)
Obtains the set theory symmetric difference of two sets.
std::vector< T > & intersection(std::vector< T > &c, const std::vector< T > &k, const std::vector< T > &kk)
Obtains the set theory intersection of two sets.
std::vector< T > & rsort(std::vector< T > &c, const std::vector< T > &k)
Sorts a set in descending order.
int count(const std::vector< T > &k, const T &kk) noexcept
Counts the number of times an element is present in the set.
std::vector< T > & unique(std::vector< T > &c, const std::vector< T > &k)
Removes duplicates from a set.
std::vector< T > & sort(std::vector< T > &c, const std::vector< T > &k)
Sorts a set in ascending order.
std::vector< T > & reverse(std::vector< T > &c, const std::vector< T > &k)
Reverses the passed set.
std::vector< T > & sunion(std::vector< T > &c, const std::vector< T > &k, const std::vector< T > &kk)
Obtains the set theory union of two sets.