Ensure GlobalRand is specialized before implicitly instantiated

I don't like this as it results in some code amongst the headers, but I couldn't figure a better way to do this, as I think this specialization needs to be in a cpp file

GlobalRand is implicitly instantiated in PaletteList.h:82, which is seen before the specialization, which isn't allowed by the standard.

See: http://stackoverflow.com/questions/21112148/specialization-of-member-function-template-after-instantiation-error-and-order
This commit is contained in:
Simon Detheridge 2015-04-13 12:18:33 +01:00
parent 3f5db01a06
commit 0a5a492ab6

View File

@ -1,6 +1,12 @@
#include "EmberPch.h" #include "EmberPch.h"
#include "EmberDefines.h" #include "EmberDefines.h"
#include "Isaac.h" #include "Isaac.h"
namespace EmberNs
{
template<> unique_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>> QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand = unique_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>>(new QTIsaac<ISAAC_SIZE, ISAAC_INT>());
}
#include "Curves.h" #include "Curves.h"
#include "Ember.h" #include "Ember.h"
#include "Utils.h" #include "Utils.h"
@ -38,7 +44,6 @@ namespace EmberNs
{ {
bool Timing::m_TimingInit = false; bool Timing::m_TimingInit = false;
uint Timing::m_ProcessorCount; uint Timing::m_ProcessorCount;
template<> unique_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>> QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand = unique_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>>(new QTIsaac<ISAAC_SIZE, ISAAC_INT>());
#define EXPORTPREPOSTREGVAR(varName, T) \ #define EXPORTPREPOSTREGVAR(varName, T) \
template EMBER_API class varName##Variation<T>; \ template EMBER_API class varName##Variation<T>; \