标签: boost

错误:'array':模糊符号

我想要使​​用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库时会出现此错误

任何的想法 ?

c++ boost

-3
推荐指数
1
解决办法
1695
查看次数

为什么boost :: replace_all_copy不起作用?C++

我正在尝试使用工作代码来替换行的文本.使用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)

c++ boost

-3
推荐指数
1
解决办法
183
查看次数

如何将char*转换为boost :: shared_ptr?

我有一个普通的指针char *,如何转换char *boost::shared_ptr

char *str = "abcdfg";
boost::shared_ptr<char> ss = ?(str);
Run Code Online (Sandbox Code Playgroud)

c++ boost

-7
推荐指数
1
解决办法
586
查看次数

c ++,错误:命名空间'std'中的'shared_ptr'没有命名模板类型

我试图用rhapsody定义一个指向我结构的智能指针,我已经包含了头文件"memory".但我有上面的错误

 typedef std::shared_ptr<my_structure> %s;
Run Code Online (Sandbox Code Playgroud)

c++ boost g++ rhapsody

-7
推荐指数
1
解决办法
3804
查看次数

标签 统计

boost ×4

c++ ×4

g++ ×1

rhapsody ×1