replaced predicate usage (with an if clause) in getSubSet by the function copy_if