From fcf9dcf41d7fb086470bf8d6a448fd1eeda3831f Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Fri, 10 Feb 2023 03:22:21 +0800 Subject: [PATCH] up --- src/common.h | 7 +++---- src/safestl.h | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/common.h b/src/common.h index ff2f1134..563d80b0 100644 --- a/src/common.h +++ b/src/common.h @@ -50,7 +50,6 @@ void* tid() { // This does not ensure to be unique when the pointer of obj->type is deleted & reused. // But it is good enough for now. template -void* obj_tid(void* alt){ - if constexpr(std::is_same_v) return alt; - return tid(); -} \ No newline at end of file +inline void* obj_tid(void* alt) { return tid(); } +template<> +inline void* obj_tid(void* alt) { return alt; } \ No newline at end of file diff --git a/src/safestl.h b/src/safestl.h index 1b059fc0..dde5d5c5 100644 --- a/src/safestl.h +++ b/src/safestl.h @@ -12,7 +12,7 @@ typedef PyVar PyVarRef; class PyVarList: public std::vector { PyVar& at(size_t) = delete; - inline void __checkIndex(size_t i) const { + inline void _check_index(size_t i) const { if (i >= size()){ auto msg = "std::vector index out of range, " + std::to_string(i) + " not in [0, " + std::to_string(size()) + ")"; throw std::out_of_range(msg); @@ -20,12 +20,12 @@ class PyVarList: public std::vector { } public: PyVar& operator[](size_t i) { - __checkIndex(i); + _check_index(i); return std::vector::operator[](i); } const PyVar& operator[](size_t i) const { - __checkIndex(i); + _check_index(i); return std::vector::operator[](i); }