在OS X 10.9.3的Xcode 5.1.1下,unordered_map编译失败
Compiling with unordered_map fails with Xcode 5.1.1 on OS X 10.9.3
我正在尝试编译一个最初使用tr1/unordered_map的项目。我已经删除了对tr1命名空间的所有引用,现在只是使用unordered_map(例如#include <tr1/unordered_map>
变成#include <unordered_map>
)。然而,我得到一个编译错误。在配置:
CXXR is now configured for x86_64-apple-darwin13.2.0
Source directory: .
Installation directory: /Library/Frameworks
C compiler: gcc -g -O2 -fexceptions
Fortran 77 compiler: gfortran -g -O2
C++ compiler: g++ -g -O2 -Wno-attributes -std=c++11
Fortran 90/95 compiler: gfortran -g -O2
Obj-C compiler: gcc -g -O2 -fobjc-exceptions
Interfaces supported: X11, aqua, tcltk
External libraries: readline, ICU
Additional capabilities: PNG, JPEG, TIFF, NLS
CR Options enabled: framework, shared BLAS, R profiling
CXXR Options enabled:
Recommended packages: yes
当我尝试编译项目时,我遇到了错误:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/unordered_map:724:5: error: static_assert failed "Invalid allocator::value_type"
static_assert((is_same<value_type, typename allocator_type::value_type>::value),
Environment.cpp:104:5: note: in instantiation of template class 'std::__1::unordered_map<const CXXR::Symbol *, CXXR::Frame::Binding *, std::__1::hash<const CXXR::Symbol *>,
std::__1::equal_to<const CXXR::Symbol *>, CXXR::Allocator<std::__1::pair<const CXXR::Symbol *, CXXR::Frame::Binding *> > >' requested here
delete s_search_path_cache;
s_search_path_cache
定义为:
typedef
std::unordered_map<const Symbol*, Frame::Binding*,
std::hash<const Symbol*>,
std::equal_to<const Symbol*>,
CXXR::Allocator<std::pair<const Symbol*, Frame::Binding*> >
> Cache;
static Cache* s_search_path_cache;
我能够找到一个bug报告给Apache OpenOffice类似的问题(https://issues.apache.org/ooo/show_bug.cgi?id=124422),但一直无法使用它来解决我的问题。如果有人有什么建议,我将不胜感激。
您的分配器中缺少一个讨厌的const
(第二个):
CXXR::Allocator<std::pair<const Symbol* const, Frame::Binding*> >
相关文章:
- 尝试通过多个向量访问变量时,向量下标超出范围
- 在没有太多条件句的情况下,我如何避免被零除
- 为什么在没有显式默认构造函数的情况下,将另一个结构封装在联合中作为成员的结构不能编译
- 在VS2010-VS2015下编译时,如何使用decltype作为较大类型表达式的LHS
- 在指针的帮助下,文本文件中单词的频率
- 在未初始化映射的情况下,将值插入到映射的映射中
- 为什么在保护模式下继承升级不起作用
- 是默认情况下分配给char数组常量的值
- 为什么我不能在不创建字符串变量的情况下使用函数的字符串输出
- 如何在全屏模式下(在OpenGL中)使背景透明
- 如何在不产生任何垃圾的情况下获得C中的像素
- 在已经使用Git的情况下减少编译时间
- 为什么在Windows上的VS 2019和Clang 9中"size_t"在没有标题的情况下工作
- 如何在没有信号的情况下从C++执行QML插槽
- 为什么使用__LINE_的代码在发布模式下在MSVC下编译,而不是在调试模式下
- 如何在不知道向量大小的情况下输入向量内部的向量?
- 为什么在某些情况下不写入此文件?
- VSCode-有一个红色下划线,但程序构建和运行正确,并且出现配音错误
- 为什么Mat类的两个对象可以在不重载运算符+的情况下添加
- MacOS通过在莫哈韦"wchar.h"下破碎的自制啤酒发出叮当声