forked from Mirrors/openclonk
Engine: Really fix StdBuf move semantics with C++0x
To pass an rvalue parameter as an rvalue to another function, you have to cast. Isn't C++ fun?stable-5.2
parent
83cebbdcf3
commit
6318b15598
|
@ -92,9 +92,9 @@ namespace {
|
|||
|
||||
class ImplicitStrBuf: public StdStrBuf {
|
||||
public:
|
||||
ImplicitStrBuf(StdStrBuf RREF Buf2): StdStrBuf(Buf2, false) { }
|
||||
ImplicitStrBuf(StdStrBuf RREF Buf2): StdStrBuf(static_cast<StdStrBuf RREF>(Buf2)) { }
|
||||
ImplicitStrBuf(const StdStrBuf & Buf2): StdStrBuf(Buf2) { }
|
||||
ImplicitStrBuf(ImplicitStrBuf RREF Buf2): StdStrBuf(Buf2) { }
|
||||
ImplicitStrBuf(ImplicitStrBuf RREF Buf2): StdStrBuf(static_cast<ImplicitStrBuf RREF>(Buf2)) { }
|
||||
ImplicitStrBuf(const ImplicitStrBuf & Buf2): StdStrBuf(Buf2) { }
|
||||
operator const char *() const { return getData(); }
|
||||
};
|
||||
|
@ -1372,6 +1372,7 @@ void C4Console::UpdateInputCtrl()
|
|||
|
||||
GtkTreeIter iter;
|
||||
GtkListStore* store = GTK_LIST_STORE(gtk_entry_completion_get_model(completion));
|
||||
g_assert(store);
|
||||
gtk_list_store_clear(store);
|
||||
#endif // WITH_DEVELOPER_MODE / _WIN32
|
||||
// add global and standard functions
|
||||
|
|
|
@ -99,7 +99,7 @@ typedef __int32 intptr_t;
|
|||
#define ALLOW_TEMP_TO_REF(ClassName)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
||||
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
|
||||
// Another temporary-to-reference-fix: this time using C++0x's rvalue references
|
||||
#define HAVE_RVALUE_REF
|
||||
#endif
|
||||
|
|
|
@ -384,8 +384,12 @@ public:
|
|||
{ }
|
||||
|
||||
// See StdBuf::StdBuf. Will take data if possible.
|
||||
// The static_cast is necessary to pass a rvalue reference to
|
||||
// the StdBuf constructor. Without it, the const lvalue
|
||||
// StdBuf constructor will be used, which will ref the contents
|
||||
// instead of moving them.
|
||||
StdStrBuf(StdStrBuf RREF Buf2, bool fCopy = false)
|
||||
: StdBuf(Buf2, fCopy)
|
||||
: StdBuf(static_cast<StdStrBuf RREF>(Buf2), fCopy)
|
||||
{ }
|
||||
|
||||
#ifdef HAVE_RVALUE_REF
|
||||
|
|
|
@ -876,7 +876,7 @@ int ForEachFile(const char *szDirName, bool (*fnCallback)(const char *)) {
|
|||
} while (_findnext(fdthnd,&fdt)==0);
|
||||
_findclose(fdthnd);
|
||||
#else
|
||||
if (fHasWildcard) fprintf(stderr, "Warning: ForEachFile with * (%s)", szDirName);
|
||||
if (fHasWildcard) fprintf(stderr, "Warning: ForEachFile with * (%s)\n", szDirName);
|
||||
DIR * d = opendir(szDirName);
|
||||
if (!d) return 0;
|
||||
dirent * ent;
|
||||
|
|
Loading…
Reference in New Issue