From ea927bdeeacab51993b1f6ec76b44719355972e8 Mon Sep 17 00:00:00 2001 From: Jan Gaspar Date: Wed, 17 Aug 2005 14:55:50 +0000 Subject: [PATCH] minor changes [SVN r2685] --- include/boost/circular_buffer/adaptor.hpp | 5 ++--- include/boost/circular_buffer/base.hpp | 4 ++-- include/boost/circular_buffer/details.hpp | 2 +- test/base_test.cpp | 6 +++--- test/common.cpp | 22 +++++++++++----------- test/test.hpp | 18 +++++++++--------- 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/include/boost/circular_buffer/adaptor.hpp b/include/boost/circular_buffer/adaptor.hpp index 1a12feb..81b1016 100644 --- a/include/boost/circular_buffer/adaptor.hpp +++ b/include/boost/circular_buffer/adaptor.hpp @@ -240,9 +240,7 @@ public: : circular_buffer( init_capacity(capacity, min_capacity, first, last), first, last, alloc) , m_capacity(capacity) - , m_min_capacity(min_capacity) { - BOOST_CB_ASSERT(capacity >= min_capacity); // check for capacity lower than min_capacity - } + , m_min_capacity(min_capacity) { } // Default destructor @@ -498,6 +496,7 @@ private: template static size_type init_capacity(size_type capacity, size_type min_capacity, InputIterator first, InputIterator last) { BOOST_CB_IS_CONVERTIBLE(InputIterator, value_type); // check for valid iterator type + BOOST_CB_ASSERT(capacity >= min_capacity); // check for capacity lower than min_capacity BOOST_CB_ASSERT(std::distance(first, last) >= 0); // check for wrong range return std::min(capacity, std::max(min_capacity, static_cast(std::distance(first, last)))); diff --git a/include/boost/circular_buffer/base.hpp b/include/boost/circular_buffer/base.hpp index b6cc779..2cf846c 100644 --- a/include/boost/circular_buffer/base.hpp +++ b/include/boost/circular_buffer/base.hpp @@ -1329,8 +1329,8 @@ private: } //! Specialized rinsert method. - template - void rinsert(iterator pos, InputIterator n, InputIterator item, cb_details::int_tag) { + template + void rinsert(iterator pos, IntegralType n, IntegralType item, cb_details::int_tag) { rinsert(pos, (size_type)n, item); } diff --git a/include/boost/circular_buffer/details.hpp b/include/boost/circular_buffer/details.hpp index 9a12c0c..8bbd2c2 100644 --- a/include/boost/circular_buffer/details.hpp +++ b/include/boost/circular_buffer/details.hpp @@ -197,7 +197,7 @@ public: */ iterator(const Buff* cb, const pointer p) : iterator_base(cb), m_buff(cb), m_it(p) {} - // Assign operator. + //! Assign operator. iterator& operator = (const iterator& it) { if (this == &it) return *this; diff --git a/test/base_test.cpp b/test/base_test.cpp index 7b9cbe0..3fee06a 100644 --- a/test/base_test.cpp +++ b/test/base_test.cpp @@ -39,9 +39,9 @@ void iterator_constructor_and_assign_test() { void iterator_reference_test() { - circular_buffer cb(3, C()); - circular_buffer::iterator it = cb.begin(); - circular_buffer::const_iterator cit = cb.begin() + 1; + circular_buffer cb(3, Z()); + circular_buffer::iterator it = cb.begin(); + circular_buffer::const_iterator cit = cb.begin() + 1; BOOST_CHECK((*it).test_reference1() == it->test_reference2()); BOOST_CHECK((*cit).test_reference2() == cit->test_reference1()); diff --git a/test/common.cpp b/test/common.cpp index 94a9d6d..4661d44 100644 --- a/test/common.cpp +++ b/test/common.cpp @@ -644,9 +644,9 @@ void swap_test() { void push_back_test() { - CB_CONTAINER cb1(5); + CB_CONTAINER cb1(5); cb1.push_back(); - cb1.push_back(A(2)); + cb1.push_back(X(2)); BOOST_CHECK(cb1[0].m_n == 1); BOOST_CHECK(cb1[1].m_n == 2); @@ -806,9 +806,9 @@ void insert_range_test() { void push_front_test() { - CB_CONTAINER cb1(5); + CB_CONTAINER cb1(5); cb1.push_front(); - cb1.push_front(A(2)); + cb1.push_front(X(2)); BOOST_CHECK(cb1[0].m_n == 2); BOOST_CHECK(cb1[1].m_n == 1); @@ -1321,16 +1321,16 @@ void example_test() { void element_destruction_test() { - CB_CONTAINER cb(5); - cb.push_back(B()); - cb.push_back(B()); - cb.push_back(B()); - int prevCount = B::count(); + CB_CONTAINER cb(5); + cb.push_back(Y()); + cb.push_back(Y()); + cb.push_back(Y()); + int prevCount = Y::count(); cb.clear(); BOOST_CHECK(cb.empty()); BOOST_CHECK(prevCount == 3); - BOOST_CHECK(B::count() == 0); + BOOST_CHECK(Y::count() == 0); } void const_methods_test() { @@ -1378,7 +1378,7 @@ void adaptor_test() { } int Integer::ms_exception_trigger = 0; -int B::ms_count = 0; +int Y::ms_count = 0; // add common tests into a test suite void add_common_tests(test_suite* tests) { diff --git a/test/test.hpp b/test/test.hpp index 1076f2d..a1dad77 100644 --- a/test/test.hpp +++ b/test/test.hpp @@ -54,18 +54,18 @@ public: static void set_exception_trigger(int n) { ms_exception_trigger = n; } }; -struct A +struct X { - A() : m_n(1) {} - A(int n) : m_n(n) {} + X() : m_n(1) {} + X(int n) : m_n(n) {} int m_n; }; -class B { +class Y { public: - B() { increment(); } - B(const B& y) { y.increment(); } - ~B() { decrement(); } + Y() { increment(); } + Y(const Y& y) { y.increment(); } + ~Y() { decrement(); } static int count() { return ms_count; } private: void increment() const { ++ms_count; } @@ -73,9 +73,9 @@ private: static int ms_count; }; -class C { +class Z { public: - C() : m_num(255) {} + Z() : m_num(255) {} virtual int test_reference1() const { return m_num; } int test_reference2() const { return 255; } private: