mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
get_element, set_element
This commit is contained in:
parent
a759e21eeb
commit
0105b1fd89
@ -312,6 +312,37 @@ operator [](int n) const {
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
// Function: PointerToArray::push_back
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -152,6 +152,9 @@ PUBLISHED:
|
|||||||
INLINE reference operator [](size_type n) const;
|
INLINE reference operator [](size_type n) const;
|
||||||
INLINE reference operator [](int n) const;
|
INLINE reference operator [](int n) const;
|
||||||
#endif
|
#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 push_back(const Element &x);
|
||||||
INLINE void pop_back();
|
INLINE void pop_back();
|
||||||
INLINE void make_empty();
|
INLINE void make_empty();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user