gnustl (libstdc++) 到 llvm (libc++) 错误

gnustl (libstdc++) to llvm (libc++ ) errors

我从 gnustl 迁移到 libc++ 后开始遇到这些错误。我在互联网上找不到任何关于此的内容。并且没有更多信息。 我将继续对此进行调查,随着调查的进行,我将根据我的发现更新此主题。

f:/nugetcache\androidndk.16.1.9\sources\cxx-stl\llvm-libc++\include\__tree(1819,22) :  error: the specified comparator type does not provide a const call operator [-Werror,-Wuser-defined-warnings]
                     __trigger_diagnostics()), "");
                     ^
f:/nugetcache\androidndk.16.1.9\sources\cxx-stl\llvm-libc++\include\set(400,28) :  note: in instantiation of member function 'std::__ndk1::__tree<IRichValue::Type, IRichValueUtil::TypeComparer, HeapAllocator<IRichValue::Type> >::~__tree' requested here
class _LIBCPP_TEMPLATE_VIS set
                           ^
f:/nugetcache\androidndk.16.1.9\sources\cxx-stl\llvm-libc++\include\memory(1550,14) :  note: in instantiation of function template specialization 'std::__ndk1::allocator_traits<HeapAllocator<std::__ndk1::__tree_node<std::__ndk1::__value_type<RichValueTypeReservedKeyInfoManager *, Set<IRichValue::Type, IRichValueUtil::TypeComparer, HeapAllocator<IRichValue::Type> > >, void *> > >::__destroy<std::__ndk1::pair<RichValueTypeReservedKeyInfoManager *const, Set<IRichValue::Type, IRichValueUtil::TypeComparer, HeapAllocator<IRichValue::Type> > > >' requested here
            {__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);}
             ^
f:/nugetcache\androidndk.16.1.9\sources\cxx-stl\llvm-libc++\include\__tree(1833,24) :  note: in instantiation of function template specialization 'std::__ndk1::allocator_traits<HeapAllocator<std::__ndk1::__tree_node<std::__ndk1::__value_type<RichValueTypeReservedKeyInfoManager *, Set<IRichValue::Type, IRichValueUtil::TypeComparer, HeapAllocator<IRichValue::Type> > >, void *> > >::destroy<std::__ndk1::pair<RichValueTypeReservedKeyInfoManager *const, Set<IRichValue::Type, IRichValueUtil::TypeComparer, HeapAllocator<IRichValue::Type> > > >' requested here
        __node_traits::destroy(__na, _NodeTypes::__get_ptr(__nd->__value_));
                       ^
f:/nugetcache\androidndk.16.1.9\sources\cxx-stl\llvm-libc++\include\__tree(1821,3) :  note: in instantiation of member function 'std::__ndk1::__tree<std::__ndk1::__value_type<RichValueTypeReservedKeyInfoManager *, Set<IRichValue::Type, IRichValueUtil::TypeComparer, HeapAllocator<IRichValue::Type> > >, std::__ndk1::__map_value_compare<RichValueTypeReservedKeyInfoManager *, std::__ndk1::__value_type<RichValueTypeReservedKeyInfoManager *, Set<IRichValue::Type, IRichValueUtil::TypeComparer, HeapAllocator<IRichValue::Type> > >, std::__ndk1::less<RichValueTypeReservedKeyInfoManager *>, true>, HeapAllocator<std::__ndk1::__value_type<RichValueTypeReservedKeyInfoManager *, Set<IRichValue::Type, IRichValueUtil::TypeComparer, HeapAllocator<IRichValue::Type> > > > >::destroy' requested here
  destroy(__root());
  ^
f:/nugetcache\androidndk.16.1.9\sources\cxx-stl\llvm-libc++\include\map(805,28) :  note: in instantiation of member function 'std::__ndk1::__tree<std::__ndk1::__value_type<RichValueTypeReservedKeyInfoManager *, Set<IRichValue::Type, IRichValueUtil::TypeComparer, HeapAllocator<IRichValue::Type> > >, std::__ndk1::__map_value_compare<RichValueTypeReservedKeyInfoManager *, std::__ndk1::__value_type<RichValueTypeReservedKeyInfoManager *, Set<IRichValue::Type, IRichValueUtil::TypeComparer, HeapAllocator<IRichValue::Type> > >, std::__ndk1::less<RichValueTypeReservedKeyInfoManager *>, true>, HeapAllocator<std::__ndk1::__value_type<RichValueTypeReservedKeyInfoManager *, Set<IRichValue::Type, IRichValueUtil::TypeComparer, HeapAllocator<IRichValue::Type> > > > >::~__tree' requested here
class _LIBCPP_TEMPLATE_VIS map
                           ^
f:/nugetcache\androidndk.16.1.9\sources\cxx-stl\llvm-libc++\include\__tree(970,7) :  note: from 'diagnose_if' attribute on '__trigger_diagnostics':
      _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
      ^                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
f:/nugetcache\androidndk.16.1.9\sources\cxx-stl\llvm-libc++\include\__config(1101,20) :  note: expanded from macro '_LIBCPP_DIAGNOSE_WARNING'
    __attribute__((diagnose_if(__VA_ARGS__, "warning")))
                   ^           ~~~~~~~~~~~
1 error generated.
Exit code: 1

这告诉您您正在将比较对象传递给具有非常量 operator () 的集合或映射。

您可以修复比较运算符或关闭 -Werror(这将使它成为警告而不是错误)

如果我是你,我会看一看std::__ndk1::less