buffers_adaptor::subrange conforms to concept

Fixes #2459
This commit is contained in:
Mohammad Nejati
2024-02-06 16:22:15 +00:00
committed by Mohammad Nejati
parent 25105e476a
commit e0a9da265f
2 changed files with 12 additions and 0 deletions

View File

@ -44,6 +44,7 @@ public:
net::const_buffer>::type; net::const_buffer>::type;
struct iterator; struct iterator;
using const_iterator = iterator;
// construct from two iterators plus optionally subrange definition // construct from two iterators plus optionally subrange definition
subrange( subrange(

View File

@ -18,6 +18,7 @@
#include <boost/beast/core/read_size.hpp> #include <boost/beast/core/read_size.hpp>
#include <boost/beast/_experimental/unit_test/suite.hpp> #include <boost/beast/_experimental/unit_test/suite.hpp>
#include <boost/asio/buffer.hpp> #include <boost/asio/buffer.hpp>
#include <boost/asio/buffers_iterator.hpp>
#include <boost/asio/streambuf.hpp> #include <boost/asio/streambuf.hpp>
#include <iterator> #include <iterator>
@ -114,6 +115,15 @@ public:
read_size(ba, 1024); read_size(ba, 1024);
} }
void
testIssue2459()
{
char s[13];
buffers_triple tb(s, sizeof(s));
buffers_adaptor<buffers_triple> b(tb);
ignore_unused(net::buffers_begin(b.data()));
}
template<bool isMutable> template<bool isMutable>
void void
testSubrange() testSubrange()
@ -165,6 +175,7 @@ public:
testDynamicBuffer(); testDynamicBuffer();
testSpecial(); testSpecial();
testIssue386(); testIssue386();
testIssue2459();
testSubrange<true>(); testSubrange<true>();
testSubrange<false>(); testSubrange<false>();
} }