circular_buffer.hpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Circular buffer library header file.
  2. // Copyright (c) 2003-2008 Jan Gaspar
  3. // Use, modification, and distribution is subject to the Boost Software
  4. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. // See www.boost.org/libs/circular_buffer for documentation.
  7. #if !defined(BOOST_CIRCULAR_BUFFER_HPP)
  8. #define BOOST_CIRCULAR_BUFFER_HPP
  9. #if defined(_MSC_VER)
  10. #pragma once
  11. #endif
  12. #include <boost/circular_buffer_fwd.hpp>
  13. #include <boost/config/workaround.hpp>
  14. #include <boost/static_assert.hpp>
  15. // BOOST_CB_ENABLE_DEBUG: Debug support control.
  16. #if !defined(BOOST_CB_ENABLE_DEBUG)
  17. #define BOOST_CB_ENABLE_DEBUG 0
  18. #endif
  19. // BOOST_CB_ASSERT: Runtime assertion.
  20. #if BOOST_CB_ENABLE_DEBUG
  21. #include <boost/assert.hpp>
  22. #define BOOST_CB_ASSERT(Expr) BOOST_ASSERT(Expr)
  23. #else
  24. #define BOOST_CB_ASSERT(Expr) ((void)0)
  25. #endif
  26. // BOOST_CB_IS_CONVERTIBLE: Check if Iterator::value_type is convertible to Type.
  27. #if BOOST_WORKAROUND(__BORLANDC__, <= 0x0550) || BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
  28. #define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) ((void)0)
  29. #else
  30. #include <iterator>
  31. #include <boost/type_traits/is_convertible.hpp>
  32. #define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) \
  33. BOOST_STATIC_ASSERT((is_convertible<typename std::iterator_traits<Iterator>::value_type, Type>::value))
  34. #endif
  35. // BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS:
  36. // Check if the STL provides templated iterator constructors for its containers.
  37. #if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
  38. #define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS BOOST_STATIC_ASSERT(false);
  39. #else
  40. #define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS ((void)0);
  41. #endif
  42. #include <boost/circular_buffer/debug.hpp>
  43. #include <boost/circular_buffer/details.hpp>
  44. #include <boost/circular_buffer/base.hpp>
  45. #include <boost/circular_buffer/space_optimized.hpp>
  46. #undef BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS
  47. #undef BOOST_CB_IS_CONVERTIBLE
  48. #undef BOOST_CB_ASSERT
  49. #endif // #if !defined(BOOST_CIRCULAR_BUFFER_HPP)