mirror of
https://github.com/matrix-construct/construct
synced 2025-02-16 16:50:12 +01: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:
|
||||
template<class... args> auto operator()(args&&... a);
|
||||
prototype *operator->();
|
||||
prototype &operator*();
|
||||
operator prototype &();
|
||||
|
||||
import(std::string modname, std::string symname);
|
||||
};
|
||||
|
@ -46,6 +49,30 @@ ircd::m::import<prototype>::import(std::string modname,
|
|||
,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... args>
|
||||
auto
|
||||
|
|
Loading…
Add table
Reference in a new issue