read_size replaces read_size_helper:

* detail::read_size_helper is removed

* public function read_size helps determine the optimum
  size for calls to a DynamicBuffer's prepare function.

* special case for Asio types which don't conform to
  the concept but have their own helper function.
This commit is contained in:
Vinnie Falco
2017-06-12 01:51:52 -07:00
parent fe4dfed27b
commit a49c096042
18 changed files with 212 additions and 147 deletions

View File

@@ -190,19 +190,18 @@ public:
}
}
// read_size_helper
// read_size
{
using detail::read_size_helper;
static_buffer_n<10> b;
BEAST_EXPECT(read_size_helper(b, 512) == 10);
BEAST_EXPECT(read_size(b, 512) == 10);
b.prepare(4);
b.commit(4);
BEAST_EXPECT(read_size_helper(b, 512) == 6);
BEAST_EXPECT(read_size(b, 512) == 6);
b.consume(2);
BEAST_EXPECT(read_size_helper(b, 512) == 8);
BEAST_EXPECT(read_size(b, 512) == 8);
b.prepare(8);
b.commit(8);
BEAST_EXPECT(read_size_helper(b, 512) == 0);
BEAST_EXPECT(read_size(b, 512) == 0);
}
// base
@@ -224,8 +223,6 @@ public:
void run() override
{
test::check_read_size_helper<static_buffer_n<32>>();
testBuffer();
//testStaticBuffer();
}