SpiecsEngine
 
Loading...
Searching...
No Matches

◆ Bind()

template<typename ... Args>
bool Spices::Delegate_Basic< Args >::Bind ( std::function< void(Args...)> func)
inline

Bind Function pointer to delegate.

Parameters
[in]funcFunction pointer.
Returns
Returns true if bind successfully.

pack task as a lambda and to map.

Definition at line 84 of file DelegateBasic.h.

85 {
87
88 uint64_t* addr = reinterpret_cast<uint64_t*>(&func);
89 if (m_Agents->has_key(*addr))
90 {
91 SPICES_CORE_WARN("Agent Function binding repeatly.");
92 return false;
93 }
94
98 m_Agents->push_back(*addr, func);
99
100 return true;
101 }
#define SPICES_PROFILE_ZONE
std::shared_ptr< scl::linked_unordered_map< uint64_t, Agent > > m_Agents
Map of Agent Function Pointer.
void push_back(const K &key, const V &value)
Add a element to this container.
bool has_key(const K &key)
Determine whether the key is in the container.

References Spices::Delegate_Basic< Args >::m_Agents.