Fix arcana that made MSVC / GCC sad

GCC doesn't like specializations of inner classes declared inline, or 
using a shorthand type alias for static template member variable 
initialisation. 

MSVC doesn't like using a private type alias
nix
Owen Green 5 years ago
parent aba2795644
commit 3e31a4dcb4

@ -10,27 +10,34 @@ template <typename Client> class FluidSCWrapper;
namespace impl {
template <typename Client,typename Wrapper>
struct BaseChooser
template<bool UseRealTime> struct ChooseRTOrNRT;
template<>
struct ChooseRTOrNRT<false>
{
template<bool>struct Choose
{
template<typename Client, typename Wrapper>
using type = NonRealTime<Client,Wrapper>;
};
};
template<>
struct Choose<true>
{
template<>
struct ChooseRTOrNRT<true>
{
template<typename Client, typename Wrapper>
using type = RealTime<Client,Wrapper>;
};
};
template <typename Client,typename Wrapper>
struct BaseChooser
{
using RT = typename Client::isRealTime;
static constexpr bool UseRealTime = RT::value && !IsModel_t<Client>::value;
using type = typename Choose<UseRealTime>::type;
using type = typename ChooseRTOrNRT<UseRealTime>::template type<Client,Wrapper>;
};
template <typename Client,typename Wrapper>
using BaseChooser_t = typename BaseChooser<Client,Wrapper>::type;

@ -44,13 +44,16 @@ namespace impl {
using CacheEntryPointer = std::shared_ptr<CacheEntry>;
using WeakCacheEntryPointer = std::weak_ptr<CacheEntry>; //could use weak_type in 17
using Cache = std::map<index,CacheEntryPointer>;
public:
using Cache = std::map<index,CacheEntryPointer>;
static Cache mCache;
private:
static bool isNull(WeakCacheEntryPointer const& weak) {
return !weak.owner_before(WeakCacheEntryPointer{}) && !WeakCacheEntryPointer{}.owner_before(weak);
}
static Cache mCache;
public:
static WeakCacheEntryPointer get(index id)
@ -201,10 +204,7 @@ namespace impl {
{
using NRTCommand::NRTCommand;
template<bool b>
struct CancelCheck{
void operator()(index id)
void cancelCheck(std::false_type, index id)
{
if(auto ptr = get(id).lock())
{
@ -215,13 +215,9 @@ namespace impl {
<< std::endl;
}
}
};
template<>
struct CancelCheck<true>{
void operator()(index)
{}
};
void cancelCheck(std::true_type, index){}
static const char* name()
{
@ -231,7 +227,7 @@ namespace impl {
bool stage2(World*)
{
CancelCheck<IsRTQueryModel>()(NRTCommand::mID);
cancelCheck(IsRTQueryModel_t(),NRTCommand::mID);
remove(NRTCommand::mID);
NRTCommand::sendReply(name(), true);
return true;
@ -759,7 +755,7 @@ namespace impl {
if(auto ptr = get(mID).lock())
{
bool trigger = (mPreviousTrigger <= 0) && mTrigger > 0;
bool trigger = (!mPreviousTrigger) && mTrigger;
mPreviousTrigger = mTrigger;
mTrigger = 0;
auto& client = ptr->mClient;
@ -784,8 +780,8 @@ namespace impl {
}
private:
bool mPreviousTrigger{0};
bool mTrigger{0};
bool mPreviousTrigger{false};
bool mTrigger{false};
Result mResult;
impl::FloatControlsIter mControlsIterator;
index mID;
@ -948,18 +944,12 @@ namespace impl {
index checkThreadInterval;
index pollCounter{0};
index mPreviousTrigger{0};
bool mSynchronous{true};
Wrapper* mWrapper{static_cast<Wrapper*>(this)};
Result mResult;
};
//initialize static cache
template<typename Client, typename Wrapper>
using Cache = typename NonRealTime<Client,Wrapper>::Cache;
template<typename Client, typename Wrapper>
Cache<Client,Wrapper> NonRealTime<Client,Wrapper>::mCache{};
typename NonRealTime<Client, Wrapper>::Cache NonRealTime<Client,Wrapper>::mCache{};
}
}

Loading…
Cancel
Save