summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/tr1/array
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-24 19:13:49 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-24 19:13:49 +0000
commit68428177e8f0bfc47d6cc0b0be13a79dc1a70b2e (patch)
treebc13bd7d1a6b37817db97204a8932a276fd9db5f /libstdc++-v3/include/tr1/array
parent6a451e879bb24436563e257b4741d9342a7378d4 (diff)
downloadppe42-gcc-68428177e8f0bfc47d6cc0b0be13a79dc1a70b2e.tar.gz
ppe42-gcc-68428177e8f0bfc47d6cc0b0be13a79dc1a70b2e.zip
2006-02-24 Paolo Carlini <pcarlini@suse.de>
* include/tr1/array (array<>::swap, assign): Implement. * include/tr1/array (operator==, operator!=, operator<, operator>, operator>=, operator<=, swap, get): Inline. * testsuite/tr1/6_containers/array/requirements/member_swap.cc: New. * testsuite/tr1/6_containers/array/requirements/assign.cc: Likewise. * testsuite/tr1/6_containers/array/specialized_algorithms/swap.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111424 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/tr1/array')
-rw-r--r--libstdc++-v3/include/tr1/array44
1 files changed, 23 insertions, 21 deletions
diff --git a/libstdc++-v3/include/tr1/array b/libstdc++-v3/include/tr1/array
index 5f504851847..9332efeb4ab 100644
--- a/libstdc++-v3/include/tr1/array
+++ b/libstdc++-v3/include/tr1/array
@@ -50,15 +50,15 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
template<typename _Tp, std::size_t _Nm = 1>
struct array
{
- typedef _Tp value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef value_type* iterator;
- typedef const value_type* const_iterator;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef _Tp value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// Compile time constant without other dependencies.
enum { _S_index = _Nm };
@@ -69,10 +69,12 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
// No explicit construct/copy/destroy for aggregate type.
void
- assign(const value_type& u);
+ assign(const value_type& __u)
+ { std::fill_n(begin(), size(), __u); }
void
- swap(array&);
+ swap(array& __other)
+ { std::swap_ranges(begin(), end(), __other.begin()); }
// Iterators.
iterator
@@ -169,17 +171,17 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
// Array comparisons.
template<typename _Tp, std::size_t _Nm>
- bool
+ inline bool
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return std::equal(__one.begin(), __one.end(), __two.begin()); }
template<typename _Tp, std::size_t _Nm>
- bool
+ inline bool
operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one == __two); }
template<typename _Tp, std::size_t _Nm>
- bool
+ inline bool
operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
{
return std::lexicographical_compare(__a.begin(), __a.end(),
@@ -187,25 +189,25 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
}
template<typename _Tp, std::size_t _Nm>
- bool
+ inline bool
operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return __two < __one; }
template<typename _Tp, std::size_t _Nm>
- bool
+ inline bool
operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one > __two); }
template<typename _Tp, std::size_t _Nm>
- bool
+ inline bool
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one < __two); }
// Specialized algorithms [6.2.2.2].
template<typename _Tp, std::size_t _Nm>
- void
+ inline void
swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
- { swap_ranges(__one.begin(), __one.end(), __two.begin()); }
+ { std::swap_ranges(__one.begin(), __one.end(), __two.begin()); }
// Tuple interface to class template array [6.2.2.5].
template<typename _Tp> class tuple_size;
@@ -220,12 +222,12 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
{ typedef _Tp type; };
template<int _Int, typename _Tp, std::size_t _Nm>
- _Tp&
+ inline _Tp&
get(array<_Tp, _Nm>& __arr)
{ return __arr[_Int]; }
template<int _Int, typename _Tp, std::size_t _Nm>
- const _Tp&
+ inline const _Tp&
get(const array<_Tp, _Nm>& __arr)
{ return __arr[_Int]; }
OpenPOWER on IntegriCloud