Add copy & move constructor from STL string to Irrlicht string

This commit is contained in:
Lars Mueller 2024-06-08 16:43:07 +02:00
parent 580a71554d
commit be03a435b8

@ -11,7 +11,6 @@
#include <cstdio>
#include <cstring>
#include <cwchar>
#include <locale>
/* HACK: import these string methods from MT's util/string.h */
extern std::wstring utf8_to_wide(std::string_view input);
@ -65,6 +64,7 @@ static inline u32 locale_upper(u32 x)
template <typename T>
class string
{
using stl_type = std::basic_string<T>;
public:
typedef T char_type;
@ -79,6 +79,12 @@ class string
*this = other;
}
//! Copy (from standard library string) constructor
string(const stl_type &str) : str(str) {}
//! Move (from standard library string) constructor
string(stl_type &&str) : str(str) {}
//! Constructor from other string types
template <class B>
string(const string<B> &other)
@ -814,13 +820,6 @@ class string
friend size_t wStringToUTF8(stringc &destination, const wchar_t *source);
private:
typedef std::basic_string<T> stl_type;
//! Private constructor
string(stl_type &&str) :
str(str)
{
}
//! strlen wrapper
template <typename U>