boostorg / boostorg/algorithm

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

Ouverte
#87 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
C++
Étoiles
131
Forks
117
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

}
```

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par reproduire l'appel fourni à boost::find_all_regex avec std::vector> et comparez-le au cas std::vector. Lisez la documentation liée de find_all_regex ainsi que l'implémentation de la fonction ; le travail est terminé lorsque l'incompatibilité de conteneur documentée est résolue ou que la documentation est clairement corrigée, avec l'exemple signalé couvert si des tests sont disponibles.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
cpp
Domaine
tooling
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.