6 std::vector<T>
slice(
const std::vector<T>& v,
const size_t start,
const int len) {
18 std::copy(v.begin() + start, v.begin()+start+len, out.begin());
24 std::vector<T>
slice(
const std::vector<T> &v,
const size_t start) {
33 return slice(v, start, v.size()-start);
67 void glom(std::vector<std::vector<T>*>& X, std::vector<T>*& v) {
83 std::vector<T>* match =
nullptr;
85 if(
is_prefix(*x, *v) and x->size() > mx) {
92 if(match !=
nullptr) {
95 for(
size_t i=mx;i<v->size();i++)
96 match->push_back(v->at(i));
void glom(std::vector< std::vector< T > *> &X, std::vector< T > *&v)
Glom here takes a vector of pointers to vectors. It searches through X to find if anything matches th...
Definition: Vectors.h:67
size_t count(const std::string &str, const std::string &sub)
Definition: Strings.h:153
std::vector< T > slice(const std::vector< T > &v, const size_t start, const int len)
Definition: Vectors.h:6
bool is_prefix(const T &prefix, const T &x)
Check if prefix is a prefix of x – works with iterables, including strings and vectors.
Definition: Strings.h:39
void increment(std::vector< T > &v, const size_t idx, T count=1)
Definition: Vectors.h:37