From be03a435b8d66c0991159cfea823e607c3e87059 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Sat, 8 Jun 2024 16:43:07 +0200 Subject: [PATCH] Add copy & move constructor from STL string to Irrlicht string --- irr/include/irrString.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/irr/include/irrString.h b/irr/include/irrString.h index a583c9e4b..8669aec18 100644 --- a/irr/include/irrString.h +++ b/irr/include/irrString.h @@ -11,7 +11,6 @@ #include #include #include -#include /* 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 class string { + using stl_type = std::basic_string; 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 string(const string &other) @@ -814,13 +820,6 @@ class string friend size_t wStringToUTF8(stringc &destination, const wchar_t *source); private: - typedef std::basic_string stl_type; - - //! Private constructor - string(stl_type &&str) : - str(str) - { - } //! strlen wrapper template