我试图让boost::string_ref
工作,我想,但我面临一个问题,现在 - 下面的代码无法编译:如何比较的boost :: string_ref到的std :: string
#include <boost/utility/string_ref.hpp>
#include <iostream>
#include <string>
using namespace std;
int main() {
string test = "test";
boost::string_ref rtest(test);
cout << (rtest == "test")<<endl;
}
与海合会抛出30KB错误日志,从
source.cpp: In function 'int main()':
source.cpp:10:19: error: no match for 'operator==' (operand types are 'boost::string_ref {aka boost::basic_string_ref<char, std::char_traits<char> >}' and 'const char [5]')
cout << (rtest == "test")<<endl;
^
如何比较boost::string_ref
到std::string
?
你可以包含日志到第一个完整的'error'行吗? –
@DrewDormann http://liveworkspace.org/code/2dWWjs$0 – mfontanini