1 // Circular buffer library header file.
3 // Copyright (c) 2003-2008 Jan Gaspar
5 // Use, modification, and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See www.boost.org/libs/circular_buffer for documentation.
11 #if !defined(BOOST_CIRCULAR_BUFFER_HPP)
12 #define BOOST_CIRCULAR_BUFFER_HPP
14 #if defined(_MSC_VER) && _MSC_VER >= 1200
18 #include <boost/circular_buffer_fwd.hpp>
19 #include <boost/detail/workaround.hpp>
21 // BOOST_CB_ENABLE_DEBUG: Debug support control.
22 #if defined(NDEBUG) || defined(BOOST_CB_DISABLE_DEBUG)
23 #define BOOST_CB_ENABLE_DEBUG 0
25 #define BOOST_CB_ENABLE_DEBUG 0
28 #define BOOST_CB_INTERNAL_STATIC_ASSERT( B ) \
29 typedef ::boost::static_assert_test<\
30 sizeof(::boost::STATIC_ASSERTION_FAILURE< bool( B ) >)>\
31 BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
33 // BOOST_CB_ASSERT: Runtime assertion.
34 #if BOOST_CB_ENABLE_DEBUG
35 #include <boost/assert.hpp>
36 #define BOOST_CB_ASSERT(Expr) BOOST_ASSERT(Expr)
38 #define BOOST_CB_ASSERT(Expr) ((void)0)
41 // BOOST_CB_STATIC_ASSERT: Compile time assertion.
42 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
43 #define BOOST_CB_STATIC_ASSERT(Expr) (void(0))
45 #include <boost/static_assert.hpp>
46 #define BOOST_CB_STATIC_ASSERT(Expr) BOOST_CB_INTERNAL_STATIC_ASSERT(Expr)
49 // BOOST_CB_IS_CONVERTIBLE: Check if Iterator::value_type is convertible to Type.
50 #if BOOST_WORKAROUND(__BORLANDC__, <= 0x0550) || BOOST_WORKAROUND(__MWERKS__, <= 0x2407) || \
51 BOOST_WORKAROUND(BOOST_MSVC, < 1300)
52 #define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) (void(0))
54 #include <boost/detail/iterator.hpp>
55 #include <boost/type_traits/is_convertible.hpp>
56 #define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) \
57 BOOST_CB_STATIC_ASSERT((is_convertible<typename detail::iterator_traits<Iterator>::value_type, Type>::value))
60 // BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS:
61 // Check if the STL provides templated iterator constructors for its containers.
62 #if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
63 #define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS BOOST_CB_STATIC_ASSERT(false);
65 #define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS (void(0));
68 #include <boost/circular_buffer/debug.hpp>
69 #include <boost/circular_buffer/details.hpp>
70 #include <boost/circular_buffer/base.hpp>
71 #include <boost/circular_buffer/space_optimized.hpp>
73 #undef BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS
74 #undef BOOST_CB_IS_CONVERTIBLE
75 #undef BOOST_CB_STATIC_ASSERT
76 #undef BOOST_CB_INTERNAL_STATIC_ASSERT
77 #undef BOOST_CB_ASSERT
78 #undef BOOST_CB_ENABLE_DEBUG
80 #endif // #if !defined(BOOST_CIRCULAR_BUFFER_HPP)