add pop_back/pop_front/push_back/push_front to array, to make it according to doc, fixes #3040

This commit is contained in:
Juan Linietsky 2015-12-12 08:27:30 -03:00
parent a73cf7f794
commit b191e740d2
3 changed files with 29 additions and 1 deletions

View file

@ -222,6 +222,24 @@ void Array::invert(){
}
void Array::push_front(const Variant& p_value) {
_p->array.insert(0,p_value);
}
void Array::pop_back(){
if (!_p->array.empty())
_p->array.resize( _p->array.size() -1 );
}
void Array::pop_front(){
if (!_p->array.empty())
_p->array.remove(0);
}
Array::Array(const Array& p_from) {