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

Add support for switching to nonstd::string_view #245

Closed
xiaozhuai opened this issue Jun 20, 2022 · 5 comments
Closed

Add support for switching to nonstd::string_view #245

xiaozhuai opened this issue Jun 20, 2022 · 5 comments
Labels

Comments

@xiaozhuai
Copy link

I currently use c++11 for my project. There is no string_view support.
I've change all std::string_view to nonstd::string_view and works well.
I wonder if we can add this feature to inja, simply enable it by a macro.
Then inja can support c++11 as well.

https://github.com/martinmoene/string-view-lite

@pantor
Copy link
Owner

pantor commented Jun 20, 2022

Inja 3.3 supports and includes this std::string_view polyfill, but it was removed recently from the master branch as we assume C++17 going forward. I think this is reasonable for "modern" C++ in mid 2022.

What is holding you back at C++11?

@xiaozhuai
Copy link
Author

@pantor Thanks for your reply.
An old project holding me back at c++11 : (
And there is no plan to upgrade to c++17.
Old device, old compiler and old c++ runtime library......
I agree with your opinion. I'd like to use c++17 with my new project.
But sometimes, migrate an old project is really painful not even feasible.

@pantor
Copy link
Owner

pantor commented Jun 21, 2022

Yeah, I feel you. Still, thanks for your input!

@pantor pantor closed this as completed Jun 21, 2022
@pantor pantor added the wontfix label Jun 21, 2022
@davidchall
Copy link

@pantor - in case this affects your decision, I also need C++11 support. 😞

I have an R package called jinjar, which provides Jinja-like templating to the R community. This is a fairly academic community, and people often use older linux machines. C++11 is pretty standard there, but C++17 is still considered very futuristic 😆

@xiaozhuai
Copy link
Author

@davidchall I've tried to replace all #include <string_view> with #include <nonstd/string_view.hpp> and std::string_view with nonstd::string_view. It works good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants