This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


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

Fix for illegal token pasting in libstdc++ headers


libstdc++ (v2 and v3 both) has a number of headers that define
operator functions using macros.  All the macros use the same idiom:

#define OPERATOR(op, name, ...) \
  ... operator##op () ...

This is wrong.  It is illegal to paste an identifier or keyword with
punctuation.  See C++98 section 16.3.3 (The ## operator), paragraph 3:

	... each instance of a ## preprocessing token in the
	replacement list (not from an argument) is deleted and the
	preceding preprocessing token is concatenated with the
	following preprocessing token.  *If the result is not a valid
	preprocessing token, the behavior is undefined.*

(emphasis mine) Identical wording appears in C89 and C99.  GCC happens
to do something sensible when this situation comes up, but if you were
ever to define operator new (for example) using these macros, you
would get a single token "operatornew" which is not what you want.
Recent changes to the preprocessor have added a warning when you
attempt to paste two tokens that cannot be pasted.

A patch follows which removes all the problem pastes.  Note that we
still use ## to make "+=" out of "+" (for example); that is legitimate
and in fact necessary.  I've run the libstdc++ and g++ test suites
with the v2 change; the v3 change has not been tested because v3 still
doesn't build right for me.

If I may rant, this is one reason why writing "operator+" with no
space between the keyword and the punctuator should be considered
harmful.  It gives the false impression that the entire is a single
token, which in turn leads people to write code that does silly things
like the above.

zw

libstdc++:
	* std/gslice_array.h, std/indirect_array.h, std/mask_array.h,
	std/slice_array.h, std/std_valarray.h, std/valarray_meta.h:
	Do not paste anything after 'operator' keyword.

libstdc++-v3:
	* bits/gslice_array.h, bits/indirect_array.h, bits/mask_array.h,
	bits/slice_array.h, bits/std_valarray.h, bits/valarray_meta.h:
	Do not paste anything after 'operator' keyword.

===================================================================
Index: libstdc++/std/gslice_array.h
--- libstdc++/std/gslice_array.h	1999/09/04 15:09:21	1.2
+++ libstdc++/std/gslice_array.h	2000/07/04 16:28:22
@@ -133,7 +133,7 @@ gslice_array<_Tp>::operator= (const _Exp
 #define _DEFINE_VALARRAY_OPERATOR(op, name)				\
 template<typename _Tp>							\
 inline void								\
-gslice_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const	\
+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 ());		\
@@ -141,7 +141,7 @@ gslice_array<_Tp>::operator##op##= (cons
 									\
 template<typename _Tp> template<class E>        			\
 inline void 								\
-gslice_array<_Tp>::operator##op##= (const _Expr<E, _Tp>& __e) const	\
+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());				\
===================================================================
Index: libstdc++/std/indirect_array.h
--- libstdc++/std/indirect_array.h	1999/09/04 15:09:21	1.2
+++ libstdc++/std/indirect_array.h	2000/07/04 16:28:22
@@ -123,14 +123,14 @@ indirect_array<_Tp>::operator= (const _E
 #define _DEFINE_VALARRAY_OPERATOR(op, name)				\
 template<typename _Tp>							\
 inline void								\
-indirect_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const	\
+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 \
+indirect_array<_Tp>::operator op##= (const _Expr<_Dom,_Tp>& __e) const  \
 {									\
   _Array_augmented_##name (_M_array, _M_index, __e, _M_sz);		\
 }
===================================================================
Index: libstdc++/std/mask_array.h
--- libstdc++/std/mask_array.h	1999/09/04 15:09:21	1.2
+++ libstdc++/std/mask_array.h	2000/07/04 16:28:22
@@ -119,7 +119,7 @@ mask_array<_T>::operator= (const _Expr<E
 #define _DEFINE_VALARRAY_OPERATOR(op, name)				\
 template<typename _T>							\
 inline void								\
-mask_array<_T>::operator##op##= (const valarray<_T>& __v) const		\
+mask_array<_T>::operator op##= (const valarray<_T>& __v) const		\
 {									\
   _Array_augmented_##name (_M_array, _M_mask, 				\
                            _Array<_T> (__v), __v.size ());		\
@@ -127,7 +127,7 @@ mask_array<_T>::operator##op##= (const v
 									\
 template<typename _T> template<class E>					\
 inline void								\
-mask_array<_T>::operator##op##= (const _Expr<E, _T>& __e) const		\
+mask_array<_T>::operator op##= (const _Expr<E, _T>& __e) const		\
 {									\
   _Array_augmented_##name (_M_array, _M_mask, __e, __e.size ());	\
 }
===================================================================
Index: libstdc++/std/slice_array.h
--- libstdc++/std/slice_array.h	1999/09/04 15:09:21	1.2
+++ libstdc++/std/slice_array.h	2000/07/04 16:28:22
@@ -121,18 +121,18 @@ slice_array<_T>::operator= (const _Expr<
 #define _DEFINE_VALARRAY_OPERATOR(op, name)				\
 template<typename _T>							\
 inline void								\
-slice_array<_T>::operator##op##= (const valarray<_T>& __v) const	\
+slice_array<_T>::operator op##= (const valarray<_T>& __v) const		\
 {									\
   _Array_augmented_##name (_M_array, _M_sz, _M_stride, _Array<_T> (__v));\
 }									\
 									\
 template<typename _T> template<class _Dom>				\
 inline void								\
-slice_array<_T>::operator##op##= (const _Expr<_Dom,_T>& __e) const	\
+slice_array<_T>::operator op##= (const _Expr<_Dom,_T>& __e) const	\
 {									\
     _Array_augmented_##name (_M_array, _M_stride, __e, _M_sz);		\
 }
-        
+
 
 _DEFINE_VALARRAY_OPERATOR(*, multiplies)
 _DEFINE_VALARRAY_OPERATOR(/, divides)
===================================================================
Index: libstdc++/std/std_valarray.h
--- libstdc++/std/std_valarray.h	1999/06/05 09:41:22	1.2
+++ libstdc++/std/std_valarray.h	2000/07/04 16:28:22
@@ -567,7 +567,7 @@ valarray<_Tp>::apply (_Tp func (const _T
 #define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name)                     \
   template<typename _Tp>						\
   inline _Expr<_UnClos<_Name,_ValArray,_Tp>, _Tp>               	\
-  valarray<_Tp>::operator##_Op() const					\
+  valarray<_Tp>::operator _Op() const					\
   {									\
       typedef _UnClos<_Name,_ValArray,_Tp> _Closure;	                \
       return _Expr<_Closure, _Tp> (_Closure (*this));			\
@@ -590,7 +590,7 @@ valarray<_Tp>::apply (_Tp func (const _T
 #define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name)               \
   template<class _Tp>							\
   inline valarray<_Tp> &						\
-  valarray<_Tp>::operator##_Op##= (const _Tp &__t)			\
+  valarray<_Tp>::operator _Op##= (const _Tp &__t)			\
   {									\
       _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, __t);	\
       return *this;							\
@@ -598,7 +598,7 @@ valarray<_Tp>::apply (_Tp func (const _T
 									\
   template<class _Tp>							\
   inline valarray<_Tp> &						\
-  valarray<_Tp>::operator##_Op##= (const valarray<_Tp> &__v)		\
+  valarray<_Tp>::operator _Op##= (const valarray<_Tp> &__v)		\
   {									\
       _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, 		\
                                _Array<_Tp>(__v._M_data));		\
@@ -622,7 +622,7 @@ _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>
 #define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name)          \
   template<class _Tp> template<class _Dom>				\
   inline valarray<_Tp> &						\
-  valarray<_Tp>::operator##_Op##= (const _Expr<_Dom,_Tp> &__e)		\
+  valarray<_Tp>::operator _Op##= (const _Expr<_Dom,_Tp> &__e)		\
   {									\
       _Array_augmented_##_Name (_Array<_Tp>(_M_data), __e, _M_size);	\
       return *this;							\
@@ -645,7 +645,7 @@ _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNME
 #define _DEFINE_BINARY_OPERATOR(_Op, _Name)				\
   template<typename _Tp>						\
   inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>, _Tp>        \
-  operator##_Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w)	\
+  operator _Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w)	\
   {									\
       typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure;     \
       return _Expr<_Closure, _Tp> (_Closure (__v, __w));		\
@@ -653,7 +653,7 @@ _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNME
 									\
   template<typename _Tp>						\
   inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,_Tp>         \
-  operator##_Op (const valarray<_Tp> &__v, const _Tp &__t)		\
+  operator _Op (const valarray<_Tp> &__v, const _Tp &__t)		\
   {									\
       typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure;	\
       return _Expr<_Closure, _Tp> (_Closure (__v, __t));	        \
@@ -661,7 +661,7 @@ _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNME
 									\
   template<typename _Tp>						\
   inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,_Tp>         \
-  operator##_Op (const _Tp &__t, const valarray<_Tp> &__v)		\
+  operator _Op (const _Tp &__t, const valarray<_Tp> &__v)		\
   {									\
       typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure;     \
       return _Expr<_Closure, _Tp> (_Closure (__t, __v));        	\
@@ -683,7 +683,7 @@ _DEFINE_BINARY_OPERATOR(>>, _Shift_right
 #define _DEFINE_LOGICAL_OPERATOR(_Op, _Name)				\
   template<typename _Tp>						\
   inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>,bool>        \
-  operator##_Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w)	\
+  operator _Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w)	\
   {									\
       typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure;     \
       return _Expr<_Closure, bool> (_Closure (__v, __w));               \
@@ -691,7 +691,7 @@ _DEFINE_BINARY_OPERATOR(>>, _Shift_right
 									\
   template<class _Tp>							\
   inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,bool>        \
-  operator##_Op (const valarray<_Tp> &__v, const _Tp &__t)		\
+  operator _Op (const valarray<_Tp> &__v, const _Tp &__t)		\
   {									\
       typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure;     \
       return _Expr<_Closure, bool> (_Closure (__v, __t));       	\
@@ -699,7 +699,7 @@ _DEFINE_BINARY_OPERATOR(>>, _Shift_right
 									\
   template<class _Tp>							\
   inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,bool>        \
-  operator##_Op (const _Tp &__t, const valarray<_Tp> &__v)		\
+  operator _Op (const _Tp &__t, const valarray<_Tp> &__v)		\
   {									\
       typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure;     \
       return _Expr<_Closure, bool> (_Closure (__t, __v));	        \
===================================================================
Index: libstdc++/std/valarray_meta.h
--- libstdc++/std/valarray_meta.h	1999/11/19 01:40:12	1.5
+++ libstdc++/std/valarray_meta.h	2000/07/04 16:28:22
@@ -755,7 +755,7 @@ _Expr<_Dom,_Tp>::operator! () const
 #define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name)                         \
 template<class _Dom, typename _Tp>                                      \
 inline _Expr<_UnClos<_Name,_Expr,_Dom>,_Tp>                             \
-_Expr<_Dom,_Tp>::operator##_Op () const                                 \
+_Expr<_Dom,_Tp>::operator _Op () const                                 \
 {                                                                       \
     typedef _UnClos<_Name,_Expr,_Dom> _Closure;                         \
     return _Expr<_Closure,_Tp> (_Closure (this->_M_closure));           \
@@ -772,7 +772,7 @@ _Expr<_Dom,_Tp>::operator##_Op () const 
 template<class _Dom1, class _Dom2>					\
 inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>,                   \
              typename _Name<typename _Dom1::value_type>::result_type>   \
-operator##_Op (const _Expr<_Dom1,typename _Dom1::value_type>& __v,      \
+operator _Op (const _Expr<_Dom1,typename _Dom1::value_type>& __v,      \
               const _Expr<_Dom2,typename _Dom2::value_type>& __w)       \
 {                                                                       \
     typedef typename _Dom1::value_type _Arg;                            \
@@ -784,7 +784,7 @@ operator##_Op (const _Expr<_Dom1,typenam
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>, \
              typename _Name<typename _Dom::value_type>::result_type>    \
-operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __v,        \
+operator _Op (const _Expr<_Dom,typename _Dom::value_type>& __v,        \
               const typename _Dom::value_type& __t)                     \
 {                                                                       \
     typedef typename _Dom::value_type _Arg;                             \
@@ -796,7 +796,7 @@ operator##_Op (const _Expr<_Dom,typename
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>, \
              typename _Name<typename _Dom::value_type>::result_type>    \
-operator##_Op (const typename _Dom::value_type& __t,                    \
+operator _Op (const typename _Dom::value_type& __t,                    \
                const _Expr<_Dom,typename _Dom::value_type>& __v)        \
 {                                                                       \
     typedef typename _Dom::value_type _Arg;                             \
@@ -808,7 +808,7 @@ operator##_Op (const typename _Dom::valu
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>, \
              typename _Name<typename _Dom::value_type>::result_type>    \
-operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __e,        \
+operator _Op (const _Expr<_Dom,typename _Dom::value_type>& __e,        \
                const valarray<typename _Dom::value_type>& __v)          \
 {                                                                       \
     typedef typename _Dom::value_type _Arg;                             \
@@ -820,7 +820,7 @@ operator##_Op (const _Expr<_Dom,typename
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>, \
              typename _Name<typename _Dom::value_type>::result_type>    \
-operator##_Op (const valarray<typename _Dom::value_type>& __v,          \
+operator _Op (const valarray<typename _Dom::value_type>& __v,          \
                const _Expr<_Dom,typename _Dom::value_type>& __e)        \
 {                                                                       \
     typedef typename _Dom::value_type _Tp;                              \
@@ -845,7 +845,7 @@ operator##_Op (const valarray<typename _
 #define _DEFINE_EXPR_RELATIONAL_OPERATOR(_Op, _Name)                    \
 template<class _Dom1, class _Dom2>					\
 inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>, bool>             \
-operator##_Op (const _Expr<_Dom1,typename _Dom1::value_type>& __v,      \
+operator _Op (const _Expr<_Dom1,typename _Dom1::value_type>& __v,       \
               const _Expr<_Dom2,typename _Dom2::value_type>& __w)       \
 {                                                                       \
     typedef typename _Dom1::value_type _Arg;                            \
@@ -856,7 +856,7 @@ operator##_Op (const _Expr<_Dom1,typenam
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>, \
              bool>                                                      \
-operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __v,        \
+operator _Op (const _Expr<_Dom,typename _Dom::value_type>& __v,         \
               const typename _Dom::value_type& __t)                     \
 {                                                                       \
     typedef typename _Dom::value_type _Arg;                             \
@@ -867,7 +867,7 @@ operator##_Op (const _Expr<_Dom,typename
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>, \
              bool>                                                      \
-operator##_Op (const typename _Dom::value_type& __t,                    \
+operator _Op (const typename _Dom::value_type& __t,                     \
                const _Expr<_Dom,typename _Dom::value_type>& __v)        \
 {                                                                       \
     typedef typename _Dom::value_type _Arg;                             \
@@ -878,7 +878,7 @@ operator##_Op (const typename _Dom::valu
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>, \
              bool>                                                      \
-operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __e,        \
+operator _Op (const _Expr<_Dom,typename _Dom::value_type>& __e,         \
                const valarray<typename _Dom::value_type>& __v)          \
 {                                                                       \
     typedef typename _Dom::value_type _Tp;                              \
@@ -889,7 +889,7 @@ operator##_Op (const _Expr<_Dom,typename
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>, \
              bool>                                                      \
-operator##_Op (const valarray<typename _Dom::value_type>& __v,          \
+operator _Op (const valarray<typename _Dom::value_type>& __v,           \
                const _Expr<_Dom,typename _Dom::value_type>& __e)        \
 {                                                                       \
     typedef typename _Dom::value_type _Tp;                              \
===================================================================
Index: libstdc++-v3/bits/gslice_array.h
--- libstdc++-v3/bits/gslice_array.h	2000/04/21 20:33:28	1.1
+++ libstdc++-v3/bits/gslice_array.h	2000/07/04 16:28:22
@@ -133,7 +133,7 @@ namespace std {
 #define _DEFINE_VALARRAY_OPERATOR(op, name)				\
 template<typename _Tp>							\
 inline void								\
-gslice_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const	\
+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 ());		\
@@ -141,7 +141,7 @@ gslice_array<_Tp>::operator##op##= (cons
 									\
 template<typename _Tp> template<class E>        			\
 inline void 								\
-gslice_array<_Tp>::operator##op##= (const _Expr<E, _Tp>& __e) const	\
+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());				\
===================================================================
Index: libstdc++-v3/bits/indirect_array.h
--- libstdc++-v3/bits/indirect_array.h	2000/04/21 20:33:28	1.1
+++ libstdc++-v3/bits/indirect_array.h	2000/07/04 16:28:22
@@ -126,14 +126,14 @@ namespace std {
 #define _DEFINE_VALARRAY_OPERATOR(op, name)				\
 template<typename _Tp>							\
 inline void								\
-indirect_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const	\
+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 \
+indirect_array<_Tp>::operator op##= (const _Expr<_Dom,_Tp>& __e) const \
 {									\
   _Array_augmented_##name (_M_array, _M_index, __e, _M_sz);		\
 }
===================================================================
Index: libstdc++-v3/bits/mask_array.h
--- libstdc++-v3/bits/mask_array.h	2000/04/21 20:33:28	1.1
+++ libstdc++-v3/bits/mask_array.h	2000/07/04 16:28:22
@@ -125,7 +125,7 @@ namespace std {
 #define _DEFINE_VALARRAY_OPERATOR(op, name)				\
 template<typename _Tp>							\
 inline void								\
-mask_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const	\
+mask_array<_Tp>::operator op##= (const valarray<_Tp>& __v) const	\
 {									\
   _Array_augmented_##name (_M_array, _M_mask, 				\
                            _Array<_Tp> (__v), __v.size ());		\
@@ -133,7 +133,7 @@ mask_array<_Tp>::operator##op##= (const 
 									\
 template<typename _Tp> template<class E>				\
 inline void								\
-mask_array<_Tp>::operator##op##= (const _Expr<E, _Tp>& __e) const	\
+mask_array<_Tp>::operator op##= (const _Expr<E, _Tp>& __e) const	\
 {									\
   _Array_augmented_##name (_M_array, _M_mask, __e, __e.size ());	\
 }
===================================================================
Index: libstdc++-v3/bits/slice_array.h
--- libstdc++-v3/bits/slice_array.h	2000/04/21 20:33:28	1.1
+++ libstdc++-v3/bits/slice_array.h	2000/07/04 16:28:22
@@ -126,14 +126,14 @@ namespace std {
 #define _DEFINE_VALARRAY_OPERATOR(op, name)				\
 template<typename _Tp>							\
 inline void								\
-slice_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const	\
+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	\
+slice_array<_Tp>::operator op##= (const _Expr<_Dom,_Tp>& __e) const	\
 {									\
     _Array_augmented_##name (_M_array, _M_stride, __e, _M_sz);		\
 }
===================================================================
Index: libstdc++-v3/bits/std_valarray.h
--- libstdc++-v3/bits/std_valarray.h	2000/04/21 20:33:28	1.1
+++ libstdc++-v3/bits/std_valarray.h	2000/07/04 16:28:22
@@ -585,7 +585,7 @@ namespace std {
 #define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name)                     \
   template<typename _Tp>						\
   inline _Expr<_UnClos<_Name,_ValArray,_Tp>, _Tp>               	\
-  valarray<_Tp>::operator##_Op() const					\
+  valarray<_Tp>::operator _Op() const					\
   {									\
       typedef _UnClos<_Name,_ValArray,_Tp> _Closure;	                \
       return _Expr<_Closure, _Tp> (_Closure (*this));			\
@@ -608,7 +608,7 @@ namespace std {
 #define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name)               \
   template<class _Tp>							\
   inline valarray<_Tp> &						\
-  valarray<_Tp>::operator##_Op##= (const _Tp &__t)			\
+  valarray<_Tp>::operator _Op##= (const _Tp &__t)			\
   {									\
       _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, __t);	\
       return *this;							\
@@ -616,7 +616,7 @@ namespace std {
 									\
   template<class _Tp>							\
   inline valarray<_Tp> &						\
-  valarray<_Tp>::operator##_Op##= (const valarray<_Tp> &__v)		\
+  valarray<_Tp>::operator _Op##= (const valarray<_Tp> &__v)		\
   {									\
       _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, 		\
                                _Array<_Tp>(__v._M_data));		\
@@ -645,7 +645,7 @@ namespace std {
 #define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name)          \
   template<class _Tp> template<class _Dom>				\
   inline valarray<_Tp> &						\
-  valarray<_Tp>::operator##_Op##= (const _Expr<_Dom,_Tp> &__e)		\
+  valarray<_Tp>::operator _Op##= (const _Expr<_Dom,_Tp> &__e)		\
   {									\
       _Array_augmented_##_Name (_Array<_Tp>(_M_data), __e, _M_size);	\
       return *this;							\
@@ -668,7 +668,7 @@ _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNME
 #define _DEFINE_BINARY_OPERATOR(_Op, _Name)				\
   template<typename _Tp>						\
   inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>, _Tp>        \
-  operator##_Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w)	\
+  operator _Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w)	\
   {									\
       typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure;     \
       return _Expr<_Closure, _Tp> (_Closure (__v, __w));		\
@@ -676,7 +676,7 @@ _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNME
 									\
   template<typename _Tp>						\
   inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,_Tp>         \
-  operator##_Op (const valarray<_Tp> &__v, const _Tp &__t)		\
+  operator _Op (const valarray<_Tp> &__v, const _Tp &__t)		\
   {									\
       typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure;	\
       return _Expr<_Closure, _Tp> (_Closure (__v, __t));	        \
@@ -684,7 +684,7 @@ _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNME
 									\
   template<typename _Tp>						\
   inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,_Tp>         \
-  operator##_Op (const _Tp &__t, const valarray<_Tp> &__v)		\
+  operator _Op (const _Tp &__t, const valarray<_Tp> &__v)		\
   {									\
       typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure;     \
       return _Expr<_Closure, _Tp> (_Closure (__t, __v));        	\
@@ -706,7 +706,7 @@ _DEFINE_BINARY_OPERATOR(>>, _Shift_right
 #define _DEFINE_LOGICAL_OPERATOR(_Op, _Name)				\
   template<typename _Tp>						\
   inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>,bool>        \
-  operator##_Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w)	\
+  operator _Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w)	\
   {									\
       typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure;     \
       return _Expr<_Closure, bool> (_Closure (__v, __w));               \
@@ -714,7 +714,7 @@ _DEFINE_BINARY_OPERATOR(>>, _Shift_right
 									\
   template<class _Tp>							\
   inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,bool>        \
-  operator##_Op (const valarray<_Tp> &__v, const _Tp &__t)		\
+  operator _Op (const valarray<_Tp> &__v, const _Tp &__t)		\
   {									\
       typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure;     \
       return _Expr<_Closure, bool> (_Closure (__v, __t));       	\
@@ -722,7 +722,7 @@ _DEFINE_BINARY_OPERATOR(>>, _Shift_right
 									\
   template<class _Tp>							\
   inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,bool>        \
-  operator##_Op (const _Tp &__t, const valarray<_Tp> &__v)		\
+  operator _Op (const _Tp &__t, const valarray<_Tp> &__v)		\
   {									\
       typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure;     \
       return _Expr<_Closure, bool> (_Closure (__t, __v));	        \
===================================================================
Index: libstdc++-v3/bits/valarray_meta.h
--- libstdc++-v3/bits/valarray_meta.h	2000/04/21 20:33:28	1.1
+++ libstdc++-v3/bits/valarray_meta.h	2000/07/04 16:28:22
@@ -763,7 +763,7 @@ namespace std {
 #define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name)                         \
 template<class _Dom, typename _Tp>                                      \
 inline _Expr<_UnClos<_Name,_Expr,_Dom>,_Tp>                             \
-_Expr<_Dom,_Tp>::operator##_Op () const                                 \
+_Expr<_Dom,_Tp>::operator _Op () const                                 \
 {                                                                       \
     typedef _UnClos<_Name,_Expr,_Dom> _Closure;                         \
     return _Expr<_Closure,_Tp> (_Closure (this->_M_closure));           \
@@ -780,7 +780,7 @@ _Expr<_Dom,_Tp>::operator##_Op () const 
 template<class _Dom1, class _Dom2>					\
 inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>,                   \
              typename _Name<typename _Dom1::value_type>::result_type>   \
-operator##_Op (const _Expr<_Dom1,typename _Dom1::value_type>& __v,      \
+operator _Op (const _Expr<_Dom1,typename _Dom1::value_type>& __v,      \
               const _Expr<_Dom2,typename _Dom2::value_type>& __w)       \
 {                                                                       \
     typedef typename _Dom1::value_type _Arg;                            \
@@ -792,7 +792,7 @@ operator##_Op (const _Expr<_Dom1,typenam
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>, \
              typename _Name<typename _Dom::value_type>::result_type>    \
-operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __v,        \
+operator _Op (const _Expr<_Dom,typename _Dom::value_type>& __v,        \
               const typename _Dom::value_type& __t)                     \
 {                                                                       \
     typedef typename _Dom::value_type _Arg;                             \
@@ -804,7 +804,7 @@ operator##_Op (const _Expr<_Dom,typename
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>, \
              typename _Name<typename _Dom::value_type>::result_type>    \
-operator##_Op (const typename _Dom::value_type& __t,                    \
+operator _Op (const typename _Dom::value_type& __t,                    \
                const _Expr<_Dom,typename _Dom::value_type>& __v)        \
 {                                                                       \
     typedef typename _Dom::value_type _Arg;                             \
@@ -816,7 +816,7 @@ operator##_Op (const typename _Dom::valu
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>, \
              typename _Name<typename _Dom::value_type>::result_type>    \
-operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __e,        \
+operator _Op (const _Expr<_Dom,typename _Dom::value_type>& __e,        \
                const valarray<typename _Dom::value_type>& __v)          \
 {                                                                       \
     typedef typename _Dom::value_type _Arg;                             \
@@ -828,7 +828,7 @@ operator##_Op (const _Expr<_Dom,typename
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>, \
              typename _Name<typename _Dom::value_type>::result_type>    \
-operator##_Op (const valarray<typename _Dom::value_type>& __v,          \
+operator _Op (const valarray<typename _Dom::value_type>& __v,          \
                const _Expr<_Dom,typename _Dom::value_type>& __e)        \
 {                                                                       \
     typedef typename _Dom::value_type _Tp;                              \
@@ -853,7 +853,7 @@ operator##_Op (const valarray<typename _
 #define _DEFINE_EXPR_RELATIONAL_OPERATOR(_Op, _Name)                    \
 template<class _Dom1, class _Dom2>					\
 inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>, bool>             \
-operator##_Op (const _Expr<_Dom1,typename _Dom1::value_type>& __v,      \
+operator _Op (const _Expr<_Dom1,typename _Dom1::value_type>& __v,       \
               const _Expr<_Dom2,typename _Dom2::value_type>& __w)       \
 {                                                                       \
     typedef typename _Dom1::value_type _Arg;                            \
@@ -864,7 +864,7 @@ operator##_Op (const _Expr<_Dom1,typenam
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>, \
              bool>                                                      \
-operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __v,        \
+operator _Op (const _Expr<_Dom,typename _Dom::value_type>& __v,         \
               const typename _Dom::value_type& __t)                     \
 {                                                                       \
     typedef typename _Dom::value_type _Arg;                             \
@@ -875,7 +875,7 @@ operator##_Op (const _Expr<_Dom,typename
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>, \
              bool>                                                      \
-operator##_Op (const typename _Dom::value_type& __t,                    \
+operator _Op (const typename _Dom::value_type& __t,                     \
                const _Expr<_Dom,typename _Dom::value_type>& __v)        \
 {                                                                       \
     typedef typename _Dom::value_type _Arg;                             \
@@ -886,7 +886,7 @@ operator##_Op (const typename _Dom::valu
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>, \
              bool>                                                      \
-operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __e,        \
+operator _Op (const _Expr<_Dom,typename _Dom::value_type>& __e,         \
                const valarray<typename _Dom::value_type>& __v)          \
 {                                                                       \
     typedef typename _Dom::value_type _Tp;                              \
@@ -897,7 +897,7 @@ operator##_Op (const _Expr<_Dom,typename
 template<class _Dom>                                                    \
 inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>, \
              bool>                                                      \
-operator##_Op (const valarray<typename _Dom::value_type>& __v,          \
+operator _Op (const valarray<typename _Dom::value_type>& __v,           \
                const _Expr<_Dom,typename _Dom::value_type>& __e)        \
 {                                                                       \
     typedef typename _Dom::value_type _Tp;                              \

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