我想要使用boost数组
但是我收到了这个错误:
错误:'array':模糊符号
这是我的代码:
#include <iostream>
#include <boost/array.hpp>
#include <boost/regex.hpp>
using namespace boost;
using namespace std;
int main(int argc, char* argv[])
{
array<int, 10> a{3};
cout << "a[0]= " << a[0];
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当我包含boost库时会出现此错误
任何的想法 ?
我正在尝试使用工作代码来替换行的文本.使用boost_1_64_0.
getline (ifs, line);
cout << line << endl;
// 1.
boost::replace_all(line, "abc", "hij");
boost::replace_all(line, "def", "klm");
// 2.
line = boost::replace_all_copy
boost::replace_all_copy<string>
(
("abc def abc def", "abc", "hij")
, "def"
, "klm"
);
Run Code Online (Sandbox Code Playgroud)
我收到这些错误:
main.cpp||In function 'int main()':|
main.cpp|37|error: no match for 'operator=' in 'line = boost::algorithm::replace_all_copy'|
main.cpp|37|note: candidates are:|
\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.h|543|note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc> = std::basic_string<char>]|
mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.h|543|note: no known …Run Code Online (Sandbox Code Playgroud) 我有一个普通的指针char *,如何转换char *为boost::shared_ptr?
char *str = "abcdfg";
boost::shared_ptr<char> ss = ?(str);
Run Code Online (Sandbox Code Playgroud) 我试图用rhapsody定义一个指向我结构的智能指针,我已经包含了头文件"memory".但我有上面的错误
typedef std::shared_ptr<my_structure> %s;
Run Code Online (Sandbox Code Playgroud)