-
Notifications
You must be signed in to change notification settings - Fork 21
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
Uniform lambda signatures for ygm::container
types?
#116
Comments
Short term I will change |
Looks like PR #121 is actually going in the wrong direction because we are unable to replicate the map interface without introducing references that cannot be made truly const. Ergo, I'm going to work in the other direction and make |
Ok I figured out how to support multiple lambda signatures while still crashing at compile time if a signature is not supported. I'll update |
#123 adds this functionality while remaining (mostly) backwards-compatible. I believe that this issue is now resolved. |
Currently, if one has a workflow involving sending visitors to possibly different container types, we need to maintain different versions of the visitor lambdas. For example, a visitor lambda to a
ygm::container::map
orygm::container::counting_set
must look something likeMeanwhile, a visitor lambda to a
ygm::container::array
must look likeAnd a visitor lambda to a
ygm::container::bag
,ygm::container::set
, orygm::container::disjoint_set
must look likeIt would be very convenient to have a more uniform signature for these lambdas. For example, it would be convenient to be able to pass the same lambda function to a map, array, or bag of key-value-pairs (see LLNL/saltatlas#25). This particular example could be achieved by changing the array class so that it expects lambdas to be functions of
std::pair<const index_type, value_type>
, but that might not be the best global solution, especially as we add more container types. Any ideas?The text was updated successfully, but these errors were encountered: