Add some noexcept to pointer policies
This commit is contained in:
parent
34870eb353
commit
f44415cee4
|
@ -14,7 +14,7 @@ struct RefCountable
|
|||
|
||||
struct RefCountablePolicy
|
||||
{
|
||||
static void inc_ref(RefCountable* r, void*) { ++r->refcount; }
|
||||
static void inc_ref(RefCountable* r, void*) noexcept { ++r->refcount; }
|
||||
static void dec_ref(RefCountable* r, void*) { if (--r->refcount == 0) delete r; }
|
||||
static void ptr_moved(RefCountable*, void*, void*) noexcept {}
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@ private:
|
|||
struct SafeCountablePolicy
|
||||
{
|
||||
#ifdef KAK_DEBUG
|
||||
static void inc_ref(const SafeCountable* sc, void* ptr)
|
||||
static void inc_ref(const SafeCountable* sc, void* ptr) noexcept
|
||||
{
|
||||
++sc->m_count;
|
||||
#ifdef SAFE_PTR_TRACK_CALLSTACKS
|
||||
|
@ -60,7 +60,7 @@ struct SafeCountablePolicy
|
|||
#endif
|
||||
}
|
||||
|
||||
static void dec_ref(const SafeCountable* sc, void* ptr)
|
||||
static void dec_ref(const SafeCountable* sc, void* ptr) noexcept
|
||||
{
|
||||
--sc->m_count;
|
||||
kak_assert(sc->m_count >= 0);
|
||||
|
@ -72,7 +72,7 @@ struct SafeCountablePolicy
|
|||
#endif
|
||||
}
|
||||
|
||||
static void ptr_moved(const SafeCountable* sc, void* from, void* to)
|
||||
static void ptr_moved(const SafeCountable* sc, void* from, void* to) noexcept
|
||||
{
|
||||
#ifdef SAFE_PTR_TRACK_CALLSTACKS
|
||||
auto it = std::find_if(sc->m_callstacks.begin(), sc->m_callstacks.end(),
|
||||
|
@ -82,9 +82,9 @@ struct SafeCountablePolicy
|
|||
#endif
|
||||
}
|
||||
#else
|
||||
static void inc_ref(const SafeCountable*, void* ptr) {}
|
||||
static void dec_ref(const SafeCountable*, void* ptr) {}
|
||||
static void ptr_moved(const SafeCountable*, void*, void*) {}
|
||||
static void inc_ref(const SafeCountable*, void* ptr) noexcept {}
|
||||
static void dec_ref(const SafeCountable*, void* ptr) noexcept {}
|
||||
static void ptr_moved(const SafeCountable*, void*, void*) noexcept {}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user