From 0a5a492ab64420e61d44115a3dd4f61bcc730446 Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Mon, 13 Apr 2015 12:18:33 +0100 Subject: [PATCH] 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 --- Source/Ember/Ember.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Ember/Ember.cpp b/Source/Ember/Ember.cpp index 5e30cc0..9684061 100644 --- a/Source/Ember/Ember.cpp +++ b/Source/Ember/Ember.cpp @@ -1,6 +1,12 @@ #include "EmberPch.h" #include "EmberDefines.h" #include "Isaac.h" + +namespace EmberNs +{ +template<> unique_ptr> QTIsaac::GlobalRand = unique_ptr>(new QTIsaac()); +} + #include "Curves.h" #include "Ember.h" #include "Utils.h" @@ -38,7 +44,6 @@ namespace EmberNs { bool Timing::m_TimingInit = false; uint Timing::m_ProcessorCount; -template<> unique_ptr> QTIsaac::GlobalRand = unique_ptr>(new QTIsaac()); #define EXPORTPREPOSTREGVAR(varName, T) \ template EMBER_API class varName##Variation; \