algorithm/string -- find_all_regex() gives a compiler error when the result container is vector<iterator_range<string::iterator>>
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lệnh gọi được cung cấp tới boost::find_all_regex với std::vector<boost::iterator_rangestd::string::iterator> và so sánh với trường hợp std::vectorstd::string. Đọc tài liệu find_all_regex được liên kết và phần triển khai của hàm; công việc được xem là hoàn tất khi giải quyết được sự không khớp container đã được ghi lại trong tài liệu hoặc sửa rõ ràng tài liệu, đồng thời bao phủ ví dụ được báo cáo nếu có các bài kiểm thử.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The doc says that the container we should pass to this function can be std::vector<boost::iterator_rangestd::string::iterator>. But when I run the program it gives a compile error. But when the result container passed, is a std::vectorstd::string, everything works fine.
First code snippet is using std::vector<boost::iterator_rangestd::string::iterator> as the result.
#include "boost/algorithm/string/split.hpp"
#include "boost/range/iterator_range_core.hpp"
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/regex.hpp>
#include <vector>
int main(int, char**) {
std::string s("Hello world");
boost::regex regex("\\w");
std::vector<boost::iterator_range<std::string::iterator>> 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<const char*, std::__cxx11::basic_string >' to 'const __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string >&'
c:\mingw\include\c++\9.2.0\bits\stl_iterator.h:787:11: note: candidate: 'constexpr __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string >::__normal_iterator(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string >&&)'
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<const char*, std::__cxx11::basic_string >' to '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string >&&'
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::vectorstd::string everything works without a hitch.
#include "boost/algorithm/string/split.hpp"
#include "boost/range/iterator_range_core.hpp"
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/regex.hpp>
#include <string>
#include <vector>
int main(int, char**) {
std::string s("Hello world");
boost::regex regex("\\w");
std::vector<std::string> result;
boost::find_all_regex(result, s, regex);
}
- Ngôn ngữ chính
- C++
- Star
- 131
- Fork
- 117
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của boostorg/algorithm
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
-
variadic min/max/minmax Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
fast variadic string-concat Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Automated formatting Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Tất cả issue của boostorg/algorithm
Issue tương tự
-
AuTest Bug Tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/trafficserver#13714 ·
-
bug build
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
facebookincubator/velox#19143 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
tenstorrent/tt-metal#57393 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
objectionary/eo-graphs#74 ·