Mercurial > hg > orthanc
diff OrthancFramework/Sources/Toolbox.h @ 5379:b31c73bc7cb6
Toolbox : more set functions
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 31 Aug 2023 15:20:41 +0200 |
parents | daf4807631c5 |
children | 1c3b0cf341f0 |
line wrap: on
line diff
--- a/OrthancFramework/Sources/Toolbox.h Thu Aug 24 16:35:55 2023 +0200 +++ b/OrthancFramework/Sources/Toolbox.h Thu Aug 31 15:20:41 2023 +0200 @@ -259,6 +259,22 @@ } } + // returns true if all element of 'needles' are found in 'haystack' + template <typename T> static void GetIntersection(std::set<T>& target, const std::set<T>& a, const std::set<T>& b) + { + target.clear(); + + for (typename std::set<T>::const_iterator it = a.begin(); + it != a.end(); ++it) + { + if (b.count(*it) > 0) + { + target.insert(*it); + } + } + } + + #if ORTHANC_ENABLE_PUGIXML == 1 static void JsonToXml(std::string& target, const Json::Value& source,