Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic CSGObject methods #4432

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/shogun/base/SGObject.cpp
Expand Up @@ -90,6 +90,17 @@ namespace shogun
return map.find(tag) != map.end();
}

ParametersMap filter(ParameterProperties pprop) const {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this just as an internal filter method?
Sounds like a good idea to me!
Merge?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stuff like this should though be hidden from outside (as done here)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, should work fine, just need to write a test for it!

ParametersMap result;
std::copy_if(map.cbegin(), map.cend(),
std::inserter(result, result.end()),
[&pprop](const std::pair<BaseTag, AnyParameter>& each)
{
return each.second.get_properties().has_property(pprop);
});
return result;
}

ParametersMap map;
};

Expand Down