Make library work with C++20 modules (#4764)

*  add test for C++20 modules

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 fix warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* Add missing header (#4763)

* 🐛 add missing header

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 fix warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 fix warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2025-04-28 21:52:26 +02:00
committed by GitHub
parent 3b02afb9d9
commit eef76c200e
8 changed files with 66 additions and 5 deletions

View File

@@ -53,7 +53,7 @@ enum class cbor_tag_handler_t
@note from https://stackoverflow.com/a/1001328/266378
*/
static inline bool little_endianness(int num = 1) noexcept
inline bool little_endianness(int num = 1) noexcept
{
return *reinterpret_cast<char*>(&num) == 1;
}

View File

@@ -62,7 +62,7 @@ inline StringType escape(StringType s)
* Note the order of escaping "~1" to "/" and "~0" to "~" is important.
*/
template<typename StringType>
static void unescape(StringType& s)
inline void unescape(StringType& s)
{
replace_substring(s, StringType{"~1"}, StringType{"/"});
replace_substring(s, StringType{"~0"}, StringType{"~"});