Changed isFound to use functions in the STL

This commit is contained in:
2019-08-18 11:53:05 -04:00
parent 89245b00f5
commit 242a2016d6

View File

@@ -260,12 +260,13 @@ T getProduct(const std::vector<T>& ary){
//This is a function that searches a vecter for an element. Returns true if they key is found in list
template <class T>
bool isFound(std::vector<T> ary, T key){
for(int cnt = 0;cnt < ary.size();++cnt){
if(ary.at(cnt) == key){
return true;
}
std::vector<T>::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.