mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 20:10:17 +00:00
up
This commit is contained in:
parent
b9db2ce5fa
commit
fcf9dcf41d
@ -50,7 +50,6 @@ void* tid() {
|
|||||||
// This does not ensure to be unique when the pointer of obj->type is deleted & reused.
|
// This does not ensure to be unique when the pointer of obj->type is deleted & reused.
|
||||||
// But it is good enough for now.
|
// But it is good enough for now.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void* obj_tid(void* alt){
|
inline void* obj_tid(void* alt) { return tid<T>(); }
|
||||||
if constexpr(std::is_same_v<T, DUMMY_VAL_TP>) return alt;
|
template<>
|
||||||
return tid<T>();
|
inline void* obj_tid<Dummy>(void* alt) { return alt; }
|
||||||
}
|
|
@ -12,7 +12,7 @@ typedef PyVar PyVarRef;
|
|||||||
class PyVarList: public std::vector<PyVar> {
|
class PyVarList: public std::vector<PyVar> {
|
||||||
PyVar& at(size_t) = delete;
|
PyVar& at(size_t) = delete;
|
||||||
|
|
||||||
inline void __checkIndex(size_t i) const {
|
inline void _check_index(size_t i) const {
|
||||||
if (i >= size()){
|
if (i >= size()){
|
||||||
auto msg = "std::vector index out of range, " + std::to_string(i) + " not in [0, " + std::to_string(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);
|
throw std::out_of_range(msg);
|
||||||
@ -20,12 +20,12 @@ class PyVarList: public std::vector<PyVar> {
|
|||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
PyVar& operator[](size_t i) {
|
PyVar& operator[](size_t i) {
|
||||||
__checkIndex(i);
|
_check_index(i);
|
||||||
return std::vector<PyVar>::operator[](i);
|
return std::vector<PyVar>::operator[](i);
|
||||||
}
|
}
|
||||||
|
|
||||||
const PyVar& operator[](size_t i) const {
|
const PyVar& operator[](size_t i) const {
|
||||||
__checkIndex(i);
|
_check_index(i);
|
||||||
return std::vector<PyVar>::operator[](i);
|
return std::vector<PyVar>::operator[](i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user