|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83044 - trunk/boost/container
From: igaztanaga_at_[hidden]
Date: 2013-02-20 03:27:51
Author: igaztanaga
Date: 2013-02-20 03:27:49 EST (Wed, 20 Feb 2013)
New Revision: 83044
URL: http://svn.boost.org/trac/boost/changeset/83044
Log:
Fixes #8118
Text files modified:
trunk/boost/container/stable_vector.hpp | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
Modified: trunk/boost/container/stable_vector.hpp
==============================================================================
--- trunk/boost/container/stable_vector.hpp (original)
+++ trunk/boost/container/stable_vector.hpp 2013-02-20 03:27:49 EST (Wed, 20 Feb 2013)
@@ -945,7 +945,7 @@
size_type size() const BOOST_CONTAINER_NOEXCEPT
{
const size_type index_size = this->index.size();
- return index_size ? (index_size - ExtraPointers) : 0;
+ return (index_size - ExtraPointers) & (std::size_t(0u) -std::size_t(index_size != 0));
}
//! <b>Effects</b>: Returns the largest possible size of the stable_vector.
@@ -1001,7 +1001,9 @@
const size_type node_extra_capacity = this->internal_data.pool_size;
const size_type extra_capacity = (bucket_extra_capacity < node_extra_capacity)
? bucket_extra_capacity : node_extra_capacity;
- return (index_size ? (index_size - ExtraPointers + extra_capacity) : index_size);
+ const size_type index_offset =
+ (ExtraPointers + extra_capacity) & (size_type(0u) - size_type(index_size != 0));
+ return index_size - index_offset;
}
//! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
@@ -1102,7 +1104,7 @@
//!
//! <b>Complexity</b>: Constant.
reference back() BOOST_CONTAINER_NOEXCEPT
- { return static_cast<node_reference>(*this->index[this->size() - ExtraPointers]).value; }
+ { return static_cast<node_reference>(*this->index[this->size()-1u]).value; }
//! <b>Requires</b>: !empty()
//!
@@ -1113,7 +1115,7 @@
//!
//! <b>Complexity</b>: Constant.
const_reference back() const BOOST_CONTAINER_NOEXCEPT
- { return static_cast<const_node_reference>(*this->index[this->size() - ExtraPointers]).value; }
+ { return static_cast<const_node_reference>(*this->index[this->size()-1u]).value; }
//! <b>Requires</b>: size() > n.
//!
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk