mirror of
https://github.com/boostorg/container.git
synced 2025-08-03 22:44:26 +02:00
Fixed Trac #11957: "static_vector::max_size() is higher than the capacity"
This commit is contained in:
@@ -1221,6 +1221,7 @@ use [*Boost.Container]? There are several reasons for that:
|
|||||||
* [@https://svn.boost.org/trac/boost/ticket/11856 Trac #11856 : ['"pool_resource.cpp error: declaration changes meaning"]].
|
* [@https://svn.boost.org/trac/boost/ticket/11856 Trac #11856 : ['"pool_resource.cpp error: declaration changes meaning"]].
|
||||||
* [@https://svn.boost.org/trac/boost/ticket/11866 Trac #11866 : ['"small_vector does not have range constructor"]].
|
* [@https://svn.boost.org/trac/boost/ticket/11866 Trac #11866 : ['"small_vector does not have range constructor"]].
|
||||||
* [@https://svn.boost.org/trac/boost/ticket/11867 Trac #11867 : ['"small_vector should have constructor and assignment operator taking other small_vector"]].
|
* [@https://svn.boost.org/trac/boost/ticket/11867 Trac #11867 : ['"small_vector should have constructor and assignment operator taking other small_vector"]].
|
||||||
|
* [@https://svn.boost.org/trac/boost/ticket/11957 Trac #11957 : ['"static_vector::max_size() is higher than the capacity"]].
|
||||||
* [@https://svn.boost.org/trac/boost/ticket/12014 Trac #12014 : ['"boost::container::set can not insert const (ref) range"]].
|
* [@https://svn.boost.org/trac/boost/ticket/12014 Trac #12014 : ['"boost::container::set can not insert const (ref) range"]].
|
||||||
* [@https://github.com/boostorg/container/pull/33 GitHub #33: ['Make sure std::string constructor is available]].
|
* [@https://github.com/boostorg/container/pull/33 GitHub #33: ['Make sure std::string constructor is available]].
|
||||||
|
|
||||||
|
@@ -58,6 +58,9 @@ class static_storage_allocator
|
|||||||
|
|
||||||
static const std::size_t internal_capacity = N;
|
static const std::size_t internal_capacity = N;
|
||||||
|
|
||||||
|
std::size_t max_size() const
|
||||||
|
{ return N; }
|
||||||
|
|
||||||
typedef boost::container::container_detail::version_type<static_storage_allocator, 0> version;
|
typedef boost::container::container_detail::version_type<static_storage_allocator, 0> version;
|
||||||
|
|
||||||
BOOST_CONTAINER_FORCEINLINE friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
|
BOOST_CONTAINER_FORCEINLINE friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
|
||||||
|
@@ -35,6 +35,7 @@ void test_ctor_ndc()
|
|||||||
static_vector<T, N> s;
|
static_vector<T, N> s;
|
||||||
BOOST_TEST_EQ(s.size() , 0u);
|
BOOST_TEST_EQ(s.size() , 0u);
|
||||||
BOOST_TEST(s.capacity() == N);
|
BOOST_TEST(s.capacity() == N);
|
||||||
|
BOOST_TEST(s.max_size() == N);
|
||||||
BOOST_TEST_THROWS( s.at(0u), std::out_of_range );
|
BOOST_TEST_THROWS( s.at(0u), std::out_of_range );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +45,7 @@ void test_ctor_nc(size_t n)
|
|||||||
static_vector<T, N> s(n);
|
static_vector<T, N> s(n);
|
||||||
BOOST_TEST(s.size() == n);
|
BOOST_TEST(s.size() == n);
|
||||||
BOOST_TEST(s.capacity() == N);
|
BOOST_TEST(s.capacity() == N);
|
||||||
|
BOOST_TEST(s.max_size() == N);
|
||||||
BOOST_TEST_THROWS( s.at(n), std::out_of_range );
|
BOOST_TEST_THROWS( s.at(n), std::out_of_range );
|
||||||
if ( 1 < n )
|
if ( 1 < n )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user