blueloveTH 3 anni fa
parent
commit
fcf9dcf41d
2 ha cambiato i file con 6 aggiunte e 7 eliminazioni
  1. 3 4
      src/common.h
  2. 3 3
      src/safestl.h

+ 3 - 4
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<typename T>
-void* obj_tid(void* alt){
-    if constexpr(std::is_same_v<T, DUMMY_VAL_TP>) return alt;
-    return tid<T>();
-}
+inline void* obj_tid(void* alt) { return tid<T>(); }
+template<>
+inline void* obj_tid<Dummy>(void* alt) { return alt; }

+ 3 - 3
src/safestl.h

@@ -12,7 +12,7 @@ typedef PyVar PyVarRef;
 class PyVarList: public std::vector<PyVar> {
     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<PyVar> {
     }
 public:
     PyVar& operator[](size_t i) {
-        __checkIndex(i);
+        _check_index(i);
         return std::vector<PyVar>::operator[](i);
     }
 
     const PyVar& operator[](size_t i) const {
-        __checkIndex(i);
+        _check_index(i);
         return std::vector<PyVar>::operator[](i);
     }