mirror of
https://github.com/boostorg/container.git
synced 2026-02-23 03:32:14 +00:00
Added constant static_vector<>/small_vector::static_capacity to use the configured capacity in constant expressions.
This commit is contained in:
@@ -65,6 +65,7 @@ bool test_small_vector_base_test()
|
||||
typedef boost::container::small_vector_base<int> smb_t;
|
||||
{
|
||||
typedef boost::container::small_vector<int, 5> sm5_t;
|
||||
BOOST_STATIC_ASSERT(sm5_t::static_capacity == 5);
|
||||
sm5_t sm5;
|
||||
smb_t &smb = sm5;
|
||||
smb.push_back(1);
|
||||
@@ -75,6 +76,7 @@ bool test_small_vector_base_test()
|
||||
}
|
||||
{
|
||||
typedef boost::container::small_vector<int, 7> sm7_t;
|
||||
BOOST_STATIC_ASSERT(sm7_t::static_capacity == 7);
|
||||
sm7_t sm7;
|
||||
smb_t &smb = sm7;
|
||||
smb.push_back(2);
|
||||
|
||||
@@ -33,6 +33,7 @@ template <typename T, size_t N>
|
||||
void test_ctor_ndc()
|
||||
{
|
||||
static_vector<T, N> s;
|
||||
BOOST_STATIC_ASSERT((static_vector<T, N>::static_capacity) == N);
|
||||
BOOST_TEST_EQ(s.size() , 0u);
|
||||
BOOST_TEST(s.capacity() == N);
|
||||
BOOST_TEST(s.max_size() == N);
|
||||
@@ -43,6 +44,7 @@ template <typename T, size_t N>
|
||||
void test_ctor_nc(size_t n)
|
||||
{
|
||||
static_vector<T, N> s(n);
|
||||
BOOST_STATIC_ASSERT((static_vector<T, N>::static_capacity) == N);
|
||||
BOOST_TEST(s.size() == n);
|
||||
BOOST_TEST(s.capacity() == N);
|
||||
BOOST_TEST(s.max_size() == N);
|
||||
@@ -64,6 +66,7 @@ template <typename T, size_t N>
|
||||
void test_ctor_nd(size_t n, T const& v)
|
||||
{
|
||||
static_vector<T, N> s(n, v);
|
||||
BOOST_STATIC_ASSERT((static_vector<T, N>::static_capacity) == N);
|
||||
BOOST_TEST(s.size() == n);
|
||||
BOOST_TEST(s.capacity() == N);
|
||||
BOOST_TEST_THROWS( s.at(n), std::out_of_range );
|
||||
|
||||
Reference in New Issue
Block a user