STD ::切换到Boost 1.64时获得冲突
std::get conflict when switching to Boost 1.64
我使用的是gcc 6.2(with -std = c 14)。我有一个大型项目,该项目与Boost 1.62建立,没有任何问题。当我切换到Boost 1.64时,我会收到此错误:
.../include/boost/property_map/property_map.hpp:133:11: error: ‘template<long unsigned int Idx, class T, long unsigned int N> con
st T& std::get(const boost::array<T, N>&)’ conflicts with a previous declaration
using ::get;
^~~
...include//boost/array.hpp:429:13: note: previous declaration ‘template<long unsigned int Idx, class T, long unsigned int N> con
st T& boost::get(const boost::array<T, N>&)’
const T &get(const boost::array<T,N> &arr) BOOST_NOEXCEPT {
^~~
不幸的是,我无法用一个简单的示例来重现问题(不确定问题可能是什么,我制作了一个空的main(),其中包括 property_map.hpp
和 array.hpp
,并且可以很好地构建),所以我正在寻找一个朝正确的方向轻推:)。
确保寻找导入单个功能的语句:
using std::get;
而不仅仅是导入包含get()的全名空间:
using namespace std;
这是因为boost在array.hpp vesion 1.64中介绍了该模板函数,array.hpp vesion 1.62
not.hpp vesion 1.64(这就是为什么您之前没有出现此编译器错误)
template<typename T, std::size_t N, std::size_t Idx>
T boost::get(const array<T, N>&);
无论如何,问题是因为您在代码中的某个地方将命名空间(std
与boost
)混合在一起。请参阅std :: get
在标题中摆脱using namespace std;
和using namespace boost;
。
相关文章:
- 写入位置0x0000000C时发生访问冲突
- 将应用程序从32位移植到64位时出现问题
- C++尝试深度复制唯一指针时出现内存访问冲突
- 如何在多个线程中创建 QSql数据库连接时防止名称冲突
- 插入数组时违反写访问冲突
- 尝试通过共享指针使用变量时读取访问冲突
- 为什么构造函数 Message(const T&data) 与 Message(T&& data) 冲突,当 T = int&时?
- 读取缓冲区时访问冲突 UNICODE_STRING
- Python C API:使用 MSVC 尝试示例模块时的访问冲突
- 从二进制文件中读取元素时引发异常(引发异常:读取访问冲突. _Pnext 0xB414D4)
- 当 Type = bool 时,运算符 bool() 与模板 Type() 运算符冲突
- 使用 EvtSetChannelConfigProperty() 函数时出现访问冲突错误
- 从 uint32_t 转换为 wchar_t 并存储在 wstring 中时出现访问冲突
- 使用 Win32 读取文件时,glShaderSource 访问冲突
- 将代码从 32 位迁移到 64 位时出现问题 Visual Studio 2010
- 0xC0000005:读取位置0xCDCDCDC1时发生访问冲突
- 当n在C 中超过64时,如何计算POW(2,N)
- STD ::切换到Boost 1.64时获得冲突
- 在64-Win 7的32位JVM中使用c++读取JVM - bytebuffer时发生访问冲突
- c++:不同链接库中定义的相同函数的运行时冲突