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
18 #include <boost/circular_buffer_fwd.hpp>
19 #include <boost/detail/workaround.hpp>
20 #include <boost/static_assert.hpp>
22 // BOOST_CB_ENABLE_DEBUG: Debug support control.
23 #if defined(NDEBUG) || defined(BOOST_CB_DISABLE_DEBUG)
24 #define BOOST_CB_ENABLE_DEBUG 0
26 #define BOOST_CB_ENABLE_DEBUG 1
29 // BOOST_CB_ASSERT: Runtime assertion.
30 #if BOOST_CB_ENABLE_DEBUG
31 #include <boost/assert.hpp>
32 #define BOOST_CB_ASSERT(Expr) BOOST_ASSERT(Expr)
34 #define BOOST_CB_ASSERT(Expr) ((void)0)
37 // BOOST_CB_IS_CONVERTIBLE: Check if Iterator::value_type is convertible to Type.
38 #if BOOST_WORKAROUND(__BORLANDC__, <= 0x0550) || BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
39 #define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) ((void)0)
41 #include <boost/detail/iterator.hpp>
42 #include <boost/type_traits/is_convertible.hpp>
43 #define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) \
44 BOOST_STATIC_ASSERT((is_convertible<typename detail::iterator_traits<Iterator>::value_type, Type>::value))
47 // BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS:
48 // Check if the STL provides templated iterator constructors for its containers.
49 #if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
50 #define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS BOOST_STATIC_ASSERT(false);
52 #define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS ((void)0);
55 #include <boost/circular_buffer/debug.hpp>
56 #include <boost/circular_buffer/details.hpp>
57 #include <boost/circular_buffer/base.hpp>
58 #include <boost/circular_buffer/space_optimized.hpp>
60 #undef BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS
61 #undef BOOST_CB_IS_CONVERTIBLE
62 #undef BOOST_CB_ASSERT
63 #undef BOOST_CB_ENABLE_DEBUG
65 #endif // #if !defined(BOOST_CIRCULAR_BUFFER_HPP)