[C++-sig] Patch for py++

Ganssauge, Gottfried Gottfried.Ganssauge at haufe.de
Mon Sep 11 11:17:03 CEST 2006


I had to make the following patch to
pyplusplus\code_repository\array_1.py in order to make it compile using
Visual-C++ 6.5:

Index: array_1.py
===================================================================
--- array_1.py	(Revision 494)
+++ array_1.py	(Arbeitskopie)
@@ -28,13 +28,14 @@
 
 inline void 
 raise_on_out_of_range( long unsigned int size, long unsigned int index
){
-    if( index < 0 || size <= index ){
+    if( size <= index ){
         throw std::out_of_range("index out of range");
     }
 }
 
 template< class TItemType, long unsigned int size >
 struct const_array_1_t{
+    typedef boost::call_traits<const TItemType>::param_type ref;
 
     const_array_1_t( TItemType const * const data )
     : m_data( data ){
@@ -47,8 +48,7 @@
         return size;
     }
     
-    typename boost::call_traits<const TItemType>::param_type
-    item_ref( long unsigned int index ) const{
+    ref item_ref( long unsigned int index ) const{
         raise_on_out_of_range( size, index );
         return m_data[index];
     }
@@ -61,6 +61,7 @@
 
 template< class TItemType, long unsigned int size >
 struct array_1_t{
+    typedef boost::call_traits<const TItemType>::param_type ref;
 
     array_1_t( TItemType * data )
     : m_data( data ){
@@ -73,15 +74,14 @@
         return size;
     }
     
-    typename boost::call_traits<const TItemType>::param_type
-    item_ref( long unsigned int index ) const{
+    ref item_ref( long unsigned int index ) const{
         raise_on_out_of_range( size, index );
         return m_data[index];
     }
 
     void
     set_item( long unsigned int index
-              , typename boost::call_traits<const
TItemType>::param_type new_value ){
+              ,  ref new_value ){
         raise_on_out_of_range( size, index );
         m_data[index] = new_value;
     }

Cheers,

Gottfried 



More information about the Cplusplus-sig mailing list