Tidy up msvc-14 workaround in multi_buffer

This commit is contained in:
Vinnie Falco
2018-12-14 13:45:07 -08:00
parent 49c5f7c30f
commit ad2cdf0281
3 changed files with 27 additions and 21 deletions

View File

@@ -1,6 +1,7 @@
Version 200 Version 200
* Don't include OpenSSL for core snippets * Don't include OpenSSL for core snippets
* Tidy up msvc-14 workaround in multi_buffer
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -133,7 +133,7 @@ public:
#endif #endif
template<class Allocator> template<class Allocator>
template<bool IsMutable> template<bool isMutable>
class basic_multi_buffer<Allocator>::readable_bytes class basic_multi_buffer<Allocator>::readable_bytes
{ {
basic_multi_buffer const* b_; basic_multi_buffer const* b_;
@@ -149,17 +149,14 @@ class basic_multi_buffer<Allocator>::readable_bytes
public: public:
using value_type = typename std::conditional< using value_type = typename std::conditional<
IsMutable, isMutable,
net::mutable_buffer, net::mutable_buffer,
net::const_buffer>::type; net::const_buffer>::type;
class const_iterator; class const_iterator;
readable_bytes() = delete; readable_bytes() = delete;
#if ! defined(_MSC_VER) || (_MSC_VER >= 1910) #if BOOST_WORKAROUND(BOOST_MSVC, < 1910)
readable_bytes(readable_bytes const&) = default;
readable_bytes& operator=(readable_bytes const&) = default;
#else
readable_bytes(readable_bytes const& other) readable_bytes(readable_bytes const& other)
: b_(other.b_) : b_(other.b_)
{ {
@@ -170,11 +167,14 @@ public:
b_ = other.b_; b_ = other.b_;
return *this; return *this;
} }
#else
readable_bytes(readable_bytes const&) = default;
readable_bytes& operator=(readable_bytes const&) = default;
#endif #endif
template< template<
bool IsMutable_ = IsMutable, bool isMutable_ = isMutable,
class = typename std::enable_if<! IsMutable_>::type> class = typename std::enable_if<! isMutable_>::type>
readable_bytes( readable_bytes(
readable_bytes<true> const& other) noexcept readable_bytes<true> const& other) noexcept
: b_(other.b_) : b_(other.b_)
@@ -182,8 +182,8 @@ public:
} }
template< template<
bool IsMutable_ = IsMutable, bool isMutable_ = isMutable,
class = typename std::enable_if<! IsMutable_>::type> class = typename std::enable_if<! isMutable_>::type>
readable_bytes& operator=( readable_bytes& operator=(
readable_bytes<true> const& other) noexcept readable_bytes<true> const& other) noexcept
{ {
@@ -209,10 +209,10 @@ public:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template<class Allocator> template<class Allocator>
template<bool IsMutable> template<bool isMutable>
class class
basic_multi_buffer<Allocator>:: basic_multi_buffer<Allocator>::
readable_bytes<IsMutable>:: readable_bytes<isMutable>::
const_iterator const_iterator
{ {
basic_multi_buffer const* b_ = nullptr; basic_multi_buffer const* b_ = nullptr;
@@ -416,10 +416,10 @@ public:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template<class Allocator> template<class Allocator>
template<bool IsMutable> template<bool isMutable>
auto auto
basic_multi_buffer<Allocator>:: basic_multi_buffer<Allocator>::
readable_bytes<IsMutable>:: readable_bytes<isMutable>::
begin() const noexcept -> begin() const noexcept ->
const_iterator const_iterator
{ {
@@ -427,10 +427,10 @@ begin() const noexcept ->
} }
template<class Allocator> template<class Allocator>
template<bool IsMutable> template<bool isMutable>
auto auto
basic_multi_buffer<Allocator>:: basic_multi_buffer<Allocator>::
readable_bytes<IsMutable>:: readable_bytes<isMutable>::
end() const noexcept -> end() const noexcept ->
const_iterator const_iterator
{ {

View File

@@ -79,7 +79,7 @@ class basic_multi_buffer
// contains `element` followed by raw storage bytes. // contains `element` followed by raw storage bytes.
class element; class element;
template<bool IsMutable> template<bool>
class readable_bytes; class readable_bytes;
using alloc_traits = using alloc_traits =
@@ -435,11 +435,17 @@ public:
std::size_t std::size_t
capacity() const noexcept; capacity() const noexcept;
/// Returns a constant buffer sequence representing the readable bytes /** Returns a constant buffer sequence representing the readable bytes
@note The sequence may contain multiple contiguous memory regions.
*/
const_buffers_type const_buffers_type
data() const noexcept; data() const noexcept;
/// Returns a constant buffer sequence representing the readable bytes /** Returns a constant buffer sequence representing the readable bytes
@note The sequence may contain multiple contiguous memory regions.
*/
const_buffers_type const_buffers_type
cdata() const noexcept cdata() const noexcept
{ {
@@ -448,8 +454,7 @@ public:
/** Returns a mutable buffer sequence representing the readable bytes. /** Returns a mutable buffer sequence representing the readable bytes.
@note The sequence may contain zero or more contiguous memory @note The sequence may contain multiple contiguous memory regions.
regions.
*/ */
mutable_data_type mutable_data_type
data() noexcept; data() noexcept;