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

[C++ runtime] Add AntlrInputStream(std::string_view) constructor #2847

Merged
merged 1 commit into from
Sep 10, 2020

Conversation

nburles
Copy link

@nburles nburles commented Jun 12, 2020

Guarded by the __cplusplus macro as it is only available in C++17 or newer.

This avoids a copy if the input is actually char const * (due to implicit conversion to std::string in the pre-C++ 17 version), and performs the same if the input is actually std::string.

@nburles nburles changed the title Add AntlrInputStream(std::string_view) constructor [C++ runtime] Add AntlrInputStream(std::string_view) constructor Jun 12, 2020
Guarded by the __cplusplus macro so it is only available in C++17 or
newer.
@nburles nburles force-pushed the antlrinputstream_from_stringview branch from 5addd4a to 254b144 Compare June 15, 2020 11:12
Copy link
Member

@mike-lischke mike-lischke left a comment

Choose a reason for hiding this comment

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

I like that. We should probably migrate over to C++17 in the mid term unless someone objects.

@mike-lischke
Copy link
Member

@parrt A nice C++ addition, ready to be merged.

@nburles
Copy link
Author

nburles commented Sep 10, 2020

Yeah, there's definitely some areas that could benefit from the new functionality in C++17.

@parrt parrt merged commit 9a646e0 into antlr:master Sep 10, 2020
@parrt parrt added this to the 4.9 milestone Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants