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
This commit is contained in:
Paolo Carlini 2006-12-28 10:54:56 +00:00 committed by Paolo Carlini
parent 036bcce8e4
commit 975a4fc1a3
2 changed files with 20 additions and 29 deletions

View File

@ -1,3 +1,9 @@
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>
DR 541, [WP].

View File

@ -128,11 +128,17 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
reference
at(size_type __n)
{ return _M_at<_Nm>(__n); }
{
_M_check<_Nm>(__n);
return _M_instance[__n];
}
const_reference
at(size_type __n) const
{ return _M_at<_Nm>(__n); }
{
_M_check<_Nm>(__n);
return _M_instance[__n];
}
reference
front()
@ -160,39 +166,18 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
private:
template<std::size_t _Mm>
typename __gnu_cxx::__enable_if<_Mm, reference>::__type
_M_at(size_type __n)
typename __gnu_cxx::__enable_if<_Mm, void>::__type
_M_check(size_type __n) const
{
if (__builtin_expect(__n >= _Mm, false))
std::__throw_out_of_range(__N("array::_M_at"));
return _M_instance[__n];
std::__throw_out_of_range(__N("array::_M_check"));
}
// Avoid "unsigned comparison with zero" warnings.
template<std::size_t _Mm>
typename __gnu_cxx::__enable_if<!_Mm, reference>::__type
_M_at(size_type)
{
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];
}
typename __gnu_cxx::__enable_if<!_Mm, void>::__type
_M_check(size_type) const
{ std::__throw_out_of_range(__N("array::_M_check")); }
};
// Array comparisons.