From: Giel van Schijndel Date: Thu, 11 Aug 2011 16:12:14 +0000 (+0200) Subject: Move func 'REF' from util.h to serialize.h X-Git-Tag: v0.4.0-unstable~227^2~36^2~3 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=82dc6426b4cbf769ace7976c2a40d160b8d76f08 Move func 'REF' from util.h to serialize.h util.h doesn't use REF, serialize.h does, creating a dependency of serialize.h on util.h, but util.h already depends on serialize.h. To resolve this circular dependency the function 'REF' has now been moved closer to one of its two points of use. Signed-off-by: Giel van Schijndel --- diff --git a/src/serialize.h b/src/serialize.h index c557752..0a31ff5 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -63,10 +63,13 @@ static const int VERSION = 32500; static const char* pszSubVer = ""; static const bool VERSION_IS_BETA = true; - - - - +// Used to bypass the rule against non-const reference to temporary +// where it makes sense with wrappers such as CFlatData or CTxDB +template +inline T& REF(const T& val) +{ + return const_cast(val); +} ///////////////////////////////////////////////////////////////// // diff --git a/src/util.h b/src/util.h index 1e4ceb2..3d7ef10 100644 --- a/src/util.h +++ b/src/util.h @@ -67,14 +67,6 @@ typedef unsigned long long uint64; // This is needed because the foreach macro can't get over the comma in pair #define PAIRTYPE(t1, t2) pair -// Used to bypass the rule against non-const reference to temporary -// where it makes sense with wrappers such as CFlatData or CTxDB -template -inline T& REF(const T& val) -{ - return (T&)val; -} - // Align by increasing pointer, must have extra space at end of buffer template T* alignup(T* p)