Skip to content

Commit

Permalink
Handle change in char8_t in C++20
Browse files Browse the repository at this point in the history
  • Loading branch information
langmm committed Aug 12, 2024
1 parent 348a9a0 commit cef1042
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/rapidjson/rapidjson.h
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,10 @@ RAPIDJSON_NAMESPACE_END
#define RAPIDJSON_HAS_CXX11 (RAPIDJSON_CPLUSPLUS >= 201103L)
#endif

#ifndef RAPIDJSON_HAS_CXX20
#define RAPIDJSON_HAS_CXX20 (RAPIDJSON_CPLUSPLUS >= 202002L)
#endif

#ifndef RAPIDJSON_HAS_CXX11_RVALUE_REFS
#if RAPIDJSON_HAS_CXX11
#define RAPIDJSON_HAS_CXX11_RVALUE_REFS 1
Expand Down
5 changes: 5 additions & 0 deletions include/rapidjson/units.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,11 @@ class GenericUnitPrefix {
GenericUnitPrefix(const std::basic_string<Ch> abbr0, const double& factor0,
const std::basic_string<Ch> name0) :
abbr(abbr0), factor(factor0), name(name0) {}
#if RAPIDJSON_HAS_CXX20
GenericUnitPrefix(const char8_t* abbr0, const double& factor0, const Ch* name0) :
abbr(reinterpret_cast<const char*>(abbr0)),
factor(factor0), name(name0) {}
#endif // RAPIDJSON_HAS_CXX20
//! Abbreviation associated with the prefix.
std::basic_string<Ch> abbr;
//! Factor that the prefix implies.
Expand Down

0 comments on commit cef1042

Please sign in to comment.