From 2c734470d583193ed3c014d023f099ae3bf583db Mon Sep 17 00:00:00 2001 From: Gil Date: Thu, 13 Dec 2018 11:25:40 +0000 Subject: [PATCH] filter method for ParametersMap --- src/shogun/base/SGObject.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/shogun/base/SGObject.cpp b/src/shogun/base/SGObject.cpp index 155e8821d92..b830153aeee 100644 --- a/src/shogun/base/SGObject.cpp +++ b/src/shogun/base/SGObject.cpp @@ -90,6 +90,17 @@ namespace shogun return map.find(tag) != map.end(); } + ParametersMap filter(ParameterProperties pprop) const { + ParametersMap result; + std::copy_if(map.cbegin(), map.cend(), + std::inserter(result, result.end()), + [&pprop](const std::pair& each) + { + return each.second.get_properties().has_property(pprop); + }); + return result; + } + ParametersMap map; };