From a7127a63cc025ab3b95cde125a7c0db552603862 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 23 Nov 2015 18:02:47 -0500 Subject: std::set seems to have some problem with inserting an empty string. Warrants further investigation. --- malaprop.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'malaprop.cpp') diff --git a/malaprop.cpp b/malaprop.cpp index bfea579..7fbdb6c 100644 --- a/malaprop.cpp +++ b/malaprop.cpp @@ -1,6 +1,8 @@ #include "malaprop.h" #include #include +#include +#include bool removeIfM(char c) { @@ -87,8 +89,11 @@ malaprop::soundex malaprop::soundify(std::string f) void malaprop::addWord(std::string word) { soundex ex = soundify(word); - - dict[ex].insert(canonizetwo(word)); + + if (ex.prefix != 0) + { + dict[ex].insert(canonizetwo(word)); + } } void malaprop::stats() -- cgit 1.4.1