CSuffixTrie::StringsSet CSuffixTrie::GetAllStringsSet()const { //We will convert the vector StringsVector aVector(GetAllStringsVector()); //Our set StringsSet aSet; //Iterate it for (int iCount=0; iCount<aVector.size(); ++iCount) //Insert to the set aSet.insert(aVector[iCount]); //Done return aSet; }
static void normalizeLines(Strings& in, StringsSet& out, bool sortWords, bool ignoreBlankLines, char wordsep = ' ') { Strings::iterator begin = in.begin(), end = in.end(), i = begin, o = begin; for (; i != end; ++i) { std::string& line = *i; normalizeLine(line, sortWords, wordsep); bool empty = ignoreBlankLines && line.empty(); if (!empty) { out.insert(line); if (i != o) *o = std::move(*i); ++o; } } in.erase(o, end); }
StringsSet difference(StringsSet const& a, StringsSet const& b) { StringsSet a_minus_b; std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(a_minus_b, a_minus_b.end())); return a_minus_b; }