mirror of
https://github.com/minetest/minetest.git
synced 2024-07-04 15:05:27 +02:00
Add copy & move constructor from STL string to Irrlicht string
This commit is contained in:
parent
580a71554d
commit
be03a435b8
@ -11,7 +11,6 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cwchar>
|
#include <cwchar>
|
||||||
#include <locale>
|
|
||||||
|
|
||||||
/* HACK: import these string methods from MT's util/string.h */
|
/* HACK: import these string methods from MT's util/string.h */
|
||||||
extern std::wstring utf8_to_wide(std::string_view input);
|
extern std::wstring utf8_to_wide(std::string_view input);
|
||||||
@ -65,6 +64,7 @@ static inline u32 locale_upper(u32 x)
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
class string
|
class string
|
||||||
{
|
{
|
||||||
|
using stl_type = std::basic_string<T>;
|
||||||
public:
|
public:
|
||||||
typedef T char_type;
|
typedef T char_type;
|
||||||
|
|
||||||
@ -79,6 +79,12 @@ class string
|
|||||||
*this = other;
|
*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
|
//! Constructor from other string types
|
||||||
template <class B>
|
template <class B>
|
||||||
string(const string<B> &other)
|
string(const string<B> &other)
|
||||||
@ -814,13 +820,6 @@ class string
|
|||||||
friend size_t wStringToUTF8(stringc &destination, const wchar_t *source);
|
friend size_t wStringToUTF8(stringc &destination, const wchar_t *source);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::basic_string<T> stl_type;
|
|
||||||
|
|
||||||
//! Private constructor
|
|
||||||
string(stl_type &&str) :
|
|
||||||
str(str)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//! strlen wrapper
|
//! strlen wrapper
|
||||||
template <typename U>
|
template <typename U>
|
||||||
|
Loading…
Reference in New Issue
Block a user