summaryrefslogtreecommitdiff
path: root/src/utils/cpp/vector.hpp
blob: e21f49ccd68859c3cbc8638a7ddc16ff36cbb6f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef INCLUDED_SRC_UTILS_CPP_VECTOR_HPP
#define INCLUDED_SRC_UTILS_CPP_VECTOR_HPP

// small library to manipulate vectors
#include <vector>

// sort the passed vector and remove repeated entries
template <typename T>
void sort_and_deduplicate(std::vector<T>* x) {
    std::sort(x->begin(), x->end());
    auto it = std::unique(x->begin(), x->end());
    x->erase(it, x->end());
}
#endif