首页 > 解决方案 > 无法使用 boost::bimap 编译

问题描述

我很难把它变成boost::bimap. 它不会编译:

我改变:

using MapStudentItemDesc = std::map<UINT, CString>;

using MapStudentItemDesc = boost::bimap<UINT, CString>;

然后我像这样声明地图:

MapStudentItemDesc mapStudentItemDescBefore;

我填写它,例如:

rMapStudentItems.insert({IDS_CMB_METHOD_BIBLE_READING, SMMETHOD3(eLanguage, IDS_CMB_METHOD_BIBLE_READING)});

我希望能够轻松地查找右侧的值,从而获得左侧的关联键。

我得到如下编译错误:

D:\My Libraries\Boost\boost_1_71_0\boost\bimap\detail\bimap_core.hpp(408,1): error C4996: 'std::allocator<void>::rebind<boost::bimaps::relation::mutant_relation<boost::bimaps::tags::tagged<const unsigned int,boost::bimaps::relation::member_at::left>,boost::bimaps::tags::tagged<const ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>>,boost::bimaps::relation::member_at::right>,boost::bimaps::detail::manage_additional_parameters<AP1,AP2,AP3>::case_NNN::additional_info,true>>': warning STL4010: Various members of std::allocator are deprecated in C++17. Use std::allocator_traits instead of accessing these members directly. You can define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
5>        with
5>        [
5>            AP1=boost::mpl::na,
5>            AP2=boost::mpl::na,
5>            AP3=boost::mpl::na
5>        ]
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\xmemory(852,1): message : see declaration of 'std::allocator<void>::rebind'
5>D:\My Libraries\Boost\boost_1_71_0\boost\bimap\bimap.hpp(134): message : see reference to class template instantiation 'boost::bimaps::detail::bimap_core<KeyTypeA,KeyTypeB,AP1,AP2,AP3>' being compiled
5>        with
5>        [
5>            KeyTypeA=UINT,
5>            KeyTypeB=CString,
5>            AP1=boost::mpl::na,
5>            AP2=boost::mpl::na,
5>            AP3=boost::mpl::na
5>        ]
5>D:\My Programs\2019\MeetSchedAssist\Meeting Schedule Assistant\ChristianLifeMinistryEditorDlg.cpp(7300): message : see reference to class template instantiation 'boost::bimaps::bimap<UINT,CString,boost::mpl::na,boost::mpl::na,boost::mpl::na>' being compiled
5>D:\My Libraries\Boost\boost_1_71_0\boost\bimap\detail\bimap_core.hpp(407,9): error C4996: 'std::allocator<void>::rebind<boost::bimaps::relation::mutant_relation<boost::bimaps::tags::tagged<const unsigned int,boost::bimaps::relation::member_at::left>,boost::bimaps::tags::tagged<const ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>>,boost::bimaps::relation::member_at::right>,boost::bimaps::detail::manage_additional_parameters<AP1,AP2,AP3>::case_NNN::additional_info,true>>::other': warning STL4010: Various members of std::allocator are deprecated in C++17. Use std::allocator_traits instead of accessing these members directly. You can define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
5>        with
5>        [
5>            AP1=boost::mpl::na,
5>            AP2=boost::mpl::na,
5>            AP3=boost::mpl::na
5>        ]
5>ChristianLifeMinistryEditorSettingsDlg.cpp

标签: boostboost-bimap

解决方案


推荐阅读