as C/C++ is very basic, it does not support fluid string types, or dynamic arrays, hashed arrays, etc. However classes that offer this functionality are often supplied.
for typical char*, you can use std::string which provides operator overloading for functionality such as what you described (ie: str1 = str2+str3 )
std::string uses char* internally however, and you want to use wchar_t
for this purpose, Niko has coded his own string class which is a template. you can make an irr::core::string<wchar_t>, which will provide the functionality you are looking for.
for instances that require a wchar_t*, use the c_str() method to extract a pointer to your string
string<wchar_t> charNew = "These are all Strings: "+string1+string2+string3;
This wont work because "These are all Strings: " is no string, of course. But how can I make a "Just-In-Time" String without having a new Object. I would not look nice if I would write:
Does nobody know how to create "Just-In-Time"-Strings? I would search in google but what should I look for? "Just-In-Time object creation"?
I would be glad if anybody could just post one line of code
the reason it doesnt work is because you're not using a wchar_t static string--
"string<wchar_t> temp = "These are all Strings: "; " that wont event work, you need to put the "L" in front of your string to make it a static wchar_t
ex:
string<wchar_t> charNew = L"These are all Strings: "+string1+string2+string3;
The L there is a pre-compile macro which tells the compiler that the static string next to it is a wide character string. so:
"this string is a static 'char' string"
L"this string is a static 'wchar_t' string"
Thx for your answer, but I tested it with and without a "L" and both don´t work.
string<wchar_t> string1 = L"String1"; //with or without L, both dont work
string<wchar_t> string2 = L"String2"; //with or without L, both dont work
string<wchar_t> string3 = L"String3"; //with or without L, both dont work
string<wchar_t> charNew = L"These are all Strings: "+string1+string2+string3; //with or without L, both dont work
The error is: main.cpp(73): error C2677: Binärer Operator '+' : Es konnte kein globaler Operator gefunden werden, der den Typ 'irr::core::string<T>' akzeptiert (oder keine geeignete Konvertierung möglich)
with
[
T=wchar_t
]
(binary '+' operator: There is no global operator that supports the type 'irr::core::string<T>' (or there is no conversion possible)
hrm. string<wchar_t*> maybe? though that doesnt seem right..
otherwise, you can just create one on the spot:
string<wchar_t> blah = string<wchar_t>("blah blah blah...");
blah = blah + string<wchar_t>(" and more blah\n");