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 個 reaction 已指派 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 摘要。