Project

General

Profile

Feature #9999

objects and associated metadata in a single vecctor of pairs

Added by Robert Sulej about 4 years ago. Updated about 4 years ago.

Status:
Accepted
Priority:
Normal
Assignee:
-
Category:
Navigation
Target version:
-
Start date:
09/01/2015
Due date:
% Done:

0%

Estimated time:
8.00 h
Scope:
Internal
Experiment:
LBNE
SSI Package:
art
Duration:

Description

Could you, please, consider implementing a function of FindMany / FindManyP, that can return vector of std::pairs of objects and metadata associated to them? I know there are functions at() and data() which return both things separately and I can merge it as I like. However, as we start using metadata of assns more often I thought this can be convenient and logical feature of the framework itself.

History

#1 Updated by Marc Paterno about 4 years ago

  • Status changed from New to Accepted
  • Estimated time set to 8.00 h

We can provide a convenience wrapper to implement this function, but it will be no more efficient than doing it yourself. Testing may be more subtle.

#2 Updated by Marc Paterno about 4 years ago

  • Category set to Navigation
  • SSI Package art added
  • SSI Package deleted ()

#3 Updated by Rob Kutschke about 4 years ago

I have two suggestions.

My strong preference is not to use std::pair. Instead write a class template that gives better names to the accessors than first and second.

Whether or not you go with the first suggestions, the std::pair or pair-like-thing should hold pointers to the associated object and the metadata, not copies.

Finally, if you go with the class template solution, the named accessors can be functions that return const& ( and the data members can be whatever makes sense, pointer to const or const&).



Also available in: Atom PDF