Skip to content
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

feat: add support for reading free floating std::vector #1180

Merged
merged 12 commits into from
Mar 22, 2024

Conversation

ioanaif
Copy link
Collaborator

@ioanaif ioanaif commented Mar 21, 2024

No description provided.

@ioanaif ioanaif linked an issue Mar 21, 2024 that may be closed by this pull request
@ioanaif ioanaif requested a review from jpivarski March 21, 2024 14:43
Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I went back and forth on the priority order; now it's

  1. check for any globally- or per-file-defined Models
  2. load the file's streamers and look for any Models the streamers might have defined
  3. check for explicit STL classes, like std::vector<T> (where the T might have been defined by one of the streamers, so we had to check
  4. give up and call it UnknownClass.

The regex is now

(std\s*::\s*)?(vector|map|set|string|bitset)

because we want exactly one of the STL class names to match.

But it looks good, the test does the right thing, and it's ready to merge.

@jpivarski
Copy link
Member

Another alteration: this is similar to #1160, but that implementation checked for std::string in ReadOnlyKey.get. It has to be in a different place: since free-floating std::string has to return a str type and not a Model, ReadOnlyFile.class_named is too late. The other cases, std::vector, std::map, std::set, and std::bitset (which are the only ones with parameters; std::string wouldn't be followed by a <) return container types such as STLVector, STLMap, STLSet, and STLBitSet.

However, I could make the code that handled the #1160 case more symmetric. It can check for both string and std::string.

Now it's ready to merge.

@ioanaif ioanaif merged commit 96a7c85 into main Mar 22, 2024
21 checks passed
@ioanaif ioanaif deleted the ioanaif/feat-support-free-vector branch March 22, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read free floating std::vector
2 participants