Commit 975a4fc1 by Paolo Carlini Committed by Paolo Carlini

array (array<>::_M_at): Remove.

2006-12-28  Paolo Carlini  <pcarlini@suse.de>

	* include/tr1/array (array<>::_M_at): Remove.
	(array<>::_M_check): Add.
	(array<>::at): Use the latter.

From-SVN: r120242
parent 036bcce8
2006-12-28 Paolo Carlini <pcarlini@suse.de>
* include/tr1/array (array<>::_M_at): Remove.
(array<>::_M_check): Add.
(array<>::at): Use the latter.
2006-12-22 Paolo Carlini <pcarlini@suse.de> 2006-12-22 Paolo Carlini <pcarlini@suse.de>
DR 541, [WP]. DR 541, [WP].
......
...@@ -128,11 +128,17 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) ...@@ -128,11 +128,17 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
reference reference
at(size_type __n) at(size_type __n)
{ return _M_at<_Nm>(__n); } {
_M_check<_Nm>(__n);
return _M_instance[__n];
}
const_reference const_reference
at(size_type __n) const at(size_type __n) const
{ return _M_at<_Nm>(__n); } {
_M_check<_Nm>(__n);
return _M_instance[__n];
}
reference reference
front() front()
...@@ -160,39 +166,18 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) ...@@ -160,39 +166,18 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
private: private:
template<std::size_t _Mm> template<std::size_t _Mm>
typename __gnu_cxx::__enable_if<_Mm, reference>::__type typename __gnu_cxx::__enable_if<_Mm, void>::__type
_M_at(size_type __n) _M_check(size_type __n) const
{ {
if (__builtin_expect(__n >= _Mm, false)) if (__builtin_expect(__n >= _Mm, false))
std::__throw_out_of_range(__N("array::_M_at")); std::__throw_out_of_range(__N("array::_M_check"));
return _M_instance[__n];
} }
// Avoid "unsigned comparison with zero" warnings. // Avoid "unsigned comparison with zero" warnings.
template<std::size_t _Mm> template<std::size_t _Mm>
typename __gnu_cxx::__enable_if<!_Mm, reference>::__type typename __gnu_cxx::__enable_if<!_Mm, void>::__type
_M_at(size_type) _M_check(size_type) const
{ { std::__throw_out_of_range(__N("array::_M_check")); }
std::__throw_out_of_range(__N("array::_M_at"));
return _M_instance[0];
}
template<std::size_t _Mm>
typename __gnu_cxx::__enable_if<_Mm, const_reference>::__type
_M_at(size_type __n) const
{
if (__builtin_expect(__n >= _Mm, false))
std::__throw_out_of_range(__N("array::_M_at"));
return _M_instance[__n];
}
template<std::size_t _Mm>
typename __gnu_cxx::__enable_if<!_Mm, const_reference>::__type
_M_at(size_type) const
{
std::__throw_out_of_range(__N("array::_M_at"));
return _M_instance[0];
}
}; };
// Array comparisons. // Array comparisons.
......
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