diff --git a/Algorithms.hpp b/Algorithms.hpp index a0d869c..a536251 100644 --- a/Algorithms.hpp +++ b/Algorithms.hpp @@ -260,12 +260,13 @@ T getProduct(const std::vector& ary){ //This is a function that searches a vecter for an element. Returns true if they key is found in list template bool isFound(std::vector ary, T key){ - for(int cnt = 0;cnt < ary.size();++cnt){ - if(ary.at(cnt) == key){ - return true; - } + std::vector::iterator location = std::find(ary.begin(), ary.end(), key); + if(location == ary.end()){ + return false; + } + else{ + return true; } - return false; } //This is a function that creates all permutations of a string and returns a vector of those permutations.