diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-28 10:54:56 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-28 10:54:56 +0000 |
commit | 2aea00a69f880bbd72f7f78f1ddcc5499a9f7147 (patch) | |
tree | 656e0c2e1846d9cc83ce28dab79c88b3382f701a /libstdc++-v3/include | |
parent | 42c23a296b2d868b5eb10e003f6afa2ce09b97ce (diff) | |
download | gcc-2aea00a69f880bbd72f7f78f1ddcc5499a9f7147.tar.gz |
2006-12-28 Paolo Carlini <pcarlini@suse.de>
* include/tr1/array (array<>::_M_at): Remove.
(array<>::_M_check): Add.
(array<>::at): Use the latter.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120242 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/tr1/array | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/libstdc++-v3/include/tr1/array b/libstdc++-v3/include/tr1/array index 153f334a575..23808b33462 100644 --- a/libstdc++-v3/include/tr1/array +++ b/libstdc++-v3/include/tr1/array @@ -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. |