get_element, set_element

This commit is contained in:
David Rose 2004-06-08 01:26:12 +00:00
parent a759e21eeb
commit 0105b1fd89
2 changed files with 34 additions and 0 deletions

View File

@ -312,6 +312,37 @@ operator [](int n) const {
}
#endif
////////////////////////////////////////////////////////////////////
// Function: PointerToArray::get_element
// Access: Published
// Description: This method exists mainly to access the elements of
// the array easily from a high-level language such as
// Python, especially on Windows, where the above index
// element accessor methods can't be defined because of
// a confusion with the pointer typecast operator.
////////////////////////////////////////////////////////////////////
template<class Element>
INLINE TYPENAME PointerToArray<Element>::const_reference PointerToArray<Element>::
get_element(size_type n) const {
return (*this)[n];
}
////////////////////////////////////////////////////////////////////
// Function: PointerToArray::set_element
// Access: Published
// Description: This method exists mainly to access the elements of
// the array easily from a high-level language such as
// Python, especially on Windows, where the above index
// element accessor methods can't be defined because of
// a confusion with the pointer typecast operator.
////////////////////////////////////////////////////////////////////
template<class Element>
INLINE void PointerToArray<Element>::
set_element(size_type n, const_reference value) {
nassertv(n < _ptr->size());
(*this)[n] = value;
}
////////////////////////////////////////////////////////////////////
// Function: PointerToArray::push_back
// Access: Published

View File

@ -152,6 +152,9 @@ PUBLISHED:
INLINE reference operator [](size_type n) const;
INLINE reference operator [](int n) const;
#endif
INLINE const_reference get_element(size_type n) const;
INLINE void set_element(size_type n, const_reference value);
INLINE void push_back(const Element &x);
INLINE void pop_back();
INLINE void make_empty();