diff options
Diffstat (limited to 'boost/asio/buffers_iterator.hpp')
-rw-r--r-- | boost/asio/buffers_iterator.hpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/boost/asio/buffers_iterator.hpp b/boost/asio/buffers_iterator.hpp index c11e1469d6..877f9f11cf 100644 --- a/boost/asio/buffers_iterator.hpp +++ b/boost/asio/buffers_iterator.hpp @@ -2,7 +2,7 @@ // buffers_iterator.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -18,11 +18,9 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> #include <iterator> -#include <boost/assert.hpp> -#include <boost/detail/workaround.hpp> -#include <boost/type_traits/is_convertible.hpp> -#include <boost/type_traits/add_const.hpp> #include <boost/asio/buffer.hpp> +#include <boost/asio/detail/assert.hpp> +#include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> @@ -41,7 +39,7 @@ namespace detail template <typename ByteType> struct byte_type { - typedef typename boost::add_const<ByteType>::type type; + typedef typename add_const<ByteType>::type type; }; }; @@ -61,8 +59,9 @@ namespace detail { enum { - is_mutable = boost::is_convertible< - typename BufferSequence::value_type, mutable_buffer>::value + is_mutable = is_convertible< + typename BufferSequence::value_type, + mutable_buffer>::value }; typedef buffers_iterator_types_helper<is_mutable> helper; typedef typename helper::buffer_type buffer_type; @@ -127,9 +126,9 @@ public: /// Construct an iterator representing the beginning of the buffers' data. static buffers_iterator begin(const BufferSequence& buffers) -#if BOOST_WORKAROUND(__GNUC__, == 4) && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) __attribute__ ((__noinline__)) -#endif +#endif // defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) { buffers_iterator new_iter; new_iter.begin_ = buffers.begin(); @@ -147,9 +146,9 @@ public: /// Construct an iterator representing the end of the buffers' data. static buffers_iterator end(const BufferSequence& buffers) -#if BOOST_WORKAROUND(__GNUC__, == 4) && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) __attribute__ ((__noinline__)) -#endif +#endif // defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) { buffers_iterator new_iter; new_iter.begin_ = buffers.begin(); @@ -314,7 +313,7 @@ private: // Increment the iterator. void increment() { - BOOST_ASSERT(current_ != end_ && "iterator out of bounds"); + BOOST_ASIO_ASSERT(current_ != end_ && "iterator out of bounds"); ++position_; // Check if the increment can be satisfied by the current buffer. @@ -337,7 +336,7 @@ private: // Decrement the iterator. void decrement() { - BOOST_ASSERT(position_ > 0 && "iterator out of bounds"); + BOOST_ASIO_ASSERT(position_ > 0 && "iterator out of bounds"); --position_; // Check if the decrement can be satisfied by the current buffer. @@ -369,7 +368,7 @@ private: { if (n > 0) { - BOOST_ASSERT(current_ != end_ && "iterator out of bounds"); + BOOST_ASIO_ASSERT(current_ != end_ && "iterator out of bounds"); for (;;) { std::ptrdiff_t current_buffer_balance @@ -392,7 +391,7 @@ private: // next iteration of this loop. if (++current_ == end_) { - BOOST_ASSERT(n == 0 && "iterator out of bounds"); + BOOST_ASIO_ASSERT(n == 0 && "iterator out of bounds"); current_buffer_ = buffer_type(); current_buffer_position_ = 0; return; @@ -404,7 +403,7 @@ private: else if (n < 0) { std::size_t abs_n = -n; - BOOST_ASSERT(position_ >= abs_n && "iterator out of bounds"); + BOOST_ASIO_ASSERT(position_ >= abs_n && "iterator out of bounds"); for (;;) { // Check if the advance can be satisfied by the current buffer. @@ -422,7 +421,7 @@ private: // Check if we've reached the beginning of the buffers. if (current_ == begin_) { - BOOST_ASSERT(abs_n == 0 && "iterator out of bounds"); + BOOST_ASIO_ASSERT(abs_n == 0 && "iterator out of bounds"); current_buffer_position_ = 0; return; } |