This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

V3 PATCH: valarray fixes (4)


This fixes a thinko in a previous patch -- see PR/7491.

Testcase will follow.
Mainline.

-- Gaby

2002-08-05  Gabriel Dos Reis  <gdr@nerim.net>

	PR/7491
	* include/bits/slice_array.h(_DEFINE_VALARRAY_OPERATOR):
	Instantiate with new function objects. 
	* include/bits/mask_array.h (_DEFINE_VALARRAY_OPERATOR): Likewise.
	Reformat.  Uglify.
	* include/bits/gslice_array.h: Likewise.
	* include/bits/indirect_array.h: Likewise.

Index: include/bits/gslice_array.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/gslice_array.h,v
retrieving revision 1.5
diff -p -r1.5 gslice_array.h
*** include/bits/gslice_array.h	19 Jul 2002 04:45:20 -0000	1.5
--- include/bits/gslice_array.h	4 Aug 2002 23:53:11 -0000
***************
*** 41,169 ****
  
  namespace std {
  
!     template<typename _Tp> class gslice_array
      {
      public:
!         typedef _Tp value_type;
  
!         void operator=  (const valarray<_Tp>&) const;
!         void operator*= (const valarray<_Tp>&) const;
!         void operator/= (const valarray<_Tp>&) const;
!         void operator%= (const valarray<_Tp>&) const;
!         void operator+= (const valarray<_Tp>&) const;
!         void operator-= (const valarray<_Tp>&) const;
!         void operator^= (const valarray<_Tp>&) const;
!         void operator&= (const valarray<_Tp>&) const;
!         void operator|= (const valarray<_Tp>&) const;
!         void operator<<=(const valarray<_Tp>&) const;
!         void operator>>=(const valarray<_Tp>&) const;
!         void operator=(const _Tp&) const;
! 
!         template<class _Dom>
!         void operator= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator*= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator/= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator%= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator+= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator-= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator^= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator&= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator|= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator<<= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator>>= (const _Expr<_Dom,_Tp>&) const;
          
      private:
!         _Array<_Tp>    _M_array;
!         const valarray<size_t>& _M_index;
          
!         friend class valarray<_Tp>;
!         
!         gslice_array (_Array<_Tp>, const valarray<size_t>&);
! 
!         // this constructor needs to be implemented.
!         gslice_array (const gslice_array&);
! 
!         // not implemented
!         gslice_array();
!         gslice_array& operator= (const gslice_array&);
      };
  
!     template<typename _Tp>
      inline
!     gslice_array<_Tp>::gslice_array (_Array<_Tp> __a,
!                                      const valarray<size_t>& __i)
!             : _M_array (__a), _M_index (__i) {}
  
  
!     template<typename _Tp>
      inline
!     gslice_array<_Tp>::gslice_array (const gslice_array<_Tp>& __a)
!             : _M_array (__a._M_array), _M_index (__a._M_index) {}
  
      
!     template<typename _Tp>
      inline void
!     gslice_array<_Tp>::operator= (const _Tp& __t) const
      { 
!         __valarray_fill (_M_array, _Array<size_t>(_M_index),
!                          _M_index.size(), __t); 
      }
  
!     template<typename _Tp>
      inline void
!     gslice_array<_Tp>::operator= (const valarray<_Tp>& __v) const
      {
!         __valarray_copy (_Array<_Tp> (__v), __v.size (),
!                          _M_array, _Array<size_t>(_M_index));
      }
  
!     template<typename _Tp>
!     template<class E>
!     inline void
!     gslice_array<_Tp>::operator= (const _Expr<E, _Tp>& __e) const
!     {
!         __valarray_copy (__e, _M_index.size(), _M_array,
!                          _Array<size_t>(_M_index));
!     }
  
  #undef _DEFINE_VALARRAY_OPERATOR
! #define _DEFINE_VALARRAY_OPERATOR(op, name)				\
! template<typename _Tp>							\
! inline void								\
! gslice_array<_Tp>::operator op##= (const valarray<_Tp>& __v) const	\
! {									\
!     _Array_augmented_##name (_M_array, _Array<size_t>(_M_index),	\
!                               _Array<_Tp> (__v), __v.size ());		\
! }									\
  									\
! template<typename _Tp> template<class E>        			\
! inline void 								\
! gslice_array<_Tp>::operator op##= (const _Expr<E, _Tp>& __e) const	\
! {									\
!     _Array_augmented_##name (_M_array, _Array<size_t>(_M_index), __e,	\
!                               _M_index.size());				\
! }
! 
! _DEFINE_VALARRAY_OPERATOR(*, multiplies)
! _DEFINE_VALARRAY_OPERATOR(/, divides)    
! _DEFINE_VALARRAY_OPERATOR(%, modulus)
! _DEFINE_VALARRAY_OPERATOR(+, plus)    
! _DEFINE_VALARRAY_OPERATOR(-, minus)
! _DEFINE_VALARRAY_OPERATOR(^, xor)
! _DEFINE_VALARRAY_OPERATOR(&, and)
! _DEFINE_VALARRAY_OPERATOR(|, or)
! _DEFINE_VALARRAY_OPERATOR(<<, shift_left)
! _DEFINE_VALARRAY_OPERATOR(>>, shift_right)
  
  #undef _DEFINE_VALARRAY_OPERATOR
  
--- 41,171 ----
  
  namespace std {
  
!   template<typename _Tp>
!     class gslice_array
      {
      public:
!       typedef _Tp value_type;
  
!       void operator=(const valarray<_Tp>&) const;
!       void operator*=(const valarray<_Tp>&) const;
!       void operator/=(const valarray<_Tp>&) const;
!       void operator%=(const valarray<_Tp>&) const;
!       void operator+=(const valarray<_Tp>&) const;
!       void operator-=(const valarray<_Tp>&) const;
!       void operator^=(const valarray<_Tp>&) const;
!       void operator&=(const valarray<_Tp>&) const;
!       void operator|=(const valarray<_Tp>&) const;
!       void operator<<=(const valarray<_Tp>&) const;
!       void operator>>=(const valarray<_Tp>&) const;
!       void operator=(const _Tp&) const;
! 
!       template<class _Dom>
!         void operator=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator*=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator/=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator%=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator+=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator-=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator^=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator&=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator|=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator<<=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator>>=(const _Expr<_Dom,_Tp>&) const;
          
      private:
!       _Array<_Tp>    _M_array;
!       const valarray<size_t>& _M_index;
          
!       friend class valarray<_Tp>;
!       
!       gslice_array(_Array<_Tp>, const valarray<size_t>&);
! 
!       // this constructor needs to be implemented.
!       gslice_array(const gslice_array&);
! 
!       // not implemented
!       gslice_array();
!       gslice_array& operator= (const gslice_array&);
      };
  
!   template<typename _Tp>
      inline
!     gslice_array<_Tp>::gslice_array(_Array<_Tp> __a,
! 				    const valarray<size_t>& __i)
!       : _M_array(__a), _M_index(__i) {}
  
  
!   template<typename _Tp>
      inline
!     gslice_array<_Tp>::gslice_array(const gslice_array<_Tp>& __a)
!       : _M_array(__a._M_array), _M_index(__a._M_index) {}
  
      
!   template<typename _Tp>
      inline void
!     gslice_array<_Tp>::operator=(const _Tp& __t) const
      { 
!       __valarray_fill(_M_array, _Array<size_t>(_M_index),
! 		      _M_index.size(), __t); 
      }
  
!   template<typename _Tp>
      inline void
!     gslice_array<_Tp>::operator=(const valarray<_Tp>& __v) const
      {
!       __valarray_copy(_Array<_Tp>(__v), __v.size(),
! 		      _M_array, _Array<size_t>(_M_index));
      }
  
!   template<typename _Tp>
!     template<class _Dom>
!       inline void
!       gslice_array<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) const
!       {
! 	__valarray_copy (__e, _M_index.size(), _M_array,
! 			 _Array<size_t>(_M_index));
!       }
  
  #undef _DEFINE_VALARRAY_OPERATOR
! #define _DEFINE_VALARRAY_OPERATOR(_Op, _Name)				\
!   template<typename _Tp>						\
!     inline void								\
!     gslice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const	\
!     {									\
!       _Array_augmented_##_Name(_M_array, _Array<size_t>(_M_index),	\
! 			      _Array<_Tp>(__v), __v.size());		\
!     }									\
  									\
!   template<typename _Tp>                                                \
!     template<class _Dom>        			                \
!       inline void 							\
!       gslice_array<_Tp>::operator _Op##= (const _Expr<_Dom, _Tp>& __e) const\
!       {									\
! 	_Array_augmented_##_Name(_M_array, _Array<size_t>(_M_index), __e,\
! 				 _M_index.size());			\
!       }
! 
! _DEFINE_VALARRAY_OPERATOR(*, __multiplies)
! _DEFINE_VALARRAY_OPERATOR(/, __divides)    
! _DEFINE_VALARRAY_OPERATOR(%, __modulus)
! _DEFINE_VALARRAY_OPERATOR(+, __plus)    
! _DEFINE_VALARRAY_OPERATOR(-, __minus)
! _DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)
! _DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)
! _DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)
! _DEFINE_VALARRAY_OPERATOR(<<, __shift_left)
! _DEFINE_VALARRAY_OPERATOR(>>, __shift_right)
  
  #undef _DEFINE_VALARRAY_OPERATOR
  
Index: include/bits/indirect_array.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/indirect_array.h,v
retrieving revision 1.6
diff -p -r1.6 indirect_array.h
*** include/bits/indirect_array.h	19 Jul 2002 04:45:20 -0000	1.6
--- include/bits/indirect_array.h	4 Aug 2002 23:53:11 -0000
***************
*** 1,6 ****
  // The template and inlines for the -*- C++ -*- indirect_array class.
  
! // Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
  // software; you can redistribute it and/or modify it under the
--- 1,7 ----
  // The template and inlines for the -*- C++ -*- indirect_array class.
  
! // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
! //  Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
  // software; you can redistribute it and/or modify it under the
*************** namespace std
*** 48,117 ****
         typedef _Tp value_type;
  
         // XXX: This is a proposed resolution for DR-253.
!        indirect_array& operator= (const indirect_array&);
! 
!        void operator=  (const valarray<_Tp>&) const;
!        void operator*= (const valarray<_Tp>&) const;
!        void operator/= (const valarray<_Tp>&) const;
!        void operator%= (const valarray<_Tp>&) const; 
!        void operator+= (const valarray<_Tp>&) const;
!        void operator-= (const valarray<_Tp>&) const;  
!        void operator^= (const valarray<_Tp>&) const;
!        void operator&= (const valarray<_Tp>&) const;
!        void operator|= (const valarray<_Tp>&) const;
!        void operator<<= (const valarray<_Tp>&) const;
!        void operator>>= (const valarray<_Tp>&) const; 
         void operator= (const _Tp&) const;
         //    ~indirect_array();
! 
         template<class _Dom>
!        void operator=  (const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!        void operator*= (const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!        void operator/= (const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!        void operator%= (const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!        void operator+= (const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!        void operator-= (const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!        void operator^= (const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!        void operator&= (const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!        void operator|= (const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!        void operator<<= (const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!        void operator>>= (const _Expr<_Dom, _Tp>&) const; 
  
       private:
!        indirect_array (const indirect_array&);
!        indirect_array (_Array<_Tp>, size_t, _Array<size_t>);
  
         friend class valarray<_Tp>;
         friend class gslice_array<_Tp>;
! 
         const size_t 	 _M_sz;
         const _Array<size_t> _M_index;
         const _Array<_Tp> 	 _M_array;
! 
         // not implemented
!        indirect_array ();
       };
  
    template<typename _Tp>
!   inline indirect_array<_Tp>::indirect_array(const indirect_array<_Tp>& __a)
!           : _M_sz (__a._M_sz), _M_index (__a._M_index),
!             _M_array (__a._M_array) {}
  
    template<typename _Tp>
       inline
!      indirect_array<_Tp>::indirect_array (_Array<_Tp> __a, size_t __s, 
!                                           _Array<size_t> __i)
!              : _M_sz (__s), _M_index (__i), _M_array (__a) {}
  
    template<typename _Tp>
       inline indirect_array<_Tp>&
--- 49,118 ----
         typedef _Tp value_type;
  
         // XXX: This is a proposed resolution for DR-253.
!        indirect_array& operator=(const indirect_array&);
!        
!        void operator=(const valarray<_Tp>&) const;
!        void operator*=(const valarray<_Tp>&) const;
!        void operator/=(const valarray<_Tp>&) const;
!        void operator%=(const valarray<_Tp>&) const; 
!        void operator+=(const valarray<_Tp>&) const;
!        void operator-=(const valarray<_Tp>&) const;  
!        void operator^=(const valarray<_Tp>&) const;
!        void operator&=(const valarray<_Tp>&) const;
!        void operator|=(const valarray<_Tp>&) const;
!        void operator<<=(const valarray<_Tp>&) const;
!        void operator>>=(const valarray<_Tp>&) const; 
         void operator= (const _Tp&) const;
         //    ~indirect_array();
!        
         template<class _Dom>
!          void operator=(const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!          void operator*=(const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!          void operator/=(const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!          void operator%=(const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!          void operator+=(const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!          void operator-=(const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!          void operator^=(const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!          void operator&=(const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!          void operator|=(const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!          void operator<<=(const _Expr<_Dom, _Tp>&) const;
         template<class _Dom>
!          void operator>>=(const _Expr<_Dom, _Tp>&) const; 
  
       private:
!        indirect_array(const indirect_array&);
!        indirect_array(_Array<_Tp>, size_t, _Array<size_t>);
  
         friend class valarray<_Tp>;
         friend class gslice_array<_Tp>;
!        
         const size_t 	 _M_sz;
         const _Array<size_t> _M_index;
         const _Array<_Tp> 	 _M_array;
!        
         // not implemented
!        indirect_array();
       };
  
    template<typename _Tp>
!     inline 
!     indirect_array<_Tp>::indirect_array(const indirect_array<_Tp>& __a)
!       : _M_sz(__a._M_sz), _M_index(__a._M_index), _M_array(__a._M_array) {}
  
    template<typename _Tp>
       inline
!      indirect_array<_Tp>::indirect_array(_Array<_Tp> __a, size_t __s, 
! 					 _Array<size_t> __i)
!        : _M_sz(__s), _M_index(__i), _M_array(__a) {}
  
    template<typename _Tp>
       inline indirect_array<_Tp>&
*************** namespace std
*** 124,169 ****
  
    template<typename _Tp>
       inline void
!      indirect_array<_Tp>::operator= (const _Tp& __t) const
       { __valarray_fill(_M_array, _M_index, _M_sz, __t); }
  
    template<typename _Tp>
       inline void
!      indirect_array<_Tp>::operator= (const valarray<_Tp>& __v) const
!      { __valarray_copy (_Array<_Tp> (__v), _M_sz, _M_array, _M_index); }
  
    template<typename _Tp>
       template<class _Dom>
!      inline void
!      indirect_array<_Tp>::operator= (const _Expr<_Dom,_Tp>& __e) const
!      { __valarray_copy (__e, _M_sz, _M_array, _M_index); }
  
  #undef _DEFINE_VALARRAY_OPERATOR
! #define _DEFINE_VALARRAY_OPERATOR(op, name)				\
! template<typename _Tp>							\
! inline void								\
! indirect_array<_Tp>::operator op##= (const valarray<_Tp>& __v) const	\
! {									\
!   _Array_augmented_##name (_M_array, _M_index, _Array<_Tp> (__v), _M_sz); \
! }									\
  									\
! template<typename _Tp> template<class _Dom>				\
! inline void								\
! indirect_array<_Tp>::operator op##= (const _Expr<_Dom,_Tp>& __e) const \
! {									\
!   _Array_augmented_##name (_M_array, _M_index, __e, _M_sz);		\
! }
! 
! _DEFINE_VALARRAY_OPERATOR(*, multiplies)
! _DEFINE_VALARRAY_OPERATOR(/, divides)
! _DEFINE_VALARRAY_OPERATOR(%, modulus)
! _DEFINE_VALARRAY_OPERATOR(+, plus)
! _DEFINE_VALARRAY_OPERATOR(-, minus)
! _DEFINE_VALARRAY_OPERATOR(^, xor)
! _DEFINE_VALARRAY_OPERATOR(&, and)
! _DEFINE_VALARRAY_OPERATOR(|, or)
! _DEFINE_VALARRAY_OPERATOR(<<, shift_left)
! _DEFINE_VALARRAY_OPERATOR(>>, shift_right)
  
  #undef _DEFINE_VALARRAY_OPERATOR
  
--- 125,171 ----
  
    template<typename _Tp>
       inline void
!      indirect_array<_Tp>::operator=(const _Tp& __t) const
       { __valarray_fill(_M_array, _M_index, _M_sz, __t); }
  
    template<typename _Tp>
       inline void
!      indirect_array<_Tp>::operator=(const valarray<_Tp>& __v) const
!      { __valarray_copy(_Array<_Tp>(__v), _M_sz, _M_array, _M_index); }
  
    template<typename _Tp>
       template<class _Dom>
!        inline void
!        indirect_array<_Tp>::operator=(const _Expr<_Dom,_Tp>& __e) const
!        { __valarray_copy(__e, _M_sz, _M_array, _M_index); }
  
  #undef _DEFINE_VALARRAY_OPERATOR
! #define _DEFINE_VALARRAY_OPERATOR(_Op, _Name)				\
!   template<typename _Tp>						\
!     inline void								\
!     indirect_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const\
!     {									\
!       _Array_augmented_##_Name(_M_array, _M_index, _Array<_Tp>(__v), _M_sz); \
!     }									\
  									\
!   template<typename _Tp>                                                \
!     template<class _Dom>				                \
!       inline void							\
!       indirect_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\
!       {									\
! 	_Array_augmented_##_Name(_M_array, _M_index, __e, _M_sz);	\
!       }
! 
! _DEFINE_VALARRAY_OPERATOR(*, __multiplies)
! _DEFINE_VALARRAY_OPERATOR(/, __divides)
! _DEFINE_VALARRAY_OPERATOR(%, __modulus)
! _DEFINE_VALARRAY_OPERATOR(+, __plus)
! _DEFINE_VALARRAY_OPERATOR(-, __minus)
! _DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)
! _DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)
! _DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)
! _DEFINE_VALARRAY_OPERATOR(<<, __shift_left)
! _DEFINE_VALARRAY_OPERATOR(>>, __shift_right)
  
  #undef _DEFINE_VALARRAY_OPERATOR
  
Index: include/bits/mask_array.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/mask_array.h,v
retrieving revision 1.5
diff -p -r1.5 mask_array.h
*** include/bits/mask_array.h	19 Jul 2002 04:45:20 -0000	1.5
--- include/bits/mask_array.h	4 Aug 2002 23:53:11 -0000
***************
*** 1,6 ****
  // The template and inlines for the -*- C++ -*- mask_array class.
  
! // Copyright (C) 1997-2001 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
  // software; you can redistribute it and/or modify it under the
--- 1,7 ----
  // The template and inlines for the -*- C++ -*- mask_array class.
  
! // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
! //  Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
  // software; you can redistribute it and/or modify it under the
***************
*** 41,160 ****
  
  namespace std {
  
!     template <class _Tp> class mask_array
      { 
      public:
!         typedef _Tp value_type;
      
!         void operator=  (const valarray<_Tp>&) const;
!         void operator*= (const valarray<_Tp>&) const;
!         void operator/= (const valarray<_Tp>&) const;
!         void operator%= (const valarray<_Tp>&) const;
!         void operator+= (const valarray<_Tp>&) const; 
!         void operator-= (const valarray<_Tp>&) const;
!         void operator^= (const valarray<_Tp>&) const;  
!         void operator&= (const valarray<_Tp>&) const;
!         void operator|= (const valarray<_Tp>&) const;
!         void operator<<=(const valarray<_Tp>&) const;  
!         void operator>>=(const valarray<_Tp>&) const; 
!         void operator= (const _Tp&) const;
      
          //        ~mask_array ();
          
!         template<class _Dom>
!         void operator=  (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator*= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator/= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator%= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator+= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator-= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator^= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator&= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
!         void operator|= (const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
          void operator<<=(const _Expr<_Dom,_Tp>&) const;
!         template<class _Dom>
          void operator>>=(const _Expr<_Dom,_Tp>&) const; 
  
      private:
!         mask_array (_Array<_Tp>, size_t, _Array<bool>);
!         friend class valarray<_Tp>;
          
!         const size_t       _M_sz;
!         const _Array<bool> _M_mask;
!         const _Array<_Tp>   _M_array;
!         
!         mask_array (const mask_array&);
!         
!         // not implemented
!         mask_array ();
!         mask_array& operator= (const mask_array&);
      };
  
  
!     template<typename _Tp>
!     inline mask_array<_Tp>::mask_array (const mask_array<_Tp>& a)
!             : _M_sz (a._M_sz), _M_mask (a._M_mask), _M_array (a._M_array) {}
  
!     template<typename _Tp>
      inline 
!     mask_array<_Tp>::mask_array (_Array<_Tp> __a, size_t __s, _Array<bool> __m)
!             : _M_sz (__s), _M_mask (__m), _M_array (__a) {}
      
!     //    template<typename _Tp>
!     //    inline mask_array<_Tp>::~mask_array () {}
!     
!     template<typename _Tp>
      inline void
!     mask_array<_Tp>::operator= (const _Tp& __t) const
!     { __valarray_fill (_M_array, _M_sz, _M_mask, __t); }
      
!     template<typename _Tp>
      inline void
!     mask_array<_Tp>::operator= (const valarray<_Tp>& __v) const
!     { __valarray_copy (_Array<_Tp> (__v), __v.size (), _M_array, _M_mask); }
  
!     template<typename _Tp>
!     template<class E>
!     inline void
!     mask_array<_Tp>::operator= (const _Expr<E, _Tp>& __e) const
!     { __valarray_copy (__e, __e.size (), _M_array, _M_mask); }
  
  #undef _DEFINE_VALARRAY_OPERATOR
! #define _DEFINE_VALARRAY_OPERATOR(op, name)				\
! template<typename _Tp>							\
! inline void								\
! mask_array<_Tp>::operator op##= (const valarray<_Tp>& __v) const	\
! {									\
!   _Array_augmented_##name (_M_array, _M_mask, 				\
!                            _Array<_Tp> (__v), __v.size ());		\
! }									\
  									\
! template<typename _Tp> template<class E>				\
! inline void								\
! mask_array<_Tp>::operator op##= (const _Expr<E, _Tp>& __e) const	\
! {									\
!   _Array_augmented_##name (_M_array, _M_mask, __e, __e.size ());	\
! }
! 
! _DEFINE_VALARRAY_OPERATOR(*, multiplies)
! _DEFINE_VALARRAY_OPERATOR(/, divides)
! _DEFINE_VALARRAY_OPERATOR(%, modulus)
! _DEFINE_VALARRAY_OPERATOR(+, plus)
! _DEFINE_VALARRAY_OPERATOR(-, minus)
! _DEFINE_VALARRAY_OPERATOR(^, xor)
! _DEFINE_VALARRAY_OPERATOR(&, and)
! _DEFINE_VALARRAY_OPERATOR(|, or)
! _DEFINE_VALARRAY_OPERATOR(<<, shift_left)
! _DEFINE_VALARRAY_OPERATOR(>>, shift_right)
  
  #undef _DEFINE_VALARRAY_OPERATOR    
      
--- 42,160 ----
  
  namespace std {
  
!   template <class _Tp> 
!     class mask_array
      { 
      public:
!       typedef _Tp value_type;
      
!       void operator=(const valarray<_Tp>&) const;
!       void operator*=(const valarray<_Tp>&) const;
!       void operator/=(const valarray<_Tp>&) const;
!       void operator%=(const valarray<_Tp>&) const;
!       void operator+=(const valarray<_Tp>&) const; 
!       void operator-=(const valarray<_Tp>&) const;
!       void operator^=(const valarray<_Tp>&) const;  
!       void operator&=(const valarray<_Tp>&) const;
!       void operator|=(const valarray<_Tp>&) const;
!       void operator<<=(const valarray<_Tp>&) const;  
!       void operator>>=(const valarray<_Tp>&) const; 
!       void operator=(const _Tp&) const;
      
          //        ~mask_array ();
          
!       template<class _Dom>
!         void operator=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator*=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator/=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator%=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator+=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator-=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator^=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator&=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
!         void operator|=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
          void operator<<=(const _Expr<_Dom,_Tp>&) const;
!       template<class _Dom>
          void operator>>=(const _Expr<_Dom,_Tp>&) const; 
  
      private:
!       mask_array(_Array<_Tp>, size_t, _Array<bool>);
!       friend class valarray<_Tp>;
          
!       const size_t       _M_sz;
!       const _Array<bool> _M_mask;
!       const _Array<_Tp>   _M_array;
!       
!       mask_array (const mask_array&);
!       
!       // not implemented
!       mask_array();
!       mask_array& operator=(const mask_array&);
      };
  
  
!   template<typename _Tp>
!     inline mask_array<_Tp>::mask_array(const mask_array<_Tp>& a)
!       : _M_sz(a._M_sz), _M_mask(a._M_mask), _M_array(a._M_array) {}
  
!   template<typename _Tp>
      inline 
!     mask_array<_Tp>::mask_array(_Array<_Tp> __a, size_t __s, _Array<bool> __m)
!       : _M_sz(__s), _M_mask(__m), _M_array(__a) {}
      
!   template<typename _Tp>
      inline void
!     mask_array<_Tp>::operator=(const _Tp& __t) const
!     { __valarray_fill(_M_array, _M_sz, _M_mask, __t); }
      
!   template<typename _Tp>
      inline void
!     mask_array<_Tp>::operator=(const valarray<_Tp>& __v) const
!     { __valarray_copy(_Array<_Tp>(__v), __v.size(), _M_array, _M_mask); }
  
!   template<typename _Tp>
!     template<class _Ex>
!       inline void
!       mask_array<_Tp>::operator=(const _Expr<_Ex, _Tp>& __e) const
!       { __valarray_copy(__e, __e.size(), _M_array, _M_mask); }
  
  #undef _DEFINE_VALARRAY_OPERATOR
! #define _DEFINE_VALARRAY_OPERATOR(_Op, _Name)				\
!   template<typename _Tp>						\
!     inline void								\
!     mask_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const	\
!     {									\
!       _Array_augmented_##_Name(_M_array, _M_mask,			\
! 			       _Array<_Tp>(__v), __v.size());		\
!     }									\
  									\
!   template<typename _Tp>                                                \
!     template<class _Dom>			                        \
!       inline void							\
!       mask_array<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) const\
!       {									\
! 	_Array_augmented_##_Name(_M_array, _M_mask, __e, __e.size());   \
!       }
! 
! _DEFINE_VALARRAY_OPERATOR(*, __multiplies)
! _DEFINE_VALARRAY_OPERATOR(/, __divides)
! _DEFINE_VALARRAY_OPERATOR(%, __modulus)
! _DEFINE_VALARRAY_OPERATOR(+, __plus)
! _DEFINE_VALARRAY_OPERATOR(-, __minus)
! _DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)
! _DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)
! _DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)
! _DEFINE_VALARRAY_OPERATOR(<<, __shift_left)
! _DEFINE_VALARRAY_OPERATOR(>>, __shift_right)
  
  #undef _DEFINE_VALARRAY_OPERATOR    
      
Index: include/bits/slice_array.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/slice_array.h,v
retrieving revision 1.9
diff -p -r1.9 slice_array.h
*** include/bits/slice_array.h	19 Jul 2002 04:51:42 -0000	1.9
--- include/bits/slice_array.h	4 Aug 2002 23:53:11 -0000
*************** namespace std
*** 169,209 ****
    template<typename _Tp>
      inline void
      slice_array<_Tp>::operator=(const valarray<_Tp>& __v) const
!     { __valarray_copy (_Array<_Tp> (__v), _M_array, _M_sz, _M_stride); }
      
    template<typename _Tp>
    template<class _Dom>
      inline void
      slice_array<_Tp>::operator=(const _Expr<_Dom,_Tp>& __e) const
!     { __valarray_copy (__e, _M_sz, _M_array, _M_stride); }
  
  #undef _DEFINE_VALARRAY_OPERATOR
  #define _DEFINE_VALARRAY_OPERATOR(_Op,_Name)				\
! template<typename _Tp>							\
! inline void								\
! slice_array<_Tp>::operator _Op##= (const valarray<_Tp>& __v) const	\
! {									\
!   _Array_augmented_##_Name (_M_array, _M_sz, _M_stride, _Array<_Tp> (__v));\
! }									\
  									\
! template<typename _Tp> template<class _Dom>				\
! inline void								\
! slice_array<_Tp>::operator _Op##= (const _Expr<_Dom,_Tp>& __e) const	\
! {									\
!     _Array_augmented_##_Name (_M_array, _M_stride, __e, _M_sz);		\
! }
          
  
! _DEFINE_VALARRAY_OPERATOR(*, multiplies)
! _DEFINE_VALARRAY_OPERATOR(/, divides)
! _DEFINE_VALARRAY_OPERATOR(%, modulus)
! _DEFINE_VALARRAY_OPERATOR(+, plus)
! _DEFINE_VALARRAY_OPERATOR(-, minus)
! _DEFINE_VALARRAY_OPERATOR(^, xor)
! _DEFINE_VALARRAY_OPERATOR(&, and)
! _DEFINE_VALARRAY_OPERATOR(|, or)
! _DEFINE_VALARRAY_OPERATOR(<<, shift_left)
! _DEFINE_VALARRAY_OPERATOR(>>, shift_right)
  
  #undef _DEFINE_VALARRAY_OPERATOR
  
--- 169,210 ----
    template<typename _Tp>
      inline void
      slice_array<_Tp>::operator=(const valarray<_Tp>& __v) const
!     { __valarray_copy(_Array<_Tp>(__v), _M_array, _M_sz, _M_stride); }
      
    template<typename _Tp>
    template<class _Dom>
      inline void
      slice_array<_Tp>::operator=(const _Expr<_Dom,_Tp>& __e) const
!     { __valarray_copy(__e, _M_sz, _M_array, _M_stride); }
  
  #undef _DEFINE_VALARRAY_OPERATOR
  #define _DEFINE_VALARRAY_OPERATOR(_Op,_Name)				\
!   template<typename _Tp>						\
!     inline void								\
!     slice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const	\
!     {									\
!       _Array_augmented_##_Name(_M_array, _M_sz, _M_stride, _Array<_Tp>(__v));\
!     }									\
  									\
!   template<typename _Tp>                                                \
!     template<class _Dom>				                \
!       inline void							\
!       slice_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\
!       {									\
! 	  _Array_augmented_##_Name(_M_array, _M_stride, __e, _M_sz);	\
!       }
          
  
! _DEFINE_VALARRAY_OPERATOR(*, __multiplies)
! _DEFINE_VALARRAY_OPERATOR(/, __divides)
! _DEFINE_VALARRAY_OPERATOR(%, __modulus)
! _DEFINE_VALARRAY_OPERATOR(+, __plus)
! _DEFINE_VALARRAY_OPERATOR(-, __minus)
! _DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)
! _DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)
! _DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)
! _DEFINE_VALARRAY_OPERATOR(<<, __shift_left)
! _DEFINE_VALARRAY_OPERATOR(>>, __shift_right)
  
  #undef _DEFINE_VALARRAY_OPERATOR
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]