fix null range instace issue
This commit is contained in:
parent
1523fa024e
commit
15f4f38e48
1 changed files with 9 additions and 5 deletions
|
@ -13,9 +13,15 @@ namespace MultiArrayTools
|
||||||
* SingleRange *
|
* SingleRange *
|
||||||
********************/
|
********************/
|
||||||
|
|
||||||
|
std::shared_ptr<SingleRange<size_t,SpaceType::NUL>>
|
||||||
|
SingleRangeFactory<size_t,SpaceType::NUL>::mRInstance = nullptr;
|
||||||
|
|
||||||
std::shared_ptr<NullRange> nullr()
|
std::shared_ptr<NullRange> nullr()
|
||||||
{
|
{
|
||||||
return SingleRangeFactory<size_t,SpaceType::NUL>::mRInstance;
|
static NullRF nrf; // just that mRInstance is initialized
|
||||||
|
static auto nr = std::dynamic_pointer_cast<NullRange>( nrf.create() );
|
||||||
|
VCHECK(NullRF::mRInstance);
|
||||||
|
return NullRF::mRInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<NullIndex> nulli()
|
std::shared_ptr<NullIndex> nulli()
|
||||||
|
@ -23,9 +29,6 @@ namespace MultiArrayTools
|
||||||
return std::make_shared<NullIndex>(nullr());
|
return std::make_shared<NullIndex>(nullr());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SingleRange<size_t,SpaceType::NUL>>
|
|
||||||
SingleRangeFactory<size_t,SpaceType::NUL>::mRInstance = nullptr;
|
|
||||||
|
|
||||||
SingleRangeFactory<size_t,SpaceType::NUL>::SingleRangeFactory()
|
SingleRangeFactory<size_t,SpaceType::NUL>::SingleRangeFactory()
|
||||||
{
|
{
|
||||||
// Singleton
|
// Singleton
|
||||||
|
@ -34,6 +37,7 @@ namespace MultiArrayTools
|
||||||
mProd = std::shared_ptr<oType>( new SingleRange<size_t,SpaceType::NUL>() );
|
mProd = std::shared_ptr<oType>( new SingleRange<size_t,SpaceType::NUL>() );
|
||||||
setSelf();
|
setSelf();
|
||||||
}
|
}
|
||||||
|
mRInstance = std::dynamic_pointer_cast<NullRange>( mProd );
|
||||||
} else {
|
} else {
|
||||||
mProd = mRInstance;
|
mProd = mRInstance;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue