From 3d340762de6cf1fa72f462a81bf0cc37bf0268f3 Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Mon, 14 May 2018 15:47:33 -0400 Subject: [PATCH] Re-removed the clear checks for the class strings when adding to them --- SourceFiles/Vigenere.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/SourceFiles/Vigenere.cpp b/SourceFiles/Vigenere.cpp index 9080e58..b7d2bfd 100644 --- a/SourceFiles/Vigenere.cpp +++ b/SourceFiles/Vigenere.cpp @@ -79,6 +79,8 @@ void Vigenere::setKeyword(std::string key){ } //If it is not a letter ignore it } + //Make sure offset is empty before adding to it + offset.clear(); setOffset(); } @@ -96,8 +98,6 @@ std::string Vigenere::getKeyword() const{ * */ void Vigenere::setOffset(){ - //Make sure offset is empty - offset.clear(); //Reserve the correct size to increase speed later offset.reserve(keyword.size()); @@ -123,7 +123,6 @@ std::vector Vigenere::getOffsets() const{ * @return The encoded message */ std::string Vigenere::encode(){ - outputString = ""; //Reserve the correct size for the output string to increase speed for longer messages outputString.reserve(inputString.size()); @@ -168,7 +167,6 @@ std::string Vigenere::encode(std::string key, std::string input){ * @return The decoded message */ std::string Vigenere::decode(){ - outputString = ""; //Reserve the correct size for the output string to increase speed for longer messages outputString.reserve(inputString.size());