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 <me@mortis.eu>
This commit is contained in:
Giel van Schijndel 2011-08-11 18:12:14 +02:00
parent e49b83bb12
commit 82dc6426b4
2 changed files with 7 additions and 12 deletions

View File

@ -63,10 +63,13 @@ static const int VERSION = 32500;
static const char* pszSubVer = ""; static const char* pszSubVer = "";
static const bool VERSION_IS_BETA = true; 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<typename T>
inline T& REF(const T& val)
{
return const_cast<T&>(val);
}
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// //

View File

@ -67,14 +67,6 @@ typedef unsigned long long uint64;
// This is needed because the foreach macro can't get over the comma in pair<t1, t2> // This is needed because the foreach macro can't get over the comma in pair<t1, t2>
#define PAIRTYPE(t1, t2) pair<t1, t2> #define PAIRTYPE(t1, t2) pair<t1, t2>
// Used to bypass the rule against non-const reference to temporary
// where it makes sense with wrappers such as CFlatData or CTxDB
template<typename T>
inline T& REF(const T& val)
{
return (T&)val;
}
// Align by increasing pointer, must have extra space at end of buffer // Align by increasing pointer, must have extra space at end of buffer
template <size_t nBytes, typename T> template <size_t nBytes, typename T>
T* alignup(T* p) T* alignup(T* p)