slice_array.h (_DEFINE_VALARRAY_OPERATOR): Instantiate with new function objects.
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. From-SVN: r56036
This commit is contained in:
parent
6d9f628e05
commit
00386a9be1
|
@ -1,3 +1,13 @@
|
|||
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.
|
||||
|
||||
2002-08-03 Gabriel Dos Reis <gdr@nerim.net>
|
||||
|
||||
* testsuite/26_numerics/valarray_name_lookup.cc: Rename from
|
||||
|
|
|
@ -41,129 +41,131 @@
|
|||
|
||||
namespace std {
|
||||
|
||||
template<typename _Tp> class gslice_array
|
||||
template<typename _Tp>
|
||||
class gslice_array
|
||||
{
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
_Array<_Tp> _M_array;
|
||||
const valarray<size_t>& _M_index;
|
||||
|
||||
friend class valarray<_Tp>;
|
||||
|
||||
gslice_array (_Array<_Tp>, const valarray<size_t>&);
|
||||
friend class valarray<_Tp>;
|
||||
|
||||
gslice_array(_Array<_Tp>, const valarray<size_t>&);
|
||||
|
||||
// this constructor needs to be implemented.
|
||||
gslice_array (const gslice_array&);
|
||||
// this constructor needs to be implemented.
|
||||
gslice_array(const gslice_array&);
|
||||
|
||||
// not implemented
|
||||
gslice_array();
|
||||
gslice_array& operator= (const gslice_array&);
|
||||
// not implemented
|
||||
gslice_array();
|
||||
gslice_array& operator= (const gslice_array&);
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
template<typename _Tp>
|
||||
inline
|
||||
gslice_array<_Tp>::gslice_array (_Array<_Tp> __a,
|
||||
const valarray<size_t>& __i)
|
||||
: _M_array (__a), _M_index (__i) {}
|
||||
gslice_array<_Tp>::gslice_array(_Array<_Tp> __a,
|
||||
const valarray<size_t>& __i)
|
||||
: _M_array(__a), _M_index(__i) {}
|
||||
|
||||
|
||||
template<typename _Tp>
|
||||
template<typename _Tp>
|
||||
inline
|
||||
gslice_array<_Tp>::gslice_array (const gslice_array<_Tp>& __a)
|
||||
: _M_array (__a._M_array), _M_index (__a._M_index) {}
|
||||
gslice_array<_Tp>::gslice_array(const gslice_array<_Tp>& __a)
|
||||
: _M_array(__a._M_array), _M_index(__a._M_index) {}
|
||||
|
||||
|
||||
template<typename _Tp>
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
gslice_array<_Tp>::operator= (const _Tp& __t) const
|
||||
gslice_array<_Tp>::operator=(const _Tp& __t) const
|
||||
{
|
||||
__valarray_fill (_M_array, _Array<size_t>(_M_index),
|
||||
_M_index.size(), __t);
|
||||
__valarray_fill(_M_array, _Array<size_t>(_M_index),
|
||||
_M_index.size(), __t);
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
gslice_array<_Tp>::operator= (const valarray<_Tp>& __v) const
|
||||
gslice_array<_Tp>::operator=(const valarray<_Tp>& __v) const
|
||||
{
|
||||
__valarray_copy (_Array<_Tp> (__v), __v.size (),
|
||||
_M_array, _Array<size_t>(_M_index));
|
||||
__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));
|
||||
}
|
||||
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 ()); \
|
||||
} \
|
||||
#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()); \
|
||||
}
|
||||
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(^, xor)
|
||||
_DEFINE_VALARRAY_OPERATOR(&, and)
|
||||
_DEFINE_VALARRAY_OPERATOR(|, or)
|
||||
_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
|
||||
_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
|
||||
_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
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// The template and inlines for the -*- C++ -*- indirect_array class.
|
||||
|
||||
// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
// 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
|
||||
|
@ -48,70 +49,70 @@ namespace std
|
|||
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;
|
||||
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;
|
||||
void operator=(const _Expr<_Dom, _Tp>&) const;
|
||||
template<class _Dom>
|
||||
void operator*= (const _Expr<_Dom, _Tp>&) const;
|
||||
void operator*=(const _Expr<_Dom, _Tp>&) const;
|
||||
template<class _Dom>
|
||||
void operator/= (const _Expr<_Dom, _Tp>&) const;
|
||||
void operator/=(const _Expr<_Dom, _Tp>&) const;
|
||||
template<class _Dom>
|
||||
void operator%= (const _Expr<_Dom, _Tp>&) const;
|
||||
void operator%=(const _Expr<_Dom, _Tp>&) const;
|
||||
template<class _Dom>
|
||||
void operator+= (const _Expr<_Dom, _Tp>&) const;
|
||||
void operator+=(const _Expr<_Dom, _Tp>&) const;
|
||||
template<class _Dom>
|
||||
void operator-= (const _Expr<_Dom, _Tp>&) const;
|
||||
void operator-=(const _Expr<_Dom, _Tp>&) const;
|
||||
template<class _Dom>
|
||||
void operator^= (const _Expr<_Dom, _Tp>&) const;
|
||||
void operator^=(const _Expr<_Dom, _Tp>&) const;
|
||||
template<class _Dom>
|
||||
void operator&= (const _Expr<_Dom, _Tp>&) const;
|
||||
void operator&=(const _Expr<_Dom, _Tp>&) const;
|
||||
template<class _Dom>
|
||||
void operator|= (const _Expr<_Dom, _Tp>&) const;
|
||||
void operator|=(const _Expr<_Dom, _Tp>&) const;
|
||||
template<class _Dom>
|
||||
void operator<<= (const _Expr<_Dom, _Tp>&) const;
|
||||
void operator<<=(const _Expr<_Dom, _Tp>&) const;
|
||||
template<class _Dom>
|
||||
void operator>>= (const _Expr<_Dom, _Tp>&) const;
|
||||
void operator>>=(const _Expr<_Dom, _Tp>&) const;
|
||||
|
||||
private:
|
||||
indirect_array (const indirect_array&);
|
||||
indirect_array (_Array<_Tp>, size_t, _Array<size_t>);
|
||||
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 ();
|
||||
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) {}
|
||||
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) {}
|
||||
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>&
|
||||
|
@ -124,46 +125,47 @@ namespace std
|
|||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
indirect_array<_Tp>::operator= (const _Tp& __t) const
|
||||
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); }
|
||||
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); }
|
||||
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); \
|
||||
} \
|
||||
#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); \
|
||||
}
|
||||
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)
|
||||
_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
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// The template and inlines for the -*- C++ -*- mask_array class.
|
||||
|
||||
// Copyright (C) 1997-2001 Free Software Foundation, Inc.
|
||||
// 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,120 +42,119 @@
|
|||
|
||||
namespace std {
|
||||
|
||||
template <class _Tp> class mask_array
|
||||
template <class _Tp>
|
||||
class mask_array
|
||||
{
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
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;
|
||||
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>
|
||||
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>
|
||||
template<class _Dom>
|
||||
void operator>>=(const _Expr<_Dom,_Tp>&) const;
|
||||
|
||||
private:
|
||||
mask_array (_Array<_Tp>, size_t, _Array<bool>);
|
||||
friend class valarray<_Tp>;
|
||||
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&);
|
||||
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(const mask_array<_Tp>& a)
|
||||
: _M_sz(a._M_sz), _M_mask(a._M_mask), _M_array(a._M_array) {}
|
||||
|
||||
template<typename _Tp>
|
||||
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) {}
|
||||
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>
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
mask_array<_Tp>::operator= (const _Tp& __t) const
|
||||
{ __valarray_fill (_M_array, _M_sz, _M_mask, __t); }
|
||||
mask_array<_Tp>::operator=(const _Tp& __t) const
|
||||
{ __valarray_fill(_M_array, _M_sz, _M_mask, __t); }
|
||||
|
||||
template<typename _Tp>
|
||||
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); }
|
||||
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); }
|
||||
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 ()); \
|
||||
} \
|
||||
#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 ()); \
|
||||
}
|
||||
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(^, xor)
|
||||
_DEFINE_VALARRAY_OPERATOR(&, and)
|
||||
_DEFINE_VALARRAY_OPERATOR(|, or)
|
||||
_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
|
||||
_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
|
||||
_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
|
||||
|
||||
|
|
|
@ -169,41 +169,42 @@ namespace std
|
|||
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); }
|
||||
{ __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); }
|
||||
{ __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> \
|
||||
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); \
|
||||
}
|
||||
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)
|
||||
_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
|
||||
|
||||
|
|
Loading…
Reference in New Issue