Commit b714a419 by Paolo Carlini Committed by Paolo Carlini

gslice.h: Trivial formatting fixes.

2004-07-08  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/gslice.h: Trivial formatting fixes.
	* include/bits/gslice_array.h: Likewise.
	* include/bits/indirect_array.h: Likewise.
	* include/bits/mask_array.h: Likewise.
	* include/bits/slice_array.h: Likewise.
	* include/bits/valarray_after.h: Likewise.
	* include/bits/valarray_array.h: Likewise.
	* include/bits/valarray_before.h: Likewise.
	* include/std/std_valarray.h: Likewise.

From-SVN: r84312
parent d222b827
2004-07-08 Paolo Carlini <pcarlini@suse.de>
* include/bits/gslice.h: Trivial formatting fixes.
* include/bits/gslice_array.h: Likewise.
* include/bits/indirect_array.h: Likewise.
* include/bits/mask_array.h: Likewise.
* include/bits/slice_array.h: Likewise.
* include/bits/valarray_after.h: Likewise.
* include/bits/valarray_array.h: Likewise.
* include/bits/valarray_before.h: Likewise.
* include/std/std_valarray.h: Likewise.
2004-07-08 Benjamin Kosnik <bkoz@redhat.com> 2004-07-08 Benjamin Kosnik <bkoz@redhat.com>
PR c++/16169 PR c++/16169
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
#pragma GCC system_header #pragma GCC system_header
namespace std { namespace std
{
/** /**
* @brief Class defining multi-dimensional subset of an array. * @brief Class defining multi-dimensional subset of an array.
* *
...@@ -60,103 +60,112 @@ namespace std { ...@@ -60,103 +60,112 @@ namespace std {
* slice[0,2]==array[9], slice[1,0]==array[14], slice[1,1]==array[17], * slice[0,2]==array[9], slice[1,0]==array[14], slice[1,1]==array[17],
* slice[1,2]==array[20]. * slice[1,2]==array[20].
*/ */
class gslice class gslice
{
public:
/// Construct an empty slice.
gslice ();
/**
* @brief Construct a slice.
*
* Constructs a slice with as many dimensions as the length of the @a l
* and @a s arrays.
*
* @param o Offset in array of first element.
* @param l Array of dimension lengths.
* @param s Array of dimension strides between array elements.
*/
gslice(size_t, const valarray<size_t>&, const valarray<size_t>&);
// XXX: the IS says the copy-ctor and copy-assignment operators are
// synthetized by the compiler but they are just unsuitable
// for a ref-counted semantic
/// Copy constructor.
gslice(const gslice&);
/// Destructor.
~gslice();
// XXX: See the note above.
/// Assignment operator.
gslice& operator=(const gslice&);
/// Return array offset of first slice element.
size_t start() const;
/// Return array of sizes of slice dimensions.
valarray<size_t> size() const;
/// Return array of array strides for each dimension.
valarray<size_t> stride() const;
private:
struct _Indexer
{ {
public: size_t _M_count;
/// Construct an empty slice. size_t _M_start;
gslice (); valarray<size_t> _M_size;
valarray<size_t> _M_stride;
/** valarray<size_t> _M_index; // Linear array of referenced indices
* @brief Construct a slice. _Indexer(size_t, const valarray<size_t>&,
* const valarray<size_t>&);
* Constructs a slice with as many dimensions as the length of the @a l void
* and @a s arrays. _M_increment_use()
* { ++_M_count; }
* @param o Offset in array of first element.
* @param l Array of dimension lengths. size_t
* @param s Array of dimension strides between array elements. _M_decrement_use()
*/ { return --_M_count; }
gslice(size_t, const valarray<size_t>&, const valarray<size_t>&);
// XXX: the IS says the copy-ctor and copy-assignment operators are
// synthetized by the compiler but they are just unsuitable
// for a ref-counted semantic
/// Copy constructor.
gslice(const gslice&);
/// Destructor.
~gslice();
// XXX: See the note above.
/// Assignment operator.
gslice& operator=(const gslice&);
/// Return array offset of first slice element.
size_t start() const;
/// Return array of sizes of slice dimensions.
valarray<size_t> size() const;
/// Return array of array strides for each dimension.
valarray<size_t> stride() const;
private:
struct _Indexer {
size_t _M_count;
size_t _M_start;
valarray<size_t> _M_size;
valarray<size_t> _M_stride;
valarray<size_t> _M_index; // Linear array of referenced indices
_Indexer(size_t, const valarray<size_t>&,
const valarray<size_t>&);
void _M_increment_use() { ++_M_count; }
size_t _M_decrement_use() { return --_M_count; }
};
_Indexer* _M_index;
template<typename _Tp> friend class valarray;
}; };
inline size_t _Indexer* _M_index;
gslice::start () const
{ return _M_index ? _M_index->_M_start : 0; }
inline valarray<size_t> template<typename _Tp> friend class valarray;
gslice::size () const };
{ return _M_index ? _M_index->_M_size : valarray<size_t>(); }
inline valarray<size_t> inline size_t
gslice::stride () const gslice::start () const
{ return _M_index ? _M_index->_M_stride : valarray<size_t>(); } { return _M_index ? _M_index->_M_start : 0; }
inline gslice::gslice () : _M_index(0) {} inline valarray<size_t>
gslice::size () const
{ return _M_index ? _M_index->_M_size : valarray<size_t>(); }
inline inline valarray<size_t>
gslice::gslice(size_t __o, const valarray<size_t>& __l, gslice::stride () const
const valarray<size_t>& __s) { return _M_index ? _M_index->_M_stride : valarray<size_t>(); }
: _M_index(new gslice::_Indexer(__o, __l, __s)) {}
inline inline gslice::gslice () : _M_index(0) {}
gslice::gslice(const gslice& __g) : _M_index(__g._M_index)
{ if (_M_index) _M_index->_M_increment_use(); }
inline inline
gslice::~gslice() gslice::gslice(size_t __o, const valarray<size_t>& __l,
{ if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index; } const valarray<size_t>& __s)
: _M_index(new gslice::_Indexer(__o, __l, __s)) {}
inline gslice& inline
gslice::operator= (const gslice& __g) gslice::gslice(const gslice& __g) : _M_index(__g._M_index)
{ { if (_M_index) _M_index->_M_increment_use(); }
if (__g._M_index) __g._M_index->_M_increment_use();
if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index;
_M_index = __g._M_index;
return *this;
}
inline
gslice::~gslice()
{
if (_M_index && _M_index->_M_decrement_use() == 0)
delete _M_index;
}
} // std:: inline gslice&
gslice::operator= (const gslice& __g)
{
if (__g._M_index)
__g._M_index->_M_increment_use();
if (_M_index && _M_index->_M_decrement_use() == 0)
delete _M_index;
_M_index = __g._M_index;
return *this;
}
} // std::
#endif /* _GSLICE_H */ #endif /* _GSLICE_H */
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
#pragma GCC system_header #pragma GCC system_header
namespace std { namespace std
{
/** /**
* @brief Reference to multi-dimensional subset of an array. * @brief Reference to multi-dimensional subset of an array.
* *
...@@ -97,27 +97,27 @@ namespace std { ...@@ -97,27 +97,27 @@ namespace std {
void operator=(const _Tp&) const; void operator=(const _Tp&) const;
template<class _Dom> template<class _Dom>
void operator=(const _Expr<_Dom,_Tp>&) const; void operator=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator*=(const _Expr<_Dom,_Tp>&) const; void operator*=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator/=(const _Expr<_Dom,_Tp>&) const; void operator/=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator%=(const _Expr<_Dom,_Tp>&) const; void operator%=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator+=(const _Expr<_Dom,_Tp>&) const; void operator+=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator-=(const _Expr<_Dom,_Tp>&) const; void operator-=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator^=(const _Expr<_Dom,_Tp>&) const; void operator^=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator&=(const _Expr<_Dom,_Tp>&) const; void operator&=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator|=(const _Expr<_Dom,_Tp>&) const; void operator|=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator<<=(const _Expr<_Dom,_Tp>&) const; void operator<<=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator>>=(const _Expr<_Dom,_Tp>&) const; void operator>>=(const _Expr<_Dom, _Tp>&) const;
private: private:
_Array<_Tp> _M_array; _Array<_Tp> _M_array;
...@@ -137,13 +137,11 @@ namespace std { ...@@ -137,13 +137,11 @@ namespace std {
const valarray<size_t>& __i) const valarray<size_t>& __i)
: _M_array(__a), _M_index(__i) {} : _M_array(__a), _M_index(__i) {}
template<typename _Tp> template<typename _Tp>
inline inline
gslice_array<_Tp>::gslice_array(const gslice_array<_Tp>& __a) gslice_array<_Tp>::gslice_array(const gslice_array<_Tp>& __a)
: _M_array(__a._M_array), _M_index(__a._M_index) {} : _M_array(__a._M_array), _M_index(__a._M_index) {}
template<typename _Tp> template<typename _Tp>
inline gslice_array<_Tp>& inline gslice_array<_Tp>&
gslice_array<_Tp>::operator=(const gslice_array<_Tp>& __a) gslice_array<_Tp>::operator=(const gslice_array<_Tp>& __a)
...@@ -186,7 +184,7 @@ namespace std { ...@@ -186,7 +184,7 @@ namespace std {
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_augmented_##_Name(_M_array, _Array<size_t>(_M_index), \
_Array<_Tp>(__v), __v.size()); \ _Array<_Tp>(__v), __v.size()); \
} \ } \
\ \
template<typename _Tp> \ template<typename _Tp> \
......
...@@ -156,7 +156,6 @@ namespace std ...@@ -156,7 +156,6 @@ namespace std
return *this; return *this;
} }
template<typename _Tp> template<typename _Tp>
inline void inline void
indirect_array<_Tp>::operator=(const _Tp& __t) const indirect_array<_Tp>::operator=(const _Tp& __t) const
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
#pragma GCC system_header #pragma GCC system_header
namespace std { namespace std
{
/** /**
* @brief Reference to selected subset of an array. * @brief Reference to selected subset of an array.
* *
...@@ -128,13 +128,12 @@ namespace std { ...@@ -128,13 +128,12 @@ namespace std {
const size_t _M_sz; const size_t _M_sz;
const _Array<bool> _M_mask; const _Array<bool> _M_mask;
const _Array<_Tp> _M_array; const _Array<_Tp> _M_array;
// not implemented // not implemented
mask_array(); mask_array();
}; };
template<typename _Tp> template<typename _Tp>
inline mask_array<_Tp>::mask_array(const mask_array<_Tp>& a) 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) {} : _M_sz(a._M_sz), _M_mask(a._M_mask), _M_array(a._M_array) {}
......
...@@ -90,7 +90,7 @@ namespace std ...@@ -90,7 +90,7 @@ namespace std
inline inline
slice::slice(size_t __o, size_t __d, size_t __s) slice::slice(size_t __o, size_t __d, size_t __s)
: _M_off(__o), _M_sz(__d), _M_st(__s) {} : _M_off(__o), _M_sz(__d), _M_st(__s) {}
inline size_t inline size_t
slice::start() const slice::start() const
...@@ -160,34 +160,34 @@ namespace std ...@@ -160,34 +160,34 @@ namespace std
// ~slice_array (); // ~slice_array ();
template<class _Dom> template<class _Dom>
void operator=(const _Expr<_Dom,_Tp>&) const; void operator=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator*=(const _Expr<_Dom,_Tp>&) const; void operator*=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator/=(const _Expr<_Dom,_Tp>&) const; void operator/=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator%=(const _Expr<_Dom,_Tp>&) const; void operator%=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator+=(const _Expr<_Dom,_Tp>&) const; void operator+=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator-=(const _Expr<_Dom,_Tp>&) const; void operator-=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator^=(const _Expr<_Dom,_Tp>&) const; void operator^=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator&=(const _Expr<_Dom,_Tp>&) const; void operator&=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator|=(const _Expr<_Dom,_Tp>&) const; void operator|=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator<<=(const _Expr<_Dom,_Tp>&) const; void operator<<=(const _Expr<_Dom, _Tp>&) const;
template<class _Dom> template<class _Dom>
void operator>>=(const _Expr<_Dom,_Tp>&) const; void operator>>=(const _Expr<_Dom, _Tp>&) const;
private: private:
friend class valarray<_Tp>; friend class valarray<_Tp>;
slice_array(_Array<_Tp>, const slice&); slice_array(_Array<_Tp>, const slice&);
const size_t _M_sz; const size_t _M_sz;
const size_t _M_stride; const size_t _M_stride;
const _Array<_Tp> _M_array; const _Array<_Tp> _M_array;
// not implemented // not implemented
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment