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

Problem with usage string_view in API #166

Closed
YarikTH opened this issue Aug 9, 2021 · 2 comments
Closed

Problem with usage string_view in API #166

YarikTH opened this issue Aug 9, 2021 · 2 comments
Milestone

Comments

@YarikTH
Copy link
Contributor

YarikTH commented Aug 9, 2021

I caught the following problem:

  • Build v8pp with c++14
  • Build my library that using v8pp with c++17
  • Got a lot of sexy "unresolved reference" messages

When I dug a little, I found out that v8pp has a feature detection code, especially for string_view.
There shouldn't be any problem with __cpp_lib_void_t and __cpp_lib_logical_traits as soon as the behaviour is identical to the standard ones.
There shouldn't be any problem with selecting string_view version in headers if we work with a header-only library.
But when string_view type is detected in the header and this type is used in API between the cpp part of the library and end user, then to use a prebuilt version of v8pp user should guess against which c++ standard v8pp is built and they forced to use the same standard as v8pp uses.

Possible solution: make string_view choice at the configuration time and hardcode it into config.hpp. Then at least at the API level both the library and user will use the same type, which completely solves the problem.

@pmed
Copy link
Owner

pmed commented Aug 9, 2021 via email

@pmed pmed added this to the version 1.8 milestone Aug 12, 2021
pmed added a commit that referenced this issue Oct 3, 2021
add build option, use it in the generated config.hpp

See #166

(cherry picked from commit ba4b891)
pmed added a commit that referenced this issue Oct 3, 2021
Reported build options are: isolate data slot number, use of `std::string_view`

See #166

(cherry picked from commit e054ad1)
pmed added a commit that referenced this issue Oct 3, 2021
add build option, use it in the generated config.hpp

See #166
pmed added a commit that referenced this issue Oct 3, 2021
Reported build options are: isolate data slot number, use of `std::string_view`

See #166
@pmed
Copy link
Owner

pmed commented Oct 3, 2021

Added V8PP_USE_STD_STRING_VIEW that is 0 on the master branch with C++14 and is 1 on the c++17 branch.

@pmed pmed closed this as completed Oct 3, 2021
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

No branches or pull requests

2 participants