我试图在 C++ 中以最快的方式拆分字符串。我在这里收到一个错误:
#include <bitset>
#include <iostream>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/timer.hpp>
using namespace std;
size_t const N = 10000000;
template<typename C>
void test_strpbrk(string const& s, char const* delims, C& ret)
{
C output;
char const* p = s.c_str();
char const* q = strpbrk(p + 1, delims);
for (; q != NULL; q = strpbrk(p, delims))
{
output.push_back(typename C::value_type(p, q));
p = q + 1;
}
output.swap(ret);
}
int main()
{
typedef string::const_iterator iter;
typedef boost::iterator_range<iter> string_view;
vector<string_view> vsv;
test_custom(text, delims, vsv);
}
Visual Studio 说:cannot convert from 'const char *' to 'const std::_String_const_iterator<std::_String_val<std::_Simple_types<char>>>'
你能帮我吗,我应该在visual studio中启用任何选项来让它工作吗?