summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/asio/buffer.hpp')
-rw-r--r--3rdParty/Boost/src/boost/asio/buffer.hpp149
1 files changed, 124 insertions, 25 deletions
diff --git a/3rdParty/Boost/src/boost/asio/buffer.hpp b/3rdParty/Boost/src/boost/asio/buffer.hpp
index 532cfd1..450face 100644
--- a/3rdParty/Boost/src/boost/asio/buffer.hpp
+++ b/3rdParty/Boost/src/boost/asio/buffer.hpp
@@ -1,11 +1,11 @@
//
// buffer.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)
//
#ifndef BOOST_ASIO_BUFFER_HPP
@@ -17,40 +17,46 @@
#include <boost/asio/detail/config.hpp>
#include <cstddef>
#include <cstring>
#include <string>
#include <vector>
-#include <boost/detail/workaround.hpp>
#include <boost/asio/detail/array_fwd.hpp>
-#if defined(BOOST_MSVC)
+#if defined(BOOST_ASIO_MSVC)
# if defined(_HAS_ITERATOR_DEBUGGING) && (_HAS_ITERATOR_DEBUGGING != 0)
# if !defined(BOOST_ASIO_DISABLE_BUFFER_DEBUGGING)
# define BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
# endif // !defined(BOOST_ASIO_DISABLE_BUFFER_DEBUGGING)
# endif // defined(_HAS_ITERATOR_DEBUGGING)
-#endif // defined(BOOST_MSVC)
+#endif // defined(BOOST_ASIO_MSVC)
#if defined(__GNUC__)
# if defined(_GLIBCXX_DEBUG)
# if !defined(BOOST_ASIO_DISABLE_BUFFER_DEBUGGING)
# define BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
# endif // !defined(BOOST_ASIO_DISABLE_BUFFER_DEBUGGING)
# endif // defined(_GLIBCXX_DEBUG)
#endif // defined(__GNUC__)
#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
-# include <boost/function.hpp>
+# include <boost/asio/detail/function.hpp>
#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) \
- || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
-# include <boost/type_traits/is_const.hpp>
-#endif // BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
- // || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
+#if defined(BOOST_ASIO_HAS_BOOST_WORKAROUND)
+# include <boost/detail/workaround.hpp>
+# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) \
+ || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
+# define BOOST_ASIO_ENABLE_ARRAY_BUFFER_WORKAROUND
+# endif // BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
+ // || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
+#endif // defined(BOOST_ASIO_HAS_BOOST_WORKAROUND)
+
+#if defined(BOOST_ASIO_ENABLE_ARRAY_BUFFER_WORKAROUND)
+# include <boost/asio/detail/type_traits.hpp>
+#endif // defined(BOOST_ASIO_ENABLE_ARRAY_BUFFER_WORKAROUND)
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
@@ -99,20 +105,20 @@ public:
size_(size)
{
}
#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
mutable_buffer(void* data, std::size_t size,
- boost::function<void()> debug_check)
+ boost::asio::detail::function<void()> debug_check)
: data_(data),
size_(size),
debug_check_(debug_check)
{
}
- const boost::function<void()>& get_debug_check() const
+ const boost::asio::detail::function<void()>& get_debug_check() const
{
return debug_check_;
}
#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
private:
@@ -122,13 +128,13 @@ private:
const mutable_buffer& b);
void* data_;
std::size_t size_;
#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
- boost::function<void()> debug_check_;
+ boost::asio::detail::function<void()> debug_check_;
#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
};
namespace detail {
inline void* buffer_cast_helper(const mutable_buffer& b)
@@ -229,20 +235,20 @@ public:
#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
{
}
#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
const_buffer(const void* data, std::size_t size,
- boost::function<void()> debug_check)
+ boost::asio::detail::function<void()> debug_check)
: data_(data),
size_(size),
debug_check_(debug_check)
{
}
- const boost::function<void()>& get_debug_check() const
+ const boost::asio::detail::function<void()>& get_debug_check() const
{
return debug_check_;
}
#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
private:
@@ -252,13 +258,13 @@ private:
const const_buffer& b);
const void* data_;
std::size_t size_;
#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
- boost::function<void()> debug_check_;
+ boost::asio::detail::function<void()> debug_check_;
#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
};
namespace detail {
inline const void* buffer_cast_helper(const const_buffer& b)
@@ -509,18 +515,18 @@ public:
: iter_(iter)
{
}
~buffer_debug_check()
{
-#if BOOST_WORKAROUND(BOOST_MSVC, == 1400)
+#if defined(BOOST_ASIO_MSVC) && (BOOST_ASIO_MSVC == 1400)
// MSVC 8's string iterator checking may crash in a std::string::iterator
// object's destructor when the iterator points to an already-destroyed
// std::string object, unless the iterator is cleared first.
iter_ = Iterator();
-#endif // BOOST_WORKAROUND(BOOST_MSVC, == 1400)
+#endif // defined(BOOST_ASIO_MSVC) && (BOOST_ASIO_MSVC == 1400)
}
void operator()()
{
*iter_;
}
@@ -609,12 +615,15 @@ private:
*
* @code vector<const_buffer> buffers = ...;
*
* vector<unsigned char> data(boost::asio::buffer_size(buffers));
* boost::asio::buffer_copy(boost::asio::buffer(data), buffers); @endcode
*
+ * Note that @ref buffer_copy is implemented in terms of @c memcpy, and
+ * consequently it cannot be used to copy between overlapping memory regions.
+ *
* @par Buffer Invalidation
*
* A buffer object does not have any ownership of the memory it refers to. It
* is the responsibility of the application to ensure the memory region remains
* valid until it is no longer required for an I/O operation. When the memory
* is no longer available, the buffer is said to have been invalidated.
@@ -825,14 +834,13 @@ inline const_buffers_1 buffer(const PodType (&data)[N],
return const_buffers_1(
const_buffer(data,
N * sizeof(PodType) < max_size_in_bytes
? N * sizeof(PodType) : max_size_in_bytes));
}
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) \
- || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
+#if defined(BOOST_ASIO_ENABLE_ARRAY_BUFFER_WORKAROUND)
// Borland C++ and Sun Studio think the overloads:
//
// unspecified buffer(boost::array<PodType, N>& array ...);
//
// and
@@ -861,13 +869,13 @@ struct buffer_types_base<true>
typedef const_buffer buffer_type;
typedef const_buffers_1 container_type;
};
template <typename PodType>
struct buffer_types
- : public buffer_types_base<boost::is_const<PodType>::value>
+ : public buffer_types_base<is_const<PodType>::value>
{
};
} // namespace detail
template <typename PodType, std::size_t N>
@@ -893,14 +901,13 @@ buffer(boost::array<PodType, N>& data, std::size_t max_size_in_bytes)
return container_type(
buffer_type(data.c_array(),
data.size() * sizeof(PodType) < max_size_in_bytes
? data.size() * sizeof(PodType) : max_size_in_bytes));
}
-#else // BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
- // || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
+#else // defined(BOOST_ASIO_ENABLE_ARRAY_BUFFER_WORKAROUND)
/// Create a new modifiable buffer that represents the given POD array.
/**
* @returns A mutable_buffers_1 value equivalent to:
* @code mutable_buffers_1(
* data.data(),
@@ -958,14 +965,13 @@ inline const_buffers_1 buffer(boost::array<const PodType, N>& data,
return const_buffers_1(
const_buffer(data.data(),
data.size() * sizeof(PodType) < max_size_in_bytes
? data.size() * sizeof(PodType) : max_size_in_bytes));
}
-#endif // BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
- // || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
+#endif // defined(BOOST_ASIO_ENABLE_ARRAY_BUFFER_WORKAROUND)
/// Create a new non-modifiable buffer that represents the given POD array.
/**
* @returns A const_buffers_1 value equivalent to:
* @code const_buffers_1(
* data.data(),
@@ -1259,12 +1265,15 @@ inline const_buffers_1 buffer(
* @li @c buffer_size(source)
*
* @li @c If specified, @c max_bytes_to_copy.
*
* This prevents buffer overflow, regardless of the buffer sizes used in the
* copy operation.
+ *
+ * Note that @ref buffer_copy is implemented in terms of @c memcpy, and
+ * consequently it cannot be used to copy between overlapping memory regions.
*/
/*@{*/
/// Copies bytes from a source buffer to a target buffer.
/**
* @param target A modifiable buffer representing the memory region to which
@@ -1277,12 +1286,15 @@ inline const_buffers_1 buffer(
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffer& target,
const const_buffer& source)
{
using namespace std; // For memcpy.
std::size_t target_size = buffer_size(target);
@@ -1304,12 +1316,15 @@ inline std::size_t buffer_copy(const mutable_buffer& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffer& target,
const const_buffers_1& source)
{
return buffer_copy(target, static_cast<const const_buffer&>(source));
}
@@ -1327,12 +1342,15 @@ inline std::size_t buffer_copy(const mutable_buffer& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffer& target,
const mutable_buffer& source)
{
return buffer_copy(target, const_buffer(source));
}
@@ -1350,12 +1368,15 @@ inline std::size_t buffer_copy(const mutable_buffer& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffer& target,
const mutable_buffers_1& source)
{
return buffer_copy(target, const_buffer(source));
}
@@ -1372,12 +1393,15 @@ inline std::size_t buffer_copy(const mutable_buffer& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename ConstBufferSequence>
std::size_t buffer_copy(const mutable_buffer& target,
const ConstBufferSequence& source)
{
std::size_t total_bytes_copied = 0;
@@ -1409,12 +1433,15 @@ std::size_t buffer_copy(const mutable_buffer& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffers_1& target,
const const_buffer& source)
{
return buffer_copy(static_cast<const mutable_buffer&>(target), source);
}
@@ -1431,12 +1458,15 @@ inline std::size_t buffer_copy(const mutable_buffers_1& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffers_1& target,
const const_buffers_1& source)
{
return buffer_copy(static_cast<const mutable_buffer&>(target),
static_cast<const const_buffer&>(source));
@@ -1455,12 +1485,15 @@ inline std::size_t buffer_copy(const mutable_buffers_1& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffers_1& target,
const mutable_buffer& source)
{
return buffer_copy(static_cast<const mutable_buffer&>(target),
const_buffer(source));
@@ -1479,12 +1512,15 @@ inline std::size_t buffer_copy(const mutable_buffers_1& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffers_1& target,
const mutable_buffers_1& source)
{
return buffer_copy(static_cast<const mutable_buffer&>(target),
const_buffer(source));
@@ -1502,12 +1538,15 @@ inline std::size_t buffer_copy(const mutable_buffers_1& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename ConstBufferSequence>
inline std::size_t buffer_copy(const mutable_buffers_1& target,
const ConstBufferSequence& source)
{
return buffer_copy(static_cast<const mutable_buffer&>(target), source);
@@ -1525,12 +1564,15 @@ inline std::size_t buffer_copy(const mutable_buffers_1& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename MutableBufferSequence>
std::size_t buffer_copy(const MutableBufferSequence& target,
const const_buffer& source)
{
std::size_t total_bytes_copied = 0;
@@ -1562,12 +1604,15 @@ std::size_t buffer_copy(const MutableBufferSequence& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename MutableBufferSequence>
inline std::size_t buffer_copy(const MutableBufferSequence& target,
const const_buffers_1& source)
{
return buffer_copy(target, static_cast<const const_buffer&>(source));
@@ -1586,12 +1631,15 @@ inline std::size_t buffer_copy(const MutableBufferSequence& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename MutableBufferSequence>
inline std::size_t buffer_copy(const MutableBufferSequence& target,
const mutable_buffer& source)
{
return buffer_copy(target, const_buffer(source));
@@ -1610,12 +1658,15 @@ inline std::size_t buffer_copy(const MutableBufferSequence& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename MutableBufferSequence>
inline std::size_t buffer_copy(const MutableBufferSequence& target,
const mutable_buffers_1& source)
{
return buffer_copy(target, const_buffer(source));
@@ -1633,12 +1684,15 @@ inline std::size_t buffer_copy(const MutableBufferSequence& target,
*
* @note The number of bytes copied is the lesser of:
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename MutableBufferSequence, typename ConstBufferSequence>
std::size_t buffer_copy(const MutableBufferSequence& target,
const ConstBufferSequence& source)
{
std::size_t total_bytes_copied = 0;
@@ -1698,12 +1752,15 @@ std::size_t buffer_copy(const MutableBufferSequence& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffer& target,
const const_buffer& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(buffer(target, max_bytes_to_copy), source);
}
@@ -1724,12 +1781,15 @@ inline std::size_t buffer_copy(const mutable_buffer& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffer& target,
const const_buffers_1& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(buffer(target, max_bytes_to_copy), source);
}
@@ -1751,12 +1811,15 @@ inline std::size_t buffer_copy(const mutable_buffer& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffer& target,
const mutable_buffer& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(buffer(target, max_bytes_to_copy), source);
}
@@ -1778,12 +1841,15 @@ inline std::size_t buffer_copy(const mutable_buffer& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffer& target,
const mutable_buffers_1& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(buffer(target, max_bytes_to_copy), source);
}
@@ -1805,12 +1871,15 @@ inline std::size_t buffer_copy(const mutable_buffer& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename ConstBufferSequence>
inline std::size_t buffer_copy(const mutable_buffer& target,
const ConstBufferSequence& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(buffer(target, max_bytes_to_copy), source);
@@ -1832,12 +1901,15 @@ inline std::size_t buffer_copy(const mutable_buffer& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffers_1& target,
const const_buffer& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(buffer(target, max_bytes_to_copy), source);
}
@@ -1858,12 +1930,15 @@ inline std::size_t buffer_copy(const mutable_buffers_1& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffers_1& target,
const const_buffers_1& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(buffer(target, max_bytes_to_copy), source);
}
@@ -1885,12 +1960,15 @@ inline std::size_t buffer_copy(const mutable_buffers_1& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffers_1& target,
const mutable_buffer& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(buffer(target, max_bytes_to_copy), source);
}
@@ -1912,12 +1990,15 @@ inline std::size_t buffer_copy(const mutable_buffers_1& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
inline std::size_t buffer_copy(const mutable_buffers_1& target,
const mutable_buffers_1& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(buffer(target, max_bytes_to_copy), source);
}
@@ -1939,12 +2020,15 @@ inline std::size_t buffer_copy(const mutable_buffers_1& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename ConstBufferSequence>
inline std::size_t buffer_copy(const mutable_buffers_1& target,
const ConstBufferSequence& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(buffer(target, max_bytes_to_copy), source);
@@ -1967,12 +2051,15 @@ inline std::size_t buffer_copy(const mutable_buffers_1& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename MutableBufferSequence>
inline std::size_t buffer_copy(const MutableBufferSequence& target,
const const_buffer& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(target, buffer(source, max_bytes_to_copy));
@@ -1995,12 +2082,15 @@ inline std::size_t buffer_copy(const MutableBufferSequence& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename MutableBufferSequence>
inline std::size_t buffer_copy(const MutableBufferSequence& target,
const const_buffers_1& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(target, buffer(source, max_bytes_to_copy));
@@ -2024,12 +2114,15 @@ inline std::size_t buffer_copy(const MutableBufferSequence& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename MutableBufferSequence>
inline std::size_t buffer_copy(const MutableBufferSequence& target,
const mutable_buffer& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(target, buffer(source, max_bytes_to_copy));
@@ -2053,12 +2146,15 @@ inline std::size_t buffer_copy(const MutableBufferSequence& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename MutableBufferSequence>
inline std::size_t buffer_copy(const MutableBufferSequence& target,
const mutable_buffers_1& source, std::size_t max_bytes_to_copy)
{
return buffer_copy(target, buffer(source, max_bytes_to_copy));
@@ -2081,12 +2177,15 @@ inline std::size_t buffer_copy(const MutableBufferSequence& target,
*
* @li @c buffer_size(target)
*
* @li @c buffer_size(source)
*
* @li @c max_bytes_to_copy
+ *
+ * This function is implemented in terms of @c memcpy, and consequently it
+ * cannot be used to copy between overlapping memory regions.
*/
template <typename MutableBufferSequence, typename ConstBufferSequence>
std::size_t buffer_copy(const MutableBufferSequence& target,
const ConstBufferSequence& source, std::size_t max_bytes_to_copy)
{
std::size_t total_bytes_copied = 0;