Commit 82f7cb57 authored by Alexis Lebis's avatar Alexis Lebis

tools.h new function getElementById

parent fa4eea0f
......@@ -40,6 +40,17 @@ static bool duplicataFlag(std::vector<T> & toProtect, T & toAdd)
}
template<typename T>
static std::pair<bool,T> getElementById(const std::vector<T> & elem, int idToFind)
{
for(int i = 0; i < elem.size(); i++)
{
if(elem.at(i).id() == idToFind)
return std::pair<bool,T>(true, elem.at(i));
}
return std::pair<bool, T>(false, T());
}
///Not working properly yet, just for debug
// static std::queue<int> RNG_QUEUE;
// /**Init a queue of size s from 0 to s, then shuffle it*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment