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 *
|
||||
********************/
|
||||
|
||||
std::shared_ptr<SingleRange<size_t,SpaceType::NUL>>
|
||||
SingleRangeFactory<size_t,SpaceType::NUL>::mRInstance = nullptr;
|
||||
|
||||
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()
|
||||
|
@ -23,17 +29,15 @@ namespace MultiArrayTools
|
|||
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()
|
||||
{
|
||||
// Singleton
|
||||
if( not mRInstance){
|
||||
if(not mRInstance){
|
||||
if(not mProd){
|
||||
mProd = std::shared_ptr<oType>( new SingleRange<size_t,SpaceType::NUL>() );
|
||||
setSelf();
|
||||
}
|
||||
mRInstance = std::dynamic_pointer_cast<NullRange>( mProd );
|
||||
} else {
|
||||
mProd = mRInstance;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue