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

Backport string_view for pre-c++17 compilers #159

Merged
merged 4 commits into from
Jul 25, 2021
Merged

Backport string_view for pre-c++17 compilers #159

merged 4 commits into from
Jul 25, 2021

Conversation

pmed
Copy link
Owner

@pmed pmed commented Jul 25, 2021

Add v8pp::basic_string_View minium required implementation.

pmed and others added 4 commits July 25, 2021 16:50
Added `v8pp::basic_string_view<Char>` template into `utility.hpp` header with
minimal required interface and additional `.str()` member function for simpler
conversion to `std::basic_string<Char>`

Added `v8pp::convert<string_view>` specialization and test case for it.

Replaced `char const*` to `string_view` parameter for name bindings in
`class_`, `module`, `context`, and other places.
Added `std::basic_string` operator cast into `v8pp::basic_string_view` polyfill
for compatibility with `std::string_view`
On linux, v8pp failed to compile in it's default configuration defined in the
makefile (C++14 mode). When compiling in C++14 mode, `__has_include(<string_view>)`
returns true and also the header can be included. However the std::string_view is
not defined. This uses the macro `__cpp_lib_string_view` instead to check for
`std::string_view` availability. It compiles now in both C++14 and C++17 mode.
@pmed pmed merged commit 43583ee into master Jul 25, 2021
@pmed pmed deleted the string_view branch July 25, 2021 15:40
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.

2 participants