boostorg / boostorg/algorithm

algorithm/string -- find_all_regex() gives a compiler error when the result container is vector<iterator_range<string::iterator>>

オープン
#87 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
131
フォーク
117
PR マージ指標
30日以内にマージされた PR はありません

説明

[The doc](https://www.boost.org/doc/libs/1_77_0/doc/html/boost/algorithm/find_all_regex.html) says that the container we should pass to this function can be std::vector>. But when I run the program it gives a compile error. But when the result container passed, is a std::vector, everything works fine.

First code snippet is using std::vector> as the result.
```
#include "boost/algorithm/string/split.hpp"
#include "boost/range/iterator_range_core.hpp"
#include
#include
#include
#include

int main(int, char**) {

std::string s("Hello world");
boost::regex regex("\\w");

std::vector> result;
boost::find_all_regex(result, s, regex);

}
```

Following is the last 3 lines of the compiler error. The whole error is too long.

c:\mingw\include\c++\9.2.0\bits\stl_iterator.h:787:11: note: no known conversion for argument 1 from '__gnu_cxx::__normal_iterator >' to 'const __gnu_cxx::__normal_iterator >&'

c:\mingw\include\c++\9.2.0\bits\stl_iterator.h:787:11: note: candidate: 'constexpr __gnu_cxx::__normal_iterator >::__normal_iterator(__gnu_cxx::__normal_iterator >&&)'

c:\mingw\include\c++\9.2.0\bits\stl_iterator.h:787:11: note: no known conversion for argument 1 from '__gnu_cxx::__normal_iterator >' to '__gnu_cxx::__normal_iterator >&&'

Also I ran the same program in Clang compiler too. Still the same result.

But when I run the following program with the container as std::vector everything works without a hitch.

```
#include "boost/algorithm/string/split.hpp"
#include "boost/range/iterator_range_core.hpp"
#include
#include
#include
#include
#include

int main(int, char**) {

std::string s("Hello world");
boost::regex regex("\\w");

std::vector result;
boost::find_all_regex(result, s, regex);

}
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、std::vector> を使用した、提供されている boost::find_all_regex の呼び出しを再現し、std::vector の場合と比較します。リンクされている find_all_regex のドキュメントと関数の実装を読みます。完了の条件は、文書化されているコンテナの不一致を解消するか、ドキュメントを明確に修正し、テストが利用可能な場合は報告された例をカバーすることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。