From: Tim King Date: Mon, 1 Feb 2016 18:59:49 +0000 (-0800) Subject: Making the references to std more explicit in didyoumean.cpp. X-Git-Tag: cvc5-1.0.0~6100 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2ce56a3c2f094b176e913720c1a34e92e810cec9;p=cvc5.git Making the references to std more explicit in didyoumean.cpp. --- diff --git a/src/options/didyoumean.cpp b/src/options/didyoumean.cpp index 573ee913f..1066c7a1f 100644 --- a/src/options/didyoumean.cpp +++ b/src/options/didyoumean.cpp @@ -20,20 +20,22 @@ #include "options/didyoumean.h" #include +#include #include +#include +#include -using namespace std; namespace CVC4 { -vector DidYouMean::getMatch(string input) { +std::vector DidYouMean::getMatch(std::string input) { /** Magic numbers */ const int similarityThreshold = 7; const unsigned numMatchesThreshold = 10; - set< pair > scores; - vector ret; + std::set< std::pair > scores; + std::vector ret; for(typeof(d_words.begin()) it = d_words.begin(); it != d_words.end(); ++it) { - string s = (*it); + std::string s = (*it); if( s == input ) { // if input matches AS-IS just return that ret.push_back(s); @@ -60,7 +62,9 @@ vector DidYouMean::getMatch(string input) { #endif } } - if(ret.size() > numMatchesThreshold ) ret.resize(numMatchesThreshold);; + if(ret.size() > numMatchesThreshold ){ + ret.resize(numMatchesThreshold); + } return ret; } @@ -137,11 +141,11 @@ int DidYouMean::editDistance(const std::string& a, const std::string& b) return result; } -string DidYouMean::getMatchAsString(string input, int prefixNewLines, int suffixNewLines) { - vector matches = getMatch(input); - ostringstream oss; +std::string DidYouMean::getMatchAsString(std::string input, int prefixNewLines, int suffixNewLines) { + std::vector matches = getMatch(input); + std::ostringstream oss; if(matches.size() > 0) { - while(prefixNewLines --> 0) { oss << endl; } + while(prefixNewLines --> 0) { oss << std::endl; } if(matches.size() == 1) { oss << "Did you mean this?"; } else { @@ -150,8 +154,9 @@ string DidYouMean::getMatchAsString(string input, int prefixNewLines, int suffix for(unsigned i = 0; i < matches.size(); ++i) { oss << "\n " << matches[i]; } - while(suffixNewLines --> 0) { oss << endl; } + while(suffixNewLines --> 0) { oss << std::endl; } } return oss.str(); } + }/* CVC4 namespace */