1 #ifndef CommonTools_UtilAlgos_AssociationVectorSelector_h
2 #define CommonTools_UtilAlgos_AssociationVectorSelector_h
15 template <
typename KeyRefProd,
typename CVal,
typename KeySelector = AnySelector,
typename ValSelector = AnySelector>
35 template <
typename KeyRefProd,
typename CVal,
typename KeySelector,
typename ValSelector>
42 produces<collection_t>().setBranchAlias(
alias);
43 produces<association_t>().setBranchAlias(
alias +
"Association");
46 template <
typename KeyRefProd,
typename CVal,
typename KeySelector,
typename ValSelector>
54 vector<typename CVal::value_type> selectedValues;
56 selected->reserve(
size);
57 selectedValues.reserve(
size);
60 if (selectKey_(
obj) && selectVal_(
i->second)) {
63 selectedValues.push_back(
i->second);
69 unique_ptr<association_t> selectedAssociation(
new association_t(ref, selected.get()));
70 size = selected->size();
72 for (
size_t i = 0;
i !=
size; ++
i)
73 selectedAssociation->setValue(
i, selectedValues[
i]);