Functor used to determine whether the prefix of length 'compareLength' of two words are the same
| 29 | |
| 30 | // Functor used to determine whether the prefix of length 'compareLength' of two words are the same |
| 31 | struct CompareStringPrefix { |
| 32 | CompareStringPrefix( int compareLength ) : mCompareLength( compareLength ){} |
| 33 | |
| 34 | bool operator()( string test1, string test2 ) const { |
| 35 | return strncmp( test1.c_str(), test2.c_str(), mCompareLength ) < 0; |
| 36 | } |
| 37 | |
| 38 | int mCompareLength; |
| 39 | }; |
| 40 | |
| 41 | vector<string> Dictionary::getDescendants( const string &word ) const |
| 42 | { |