From 5d1cb7e88f7e2cd8e22be0076afadaf4a9518d3d Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 7 Nov 2008 21:21:53 +0000 Subject: [PATCH] build on windows --- panda/src/express/pointerToArray.I | 24 ++++++++++++++++++++++++ panda/src/express/pointerToArray.h | 5 ++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/panda/src/express/pointerToArray.I b/panda/src/express/pointerToArray.I index c0ea6c8ed4..22d8bcd12f 100644 --- a/panda/src/express/pointerToArray.I +++ b/panda/src/express/pointerToArray.I @@ -458,6 +458,18 @@ set_element(size_type n, const Element &value) { (*this)[n] = value; } +//////////////////////////////////////////////////////////////////// +// Function: PointerToArray::__getitem__ +// Access: Published +// Description: Same as get_element(), this returns the nth element +// of the array. +//////////////////////////////////////////////////////////////////// +template +INLINE const Element &PointerToArray:: +__getitem__(size_type n) const { + return (*this)[n]; +} + //////////////////////////////////////////////////////////////////// // Function: PointerToArray::__setitem__ // Access: Published @@ -938,6 +950,18 @@ get_element(size_type n) const { return (*this)[n]; } +//////////////////////////////////////////////////////////////////// +// Function: ConstPointerToArray::__getitem__ +// Access: Published +// Description: Same as get_element(), this returns the nth element +// of the array. +//////////////////////////////////////////////////////////////////// +template +INLINE const Element &ConstPointerToArray:: +__getitem__(size_type n) const { + return (*this)[n]; +} + //////////////////////////////////////////////////////////////////// // Function: ConstPointerToArray::get_data // Access: Published diff --git a/panda/src/express/pointerToArray.h b/panda/src/express/pointerToArray.h index 5ec52884cf..685573b3ec 100644 --- a/panda/src/express/pointerToArray.h +++ b/panda/src/express/pointerToArray.h @@ -113,7 +113,7 @@ PUBLISHED: INLINE void pop_back(); INLINE const Element &get_element(size_type n) const; INLINE void set_element(size_type n, const Element &value); - INLINE const Element &operator [](size_type n) const; + INLINE const Element &__getitem__(size_type n) const; INLINE void __setitem__(size_type n, const Element &value); INLINE string get_data() const; INLINE void set_data(const string &data); @@ -193,6 +193,7 @@ public: // Methods to help out Python and other high-level languages. INLINE const Element &get_element(size_type n) const; INLINE void set_element(size_type n, const Element &value); + INLINE const Element &__getitem__(size_type n) const; INLINE void __setitem__(size_type n, const Element &value); INLINE string get_data() const; INLINE void set_data(const string &data); @@ -255,6 +256,7 @@ PUBLISHED: typedef TYPENAME pvector::size_type size_type; INLINE size_type size() const; INLINE const Element &get_element(size_type n) const; + INLINE const Element &__getitem__(size_type n) const; INLINE string get_data() const; INLINE string get_subdata(size_type n, size_type count) const; INLINE int get_ref_count() const; @@ -312,6 +314,7 @@ PUBLISHED: // Methods to help out Python and other high-level languages. INLINE const Element &get_element(size_type n) const; + INLINE const Element &__getitem__(size_type n) const; INLINE string get_data() const; INLINE string get_subdata(size_type n, size_type count) const;