1313#include " xrCore/Threading/Lock.hpp"
1414#include " xrCore/Threading/ScopeLock.hpp"
1515
16+ #include < limits>
17+ #include < algorithm>
18+
1619/* !
1720 \brief Base abstract class for implementing event handling callbacks
1821
@@ -49,7 +52,7 @@ class CEventNotifierCallbackWithCid : public CEventNotifierCallback
4952 /* ! Constructor, takes callback ID which was generated by the notifier
5053 /param[in] cid callback ID, should be generated by the notifier in subscription process only
5154 */
52- CEventNotifierCallbackWithCid (CID cid) : m_cid(cid ), CEventNotifierCallback( ){};
55+ CEventNotifierCallbackWithCid (CID cid) : CEventNotifierCallback( ), m_cid(cid ){};
5356
5457 /* ! Returns the callback ID which was generated by the notifier and passed to the constructor */
5558 CID GetCid () const { return m_cid; }
@@ -87,7 +90,7 @@ class CEventNotifier
8790 CEventNotifierCallback::CID FindFreeCid ()
8891 {
8992 ScopeLock lock (&m_lock);
90- auto it = std::find (m_callbacks.begin (), m_callbacks.end (), nullptr );
93+ auto it = std::find (m_callbacks.begin (), m_callbacks.end (), static_cast <CEventNotifierCallback*>( nullptr ) );
9194 return (it == m_callbacks.end ()) ? CEventNotifierCallback::INVALID_CID :
9295 std::distance (m_callbacks.begin (), it);
9396 }
@@ -96,7 +99,7 @@ class CEventNotifier
9699 CEventNotifierCallback::CID RegisterCallback (CEventNotifierCallback* cb)
97100 {
98101 ScopeLock lock (&m_lock);
99- auto it = std::find (m_callbacks.begin (), m_callbacks.end (), nullptr );
102+ auto it = std::find (m_callbacks.begin (), m_callbacks.end (), static_cast <CEventNotifierCallback*>( nullptr ) );
100103 return (it == m_callbacks.end ()) ? (m_callbacks.emplace_back (cb), m_callbacks.size () - 1 ) :
101104 (it->callback .reset (cb), std::distance (m_callbacks.begin (), it));
102105 }
@@ -203,7 +206,7 @@ class CEventNotifier
203206 CEventNotifierCallback::CID CreateRegisteredCallback (unsigned int event_id, Args&&... args)
204207 {
205208 R_ASSERT (event_id < CNT);
206- return m_callbacks[event_id].CreateRegisteredCallback <CB>(args...);
209+ return m_callbacks[event_id].template CreateRegisteredCallback <CB>(args...);
207210 }
208211
209212 /* ! \brief Provides the way to unsubscribe and delete the callback
0 commit comments