TagKeyBasedOsmElementsFilter comes with filter types AcceptMatching and RemoveMatching. Function accept_by_tags checks for this type on each processed element. This check can be done once, when constructing the filter, e.g., by providing two struct implementations TagKeyBasedAcceptFilter and TagKeyBasedRemoveFilter.