Skip to content

Commit

Permalink
api: fix MSVC compatibility of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Aug 3, 2024
1 parent 4071df3 commit 90fdfe7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/impl_flag.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@
#define __JULE_INLINE_BEFORE_CPP20 inline
#endif

#if defined(_MSC_VER)
#define __JULE_COMPILER_MSVC
#endif

#endif // ifndef __JULE_IMPL_FLAG_HPP
6 changes: 6 additions & 0 deletions api/str.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ namespace jule

Str(void) : _len(0) {};
Str(const jule::Str &src) = default;

#if defined(__JULE_COMPILER_MSVC)
Str(const std::basic_string<jule::U8> &src) : Str(src.begin()->base(), src.end()->base()) {}
#else
Str(const std::basic_string<jule::U8> &src) : Str(src.begin().base(), src.end().base()) {}
#endif

Str(const char *src, const jule::Int &len) : Str(reinterpret_cast<const jule::U8 *>(src), len) {}
Str(const jule::U8 *src, const jule::Int &len) : buffer(jule::Str::buffer_t::make(const_cast<jule::U8 *>(src), nullptr)),
_slice(const_cast<jule::U8 *>(src)),
Expand Down

0 comments on commit 90fdfe7

Please sign in to comment.