diff --git a/CHANGELOG.md b/CHANGELOG.md index 7138f7ce..5b6b297e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Add HTTPS example * Add Secure WebSocket example * Fix message_v1 constructor +* Tidy up DynamicBuffer requirements -------------------------------------------------------------------------------- diff --git a/include/beast/core/detail/buffer_concepts.hpp b/include/beast/core/detail/buffer_concepts.hpp index 2361e678..22d82918 100644 --- a/include/beast/core/detail/buffer_concepts.hpp +++ b/include/beast/core/detail/buffer_concepts.hpp @@ -88,50 +88,76 @@ public: template class is_DynamicBuffer { - template().prepare(1)), - boost::asio::mutable_buffer>::type::value>> + // size() + template().size()), std::size_t>> static R check1(int); template static std::false_type check1(...); using type1 = decltype(check1(0)); - template().data()), - boost::asio::const_buffer>::type::value>> + // max_size() + template().max_size()), std::size_t>> static R check2(int); template static std::false_type check2(...); using type2 = decltype(check2(0)); - template().commit(1), std::true_type{})> + // capacity() + template().capacity()), std::size_t>> static R check3(int); template static std::false_type check3(...); using type3 = decltype(check3(0)); - template().consume(1), std::true_type{})> + // data() + template().data()), + boost::asio::const_buffer>::type::value>> static R check4(int); template static std::false_type check4(...); using type4 = decltype(check4(0)); - template().size()), std::size_t>> + // prepare() + template().prepare(1)), + boost::asio::mutable_buffer>::type::value>> static R check5(int); template static std::false_type check5(...); using type5 = decltype(check5(0)); + // commit() + template().commit(1), std::true_type{})> + static R check6(int); + template + static std::false_type check6(...); + using type6 = decltype(check6(0)); + + // consume + template().consume(1), std::true_type{})> + static R check7(int); + template + static std::false_type check7(...); + using type7 = decltype(check7(0)); + public: using type = std::integral_constant; + type1::value + && type2::value + //&& type3::value // Networking TS + && type4::value + && type5::value + && type6::value + && type7::value + >; }; } // detail diff --git a/test/core/streambuf.cpp b/test/core/streambuf.cpp index 08823eb7..3f46658d 100644 --- a/test/core/streambuf.cpp +++ b/test/core/streambuf.cpp @@ -7,3 +7,10 @@ // Test that header file is self-contained. #include + +#include +namespace beast { + +static_assert(is_DynamicBuffer::value, ""); + +} // beast