I'm doing a Class similar to the list Class with several functions: push_back, push_front, pop_back, pop_front, etc...
I overloaded the subscript operator of my class to access my pointer :
reference operator[](size_t idx) {
return buffer[i_physical(idx)];
}
const_reference operator[](size_type idx) const {
return buffer[i_physical(idx)];
}
To avoid writing this every time
buffer[i_physical(i)].~value_type();
new(&buffer[i_physical(i)]) value_type(v);
I'd like to be able to access the subscript operator directly in my Class, something like this
this->[i].~value_type();
new(&(*this)[i]) value_type(v);
Thanks
Aucun commentaire:
Enregistrer un commentaire