Commit 82cb2574 by Paolo Carlini Committed by Paolo Carlini

indirect_array.h: Trivial formatting fixes.

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

	* include/bits/indirect_array.h: Trivial formatting fixes.
	* include/bits/valarray_after.h: Likewise.
	* include/bits/valarray_array.h: Likewise.
	* src/valarray-inst.cc: Likewise.

From-SVN: r86056
parent 8242fd2d
2004-08-16 Paolo Carlini <pcarlini@suse.de>
* include/bits/indirect_array.h: Trivial formatting fixes.
* include/bits/valarray_after.h: Likewise.
* include/bits/valarray_array.h: Likewise.
* src/valarray-inst.cc: Likewise.
2004-08-15 Paolo Carlini <pcarlini@suse.de> 2004-08-15 Paolo Carlini <pcarlini@suse.de>
* testsuite/27_io/basic_stringstream/rdbuf/char/2832.cc: Remove junk. * testsuite/27_io/basic_stringstream/rdbuf/char/2832.cc: Remove junk.
......
...@@ -46,10 +46,10 @@ namespace std ...@@ -46,10 +46,10 @@ namespace std
* @brief Reference to arbitrary subset of an array. * @brief Reference to arbitrary subset of an array.
* *
* An indirect_array is a reference to the actual elements of an array * An indirect_array is a reference to the actual elements of an array
* specified by an ordered array of indices. The way to get an indirect_array is to * specified by an ordered array of indices. The way to get an
* call operator[](valarray<size_t>) on a valarray. The returned * indirect_array is to call operator[](valarray<size_t>) on a valarray.
* indirect_array then permits carrying operations out on the referenced * The returned indirect_array then permits carrying operations out on the
* subset of elements in the original valarray. * referenced subset of elements in the original valarray.
* *
* For example, if an indirect_array is obtained using the array (4,2,0) as * For example, if an indirect_array is obtained using the array (4,2,0) as
* an argument, and then assigned to an array containing (1,2,3), then the * an argument, and then assigned to an array containing (1,2,3), then the
...@@ -143,34 +143,35 @@ namespace std ...@@ -143,34 +143,35 @@ namespace std
: _M_sz(__a._M_sz), _M_index(__a._M_index), _M_array(__a._M_array) {} : _M_sz(__a._M_sz), _M_index(__a._M_index), _M_array(__a._M_array) {}
template<typename _Tp> template<typename _Tp>
inline inline
indirect_array<_Tp>::indirect_array(_Array<_Tp> __a, size_t __s, indirect_array<_Tp>::indirect_array(_Array<_Tp> __a, size_t __s,
_Array<size_t> __i) _Array<size_t> __i)
: _M_sz(__s), _M_index(__i), _M_array(__a) {} : _M_sz(__s), _M_index(__i), _M_array(__a) {}
template<typename _Tp> template<typename _Tp>
inline indirect_array<_Tp>& inline indirect_array<_Tp>&
indirect_array<_Tp>::operator=(const indirect_array<_Tp>& __a) indirect_array<_Tp>::operator=(const indirect_array<_Tp>& __a)
{ {
std::__valarray_copy(__a._M_array, _M_sz, __a._M_index, _M_array, _M_index); std::__valarray_copy(__a._M_array, _M_sz, __a._M_index, _M_array,
return *this; _M_index);
} 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
{ std::__valarray_fill(_M_array, _M_index, _M_sz, __t); } { std::__valarray_fill(_M_array, _M_index, _M_sz, __t); }
template<typename _Tp> template<typename _Tp>
inline void inline void
indirect_array<_Tp>::operator=(const valarray<_Tp>& __v) const indirect_array<_Tp>::operator=(const valarray<_Tp>& __v) const
{ std::__valarray_copy(_Array<_Tp>(__v), _M_sz, _M_array, _M_index); } { std::__valarray_copy(_Array<_Tp>(__v), _M_sz, _M_array, _M_index); }
template<typename _Tp> template<typename _Tp>
template<class _Dom> template<class _Dom>
inline void inline void
indirect_array<_Tp>::operator=(const _Expr<_Dom,_Tp>& __e) const indirect_array<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) const
{ std::__valarray_copy(__e, _M_sz, _M_array, _M_index); } { std::__valarray_copy(__e, _M_sz, _M_array, _M_index); }
#undef _DEFINE_VALARRAY_OPERATOR #undef _DEFINE_VALARRAY_OPERATOR
#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \ #define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \
......
...@@ -127,7 +127,9 @@ namespace std ...@@ -127,7 +127,9 @@ namespace std
operator[] (size_t __i) const operator[] (size_t __i) const
{ return _M_expr[_M_index[__i]]; } { return _M_expr[_M_index[__i]]; }
size_t size() const { return _M_index.size(); } size_t
size() const
{ return _M_index.size(); }
private: private:
const _Dom& _M_expr; const _Dom& _M_expr;
......
// Explicit instantiation file. // Explicit instantiation file.
// Copyright (C) 2001 Free Software Foundation, Inc. // Copyright (C) 2001, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -48,7 +48,6 @@ namespace std ...@@ -48,7 +48,6 @@ namespace std
template size_t valarray<size_t>::size() const; template size_t valarray<size_t>::size() const;
template size_t& valarray<size_t>::operator[](size_t); template size_t& valarray<size_t>::operator[](size_t);
inline size_t inline size_t
__valarray_product(const valarray<size_t>& __a) __valarray_product(const valarray<size_t>& __a)
{ {
...@@ -110,7 +109,7 @@ namespace std ...@@ -110,7 +109,7 @@ namespace std
gslice::_Indexer::_Indexer(size_t __o, const valarray<size_t>& __l, gslice::_Indexer::_Indexer(size_t __o, const valarray<size_t>& __l,
const valarray<size_t>& __s) const valarray<size_t>& __s)
: _M_count(1), _M_start(__o), _M_size(__l), _M_stride(__s), : _M_count(1), _M_start(__o), _M_size(__l), _M_stride(__s),
_M_index(__l.size() == 0 ? 0 : __valarray_product(__l)) _M_index(__l.size() == 0 ? 0 : __valarray_product(__l))
{ __gslice_to_index(__o, __l, __s, _M_index); } { __gslice_to_index(__o, __l, __s, _M_index); }
} // namespace std } // namespace std
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