June 2017
Intermediate to advanced
532 pages
12h 59m
English
In this section, we will implement a terminal app, which accepts some input and then tries to guess what the user might want to look for, based on a cheap text file database:
#include <iostream> #include <optional> #include <algorithm> #include <functional> #include <iterator> #include <map> #include <list> #include <string> #include <sstream> #include <fstream> using namespace std;
template <typename T> class trie { map<T, trie> tries; public: template <typename It> void insert(It it, It end_it) { if (it == end_it) { return; } tries[*it].insert(next(it), end_it); } template <typename C> ...Read now
Unlock full access