Skip to content

Allow to use string_view from std::experimental#2364

Closed
karzhenkov wants to merge 8 commits intonlohmann:developfrom
karzhenkov:fix-ts-string_view
Closed

Allow to use string_view from std::experimental#2364
karzhenkov wants to merge 8 commits intonlohmann:developfrom
karzhenkov:fix-ts-string_view

Conversation

@karzhenkov
Copy link
Contributor

@karzhenkov karzhenkov commented Aug 21, 2020

The support of string_view was not fully tested due to problems discussed in #2213, #2241, #2117. When using clang-7 in C++17 mode the string_view is defined in the std::experimental namespace. This results in a compile error after travis configuration is corrected.

@coveralls
Copy link

coveralls commented Aug 21, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling 5f566f0 on karzhenkov:fix-ts-string_view into b9d7651 on nlohmann:develop.

env:
- COMPILER=g++-9
- CXXFLAGS=-std=c++2a
- CXX_STANDARD=17
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be better to specify CXX_STANDARD=20, however, cmake v3.9.2 at Travis doesn't support such option. Anyway, this setting had no effect before.


namespace nlohmann {
namespace std_aliases { }
using namespace std_aliases;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This introduces a mix of qualified and unqualified names in source code. E.g. we have std::string but string_view instead of std::string_view. We cannot introduce any names (such as std::expermental::string_view) directly into std. There is other option to consider:

namespace nlohmann {
    namespace std_aliases {
        using namespace std;
    }
}

This allows regular qualification approach (std_aliases::string and std_aliases::string_view) but requires a lots of changes in almost all files.

@karzhenkov karzhenkov marked this pull request as ready for review August 21, 2020 11:49
@karzhenkov karzhenkov requested a review from nlohmann as a code owner August 21, 2020 11:49
@stale
Copy link

stale bot commented Sep 20, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Sep 20, 2020
@stale stale bot closed this Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants