-
Notifications
You must be signed in to change notification settings - Fork 59
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
type inconsistency between Collection::size()
and index for const object accessors
#406
Comments
Collection::size()
and index for const object accessorsCollection::size()
and index for const object accessors
You are right. I don't see a reason to not be consistent here. This should be fairly straight forward to fix, I think as these are directly passed to the underlying podio/python/templates/Collection.cc.jinja2 Lines 39 to 41 in f4c9219
Out of of curiosity: Does something change with c++20 in this respect? I am asking since you mentioned it explicitly. |
According to cppreference.com it's effectively Also, Since |
I'm also now wondering if we should switch to podio/python/templates/macros/declarations.jinja2 Lines 123 to 134 in f4c9219
Ultimately it looks like Collection::size() is the only odd one out, returning size_t .
|
It also looks like we have a podio/include/podio/RelationRange.h Lines 31 to 33 in f4c9219
For consistency with the usual c++ containers I think it would be good to have podio/include/podio/ObjectID.h Lines 9 to 10 in f4c9219
|
master
There is a difference between the type
size_t
returned bysize()
from a Collection and the type of the index used in the const object accessors,unsigned int
:podio/python/templates/Collection.h.jinja2
Line 77 in f4c9219
vs.
podio/python/templates/Collection.h.jinja2
Lines 94 to 101 in f4c9219
Is there a particular reason for this difference?
cf.
std::vector
, where we have (ignoring C++20 changes for clarity):in other words,
std::vector::at
takes the same type thatstd::vector::size()
returns.The text was updated successfully, but these errors were encountered: