Give make_intrusive() access to protected EnumVal ctor

This commit is contained in:
Jon Siwek 2020-05-06 16:45:01 -07:00
parent f512ae023e
commit c6f2e35af0
2 changed files with 5 additions and 2 deletions

View file

@ -1209,7 +1209,7 @@ void EnumType::CheckAndAddName(const string& module_name, const char* name,
AddNameInternal(module_name, name, val, is_export);
if ( vals.find(val) == vals.end() )
vals[val] = IntrusivePtr{AdoptRef{}, new EnumVal(this, val)};
vals[val] = make_intrusive<EnumVal>(this, val);
set<BroType*> types = BroType::GetAliases(GetName());
set<BroType*>::const_iterator it;
@ -1265,7 +1265,7 @@ IntrusivePtr<EnumVal> EnumType::GetVal(bro_int_t i)
if ( it == vals.end() )
{
rval = IntrusivePtr{AdoptRef{}, new EnumVal(this, i)};
rval = make_intrusive<EnumVal>(this, i);
vals[i] = rval;
}
else

View file

@ -998,6 +998,9 @@ protected:
friend class Val;
friend class EnumType;
template<class T, class... Ts>
friend IntrusivePtr<T> make_intrusive(Ts&&... args);
EnumVal(EnumType* t, int i) : Val(bro_int_t(i), t)
{
}