Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitca95f04

Browse files
LoopinFooldeanberris
authored andcommitted
Use generic iterator range instead of casting between iterator types. Avoids an issue with Microsoft's checked iterators and is likely more correct/portable. (#852)
1 parent38e48c9 commitca95f04

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎boost/network/protocol/http/client/connection/async_normal.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ struct chunk_encoding_parser {
5151
size_t chunk_size;
5252
buffer_type buffer;
5353

54-
voidupdate_chunk_size(char_const_rangeconst &range) {
54+
template<typename T>
55+
voidupdate_chunk_size(boost::iterator_range<T>const &range) {
5556
if (range.empty())return;
5657
std::stringstream ss;
5758
ss << std::hex << range;
@@ -61,7 +62,8 @@ struct chunk_encoding_parser {
6162
chunk_size = (chunk_size << (range.size() *4)) | size;
6263
}
6364

64-
char_const_rangeoperator()(char_const_rangeconst &range) {
65+
template<typename T>
66+
char_const_rangeoperator()(boost::iterator_range<T>const &range) {
6567
auto iter =boost::begin(range);
6668
auto begin = iter;
6769
auto pos =boost::begin(buffer);
@@ -485,10 +487,8 @@ struct http_async_connection
485487
constauto parse_buffer_size = parse_chunk_encoding.buffer.size();
486488
for (size_t i =0; i <this->partial_parsed.size(); i += parse_buffer_size) {
487489
auto range =parse_chunk_encoding(boost::make_iterator_range(
488-
static_cast<
489-
typename chunk_encoding_parser_type::const_iterator>(this->partial_parsed.data()) + i,
490-
static_cast<
491-
typename chunk_encoding_parser_type::const_iterator>(this->partial_parsed.data()) +
490+
this->partial_parsed.cbegin() + i,
491+
this->partial_parsed.cbegin() +
492492
std::min(i + parse_buffer_size,this->partial_parsed.size())));
493493
body_string.append(boost::begin(range),boost::end(range));
494494
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp