mirror of
https://bitbucket.org/Mattrixwv/my-classes.git
synced 2025-12-06 18:23:57 -05:00
Changed isFound to use functions in the STL
This commit is contained in:
@@ -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
|
//This is a function that searches a vecter for an element. Returns true if they key is found in list
|
||||||
template <class T>
|
template <class T>
|
||||||
bool isFound(std::vector<T> ary, T key){
|
bool isFound(std::vector<T> ary, T key){
|
||||||
for(int cnt = 0;cnt < ary.size();++cnt){
|
std::vector<T>::iterator location = std::find(ary.begin(), ary.end(), key);
|
||||||
if(ary.at(cnt) == key){
|
if(location == ary.end()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//This is a function that creates all permutations of a string and returns a vector of those permutations.
|
//This is a function that creates all permutations of a string and returns a vector of those permutations.
|
||||||
|
|||||||
Reference in New Issue
Block a user