This commit is contained in:
blueloveTH 2023-02-10 03:22:21 +08:00
parent b9db2ce5fa
commit fcf9dcf41d
2 changed files with 6 additions and 7 deletions

View File

@ -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; }

View File

@ -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);
}