mirror of
https://github.com/matrix-construct/construct
synced 2024-09-28 19:58:53 +02:00
ircd:Ⓜ️ Extend import check-and-reload to reference operator related.
This commit is contained in:
parent
fd36e553d5
commit
8603ccf16b
1 changed files with 27 additions and 0 deletions
|
@ -34,6 +34,9 @@ struct ircd::m::import
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<class... args> auto operator()(args&&... a);
|
template<class... args> auto operator()(args&&... a);
|
||||||
|
prototype *operator->();
|
||||||
|
prototype &operator*();
|
||||||
|
operator prototype &();
|
||||||
|
|
||||||
import(std::string modname, std::string symname);
|
import(std::string modname, std::string symname);
|
||||||
};
|
};
|
||||||
|
@ -46,6 +49,30 @@ ircd::m::import<prototype>::import(std::string modname,
|
||||||
,symname{std::move(symname)}
|
,symname{std::move(symname)}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
template<class prototype>
|
||||||
|
ircd::m::import<prototype>::operator
|
||||||
|
prototype &()
|
||||||
|
{
|
||||||
|
return this->operator*();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class prototype>
|
||||||
|
prototype &
|
||||||
|
ircd::m::import<prototype>::operator*()
|
||||||
|
{
|
||||||
|
return *this->operator->();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class prototype>
|
||||||
|
prototype *
|
||||||
|
ircd::m::import<prototype>::operator->()
|
||||||
|
{
|
||||||
|
if(unlikely(!*this))
|
||||||
|
reload();
|
||||||
|
|
||||||
|
return mods::import<prototype>::operator->();
|
||||||
|
}
|
||||||
|
|
||||||
template<class prototype>
|
template<class prototype>
|
||||||
template<class... args>
|
template<class... args>
|
||||||
auto
|
auto
|
||||||
|
|
Loading…
Reference in a new issue