boostorg / boostorg/algorithm

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

Aberta
#87 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
C++
Estrelas
131
Forks
117
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

[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);

}
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

Comece reproduzindo a chamada fornecida a boost::find_all_regex com std::vector> e compare-a com o caso de std::vector. Leia a documentação vinculada de find_all_regex e a implementação da função; considera-se concluído quando a incompatibilidade documentada do contêiner for resolvida ou a documentação for claramente corrigida, com o exemplo relatado coberto caso haja testes disponíveis.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
cpp
Domínio
tooling
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.