I am attempting to compile a project which was originally using tr1/unordered_map. I have removed all the references to the tr1 namespace and am now just using unordered_map (eg #include <tr1/unordered_map>
becomes #include <unordered_map>
). However, I am getting a compilation error. Upon configuration:
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
When I attempt to compile the project I am faced with the error:
/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
is defined as:
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;
I was able to find a bug report to Apache OpenOffice for a similar problem ( https://issues.apache.org/ooo/show_bug.cgi?id=124422 ) but have been unable to use this to solve my issue. If anyone has any ideas I would be most appreciative.
您在分配器中缺少一个讨厌的const
(第二个):
CXXR::Allocator<std::pair<const Symbol* const, Frame::Binding*> >
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.