boostorg / bimap Goto Github PK
View Code? Open in Web Editor NEWBoost.org bimap module
Home Page: http://boost.org/libs/bimap
Boost.org bimap module
Home Page: http://boost.org/libs/bimap
A number of things have been removed from std::allocator, which breaks bimap.
Thanks for your support for bimap.
I've request to using boost::container::flat_set instead of using std::set for the memory usage.
So, how can I achieve it?
Thanks.
The current implementation is not allow to use transparent comparator/hash operator functionality.
boost::bimap<int, boost::bimaps::set_of<const char*, std::less<>>> test;
std::string stg;
test.right.find(stg); // error
The compile error message is the following:
/opt/compiler-explorer/libs/boost_1_80_0/boost/bimap/container_adaptor/associative_container_adaptor.hpp:194:17: error: no matching function for call to object of type 'boost::bimaps::container_adaptor::detail::key_to_base_identity<const char *, const char *const>'
this->template functor<key_to_base>()(k)
There is a macro call
BOOST_BIMAP_GENERATE_INDEX_BINDER_1CP(
// binds to
multi_index::ordered_unique,
// with
key_compare
)
in the file boost/bimap/set_of.hpp. There is nothing wrong with that. However, if you run this in preprocess only mode for Visual Studio (which we need as input for our code checkers), it will end up in incorrect code:
// binds to// withtemplate< class KeyExtractor, class Tag > struct index_bind { typedef multi_index::ordered_unique < multi_index::tag< Tag >, KeyExtractor, key_compare > type; };
I know that this is a bug in Visual Studio, but it help if you can change it into
BOOST_BIMAP_GENERATE_INDEX_BINDER_1CP(
/* binds to */
multi_index::ordered_unique,
/* with */
key_compare
)
i.e. changing // comments into /* .. */ comments twice. Many thanks for your help.
For my own reference this is TiCS ticket 21934.
On my Windows 10, with MS Visual Studio 2017 and MinGW with GCC 7.2 I have installed Boost following steps on https://github.com/boostorg/boost/wiki/Getting-Started:
git clone --recursive https://github.com/boostorg/boost.git
cd boost
git checkout develop
.\bootstrap
.\b2 headers
Then I have added b2
to my PATH
and done this:
cd libs\bimap\test
b2 # for MSVC
b2 toolset=gcc # for GCC
Sadly in both cases some tests failed. Different tests with both cases. Below console outputs are from a second run of b2
to take out staff that is OK:
C:\Boost\boost\libs\bimap\test>b2
..\..\..\libs\log\build\Jamfile.v2:45: Unescaped special character in argument <define>$(flag)=1
C:/Boost/boost/libs/predef/check/../tools/check\predef.jam:46: Unescaped special character in argument $(language)::$(expression)
Performing configuration checks
- default address-model : 32-bit (cached)
- default architecture : x86 (cached)
- symlinks supported : yes (cached)
...patience...
...patience...
...patience...
...found 5709 targets...
...updating 3 targets...
msvc.write-setup-script ..\..\..\bin.v2\standalone\msvc\msvc-14.1\msvc-setup.bat
testing.capture-output ..\..\..\bin.v2\libs\bimap\test\test_bimap_unordered.test\msvc-14.1\debug\threading-multi\test_bimap_unordered.run
====== BEGIN OUTPUT ======
C:\Boost\boost\libs/bimap/test/test_bimap.hpp(417): test const_c.bucket_size(const_c.bucket(di->first)) == 1 failed in function: 'void __cdecl test_pair_unordered_associative_container<class boost::bimaps::views::unordered_multimap_view<struct boost::bimaps::relation::member_at::right,class boost::bimaps::detail::bimap_core<struct boost::bimaps::unordered_set_of<char,struct boost::hash<char>,struct std::equal_to<char> >,struct boost::bimaps::unordered_multiset_of<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na> >,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,char> > >>(class boost::bimaps::views::unordered_multimap_view<struct boost::bimaps::relation::member_at::right,class boost::bimaps::detail::bimap_core<struct boost::bimaps::unordered_set_of<char,struct boost::hash<char>,struct std::equal_to<char> >,struct boost::bimaps::unordered_multiset_of<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na> > &,const class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,char> > > &)'
C:\Boost\boost\libs/bimap/test/test_bimap.hpp(417): test const_c.bucket_size(const_c.bucket(di->first)) == 1 failed in function: 'void __cdecl test_pair_unordered_associative_container<class boost::bimaps::views::unordered_multimap_view<struct boost::bimaps::relation::member_at::right,class boost::bimaps::detail::bimap_core<struct boost::bimaps::unordered_set_of<char,struct boost::hash<char>,struct std::equal_to<char> >,struct boost::bimaps::unordered_multiset_of<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na> >,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,char> > >>(class boost::bimaps::views::unordered_multimap_view<struct boost::bimaps::relation::member_at::right,class boost::bimaps::detail::bimap_core<struct boost::bimaps::unordered_set_of<char,struct boost::hash<char>,struct std::equal_to<char> >,struct boost::bimaps::unordered_multiset_of<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na> > &,const class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,char> > > &)'
C:\Boost\boost\libs/bimap/test/test_bimap.hpp(417): test const_c.bucket_size(const_c.bucket(di->first)) == 1 failed in function: 'void __cdecl test_pair_unordered_associative_container<class boost::bimaps::views::unordered_multimap_view<struct boost::bimaps::relation::member_at::right,class boost::bimaps::detail::bimap_core<struct boost::bimaps::unordered_set_of<char,struct boost::hash<char>,struct std::equal_to<char> >,struct boost::bimaps::unordered_multiset_of<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na> >,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,char> > >>(class boost::bimaps::views::unordered_multimap_view<struct boost::bimaps::relation::member_at::right,class boost::bimaps::detail::bimap_core<struct boost::bimaps::unordered_set_of<char,struct boost::hash<char>,struct std::equal_to<char> >,struct boost::bimaps::unordered_multiset_of<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na> > &,const class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,char> > > &)'
C:\Boost\boost\libs/bimap/test/test_bimap.hpp(417): test const_c.bucket_size(const_c.bucket(di->first)) == 1 failed in function: 'void __cdecl test_pair_unordered_associative_container<class boost::bimaps::views::unordered_multimap_view<struct right_tag,class boost::bimaps::detail::bimap_core<struct boost::bimaps::unordered_set_of<struct boost::bimaps::tags::tagged<char,struct left_tag>,struct boost::hash<char>,struct std::equal_to<char> >,struct boost::bimaps::unordered_multiset_of<struct boost::bimaps::tags::tagged<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct right_tag>,struct boost::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na> >,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,char> > >>(class boost::bimaps::views::unordered_multimap_view<struct right_tag,class boost::bimaps::detail::bimap_core<struct boost::bimaps::unordered_set_of<struct boost::bimaps::tags::tagged<char,struct left_tag>,struct boost::hash<char>,struct std::equal_to<char> >,struct boost::bimaps::unordered_multiset_of<struct boost::bimaps::tags::tagged<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct right_tag>,struct boost::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na> > &,const class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,char> > > &)'
C:\Boost\boost\libs/bimap/test/test_bimap.hpp(417): test const_c.bucket_size(const_c.bucket(di->first)) == 1 failed in function: 'void __cdecl test_pair_unordered_associative_container<class boost::bimaps::views::unordered_multimap_view<struct right_tag,class boost::bimaps::detail::bimap_core<struct boost::bimaps::unordered_set_of<struct boost::bimaps::tags::tagged<char,struct left_tag>,struct boost::hash<char>,struct std::equal_to<char> >,struct boost::bimaps::unordered_multiset_of<struct boost::bimaps::tags::tagged<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct right_tag>,struct boost::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na> >,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,char> > >>(class boost::bimaps::views::unordered_multimap_view<struct right_tag,class boost::bimaps::detail::bimap_core<struct boost::bimaps::unordered_set_of<struct boost::bimaps::tags::tagged<char,struct left_tag>,struct boost::hash<char>,struct std::equal_to<char> >,struct boost::bimaps::unordered_multiset_of<struct boost::bimaps::tags::tagged<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct right_tag>,struct boost::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na> > &,const class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,char> > > &)'
C:\Boost\boost\libs/bimap/test/test_bimap.hpp(417): test const_c.bucket_size(const_c.bucket(di->first)) == 1 failed in function: 'void __cdecl test_pair_unordered_associative_container<class boost::bimaps::views::unordered_multimap_view<struct right_tag,class boost::bimaps::detail::bimap_core<struct boost::bimaps::unordered_set_of<struct boost::bimaps::tags::tagged<char,struct left_tag>,struct boost::hash<char>,struct std::equal_to<char> >,struct boost::bimaps::unordered_multiset_of<struct boost::bimaps::tags::tagged<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct right_tag>,struct boost::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na> >,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,char> > >>(class boost::bimaps::views::unordered_multimap_view<struct right_tag,class boost::bimaps::detail::bimap_core<struct boost::bimaps::unordered_set_of<struct boost::bimaps::tags::tagged<char,struct left_tag>,struct boost::hash<char>,struct std::equal_to<char> >,struct boost::bimaps::unordered_multiset_of<struct boost::bimaps::tags::tagged<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct right_tag>,struct boost::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na> > &,const class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,char> > > &)'
**** 6 errors detected
EXIT STATUS: 201
====== END OUTPUT ======
set status=0
if %status% NEQ 0 (
echo Skipping test execution due to testing.execute=off
exit 0
)
"..\..\..\bin.v2\libs\bimap\test\test_bimap_unordered.test\msvc-14.1\debug\threading-multi\test_bimap_unordered.exe" > "..\..\..\bin.v2\libs\bimap\test\test_bimap_unordered.test\msvc-14.1\debug\threading-multi\test_bimap_unordered.output" 2>&1
set status=%ERRORLEVEL%
echo. >> "..\..\..\bin.v2\libs\bimap\test\test_bimap_unordered.test\msvc-14.1\debug\threading-multi\test_bimap_unordered.output"
echo EXIT STATUS: %status% >> "..\..\..\bin.v2\libs\bimap\test\test_bimap_unordered.test\msvc-14.1\debug\threading-multi\test_bimap_unordered.output"
if %status% EQU 0 (
copy "..\..\..\bin.v2\libs\bimap\test\test_bimap_unordered.test\msvc-14.1\debug\threading-multi\test_bimap_unordered.output" "..\..\..\bin.v2\libs\bimap\test\test_bimap_unordered.test\msvc-14.1\debug\threading-multi\test_bimap_unordered.run"
)
set verbose=0
if %status% NEQ 0 (
set verbose=1
)
if %verbose% EQU 1 (
echo ====== BEGIN OUTPUT ======
type "..\..\..\bin.v2\libs\bimap\test\test_bimap_unordered.test\msvc-14.1\debug\threading-multi\test_bimap_unordered.output"
echo ====== END OUTPUT ======
)
exit %status%
...failed testing.capture-output ..\..\..\bin.v2\libs\bimap\test\test_bimap_unordered.test\msvc-14.1\debug\threading-multi\test_bimap_unordered.run...
...failed updating 1 target...
...skipped 1 target...
...updated 2 targets...
The same with GCC:
C:\Boost\boost\libs\bimap\test>b2 toolset=gcc
..\..\..\libs\log\build\Jamfile.v2:45: Unescaped special character in argument <define>$(flag)=1
C:/Boost/boost/libs/predef/check/../tools/check\predef.jam:46: Unescaped special character in argument $(language)::$(expression)
Performing configuration checks
- default address-model : 64-bit (cached)
- default architecture : x86 (cached)
- symlinks supported : yes (cached)
...patience...
...patience...
...patience...
...found 5660 targets...
...updating 2 targets...
testing.capture-output ..\..\..\bin.v2\libs\bimap\test\test_bimap_serialization.test\gcc-7.2.0\debug\test_bimap_serialization.run
====== BEGIN OUTPUT ======
..\..\../boost/test/minimal.hpp(136): exception "boost::archive::archive_exception: output stream error" caught in function: 'int main(int, char**)'
**** Testing aborted.
**** 1 error detected
EXIT STATUS: 201
====== END OUTPUT ======
set Path=C:\Boost\boost\bin.v2\libs\serialization\build\gcc-7.2.0\debug;C:\MinGW\bin;C:\MinGW\lib;C:\MinGW\lib32;C:\MinGW\lib64;%Path%
set status=0
if %status% NEQ 0 (
echo Skipping test execution due to testing.execute=off
exit 0
)
"..\..\..\bin.v2\libs\bimap\test\test_bimap_serialization.test\gcc-7.2.0\debug\test_bimap_serialization.exe" > "..\..\..\bin.v2\libs\bimap\test\test_bimap_serialization.test\gcc-7.2.0\debug\test_bimap_serialization.output" 2>&1
set status=%ERRORLEVEL%
echo. >> "..\..\..\bin.v2\libs\bimap\test\test_bimap_serialization.test\gcc-7.2.0\debug\test_bimap_serialization.output"
echo EXIT STATUS: %status% >> "..\..\..\bin.v2\libs\bimap\test\test_bimap_serialization.test\gcc-7.2.0\debug\test_bimap_serialization.output"
if %status% EQU 0 (
copy "..\..\..\bin.v2\libs\bimap\test\test_bimap_serialization.test\gcc-7.2.0\debug\test_bimap_serialization.output" "..\..\..\bin.v2\libs\bimap\test\test_bimap_serialization.test\gcc-7.2.0\debug\test_bimap_serialization.run"
)
set verbose=0
if %status% NEQ 0 (
set verbose=1
)
if %verbose% EQU 1 (
echo ====== BEGIN OUTPUT ======
type "..\..\..\bin.v2\libs\bimap\test\test_bimap_serialization.test\gcc-7.2.0\debug\test_bimap_serialization.output"
echo ====== END OUTPUT ======
)
exit %status%
...failed testing.capture-output ..\..\..\bin.v2\libs\bimap\test\test_bimap_serialization.test\gcc-7.2.0\debug\test_bimap_serialization.run...
...failed updating 1 target...
...skipped 1 target...
Am I doing something wrong? How should I proceed to have the tests running clean (as I expected they should)?
MSVC-like compilers fail to process the older definitions BOOST_BIMAP_MAP_VIEW_BASE_FRIEND
and BOOST_BIMAP_SET_VIEW_BASE_FRIEND
but are forced into them by checks of the BOOST_MSVC
auto-detected define.
Depending on the compiler, Boost defines the above macros to expand into an appropriate form of a friend class declaration. It has to sense the compiler because MSVC did not accept an instance of a template class as a friend "right away".
friend class tplclass<T>;
MSVC needed an additional typedef to make that work.
typedef tplclass<T> tplinstclass;
friend class tplinstclass;
One clang-based static analyzer mimics MSVC in many aspects but does not agree with the Boost work-around. It rejects the above Boost's work-around for MSVC because usage of a typedef
-ed class name is not taking the class
specifier.
include\boost/bimap/views/map_view.hpp:57:5: error: typedef 'friend_map_view_base' cannot be referenced with a class specifier
include\boost/bimap/views/set_view.hpp:56:5: error: typedef 'template_class_friend' cannot be referenced with a class specifier
I therefore suggest limiting the older friend class declaration to the older MSVC versions,
-#if defined(BOOST_MSVC)
+#if defined(BOOST_MSVC) && (_MSC_VER < 1910)
Alternatively, the typedef
-ed name of kind tplinstclass
can be used without the class
specifier, that is, as friend tplinstclass
in the existing BOOST_MSVC branch of the macro definitions. But this may break builds of Boost consumers with older MSVC compilers because those builds are unlikely to be tested with the change.
In Boost 1.70 (and current master, but I don't have the line numbers handy), these lines spawn a warning:
unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier
map_view_iterator.hpp:
87, 138, 174, 215, 252, 293, 329
It seems to me that simply adding a ::boost::iterators::
qualification will fix this issue. See e.g. https://kod.acikkaynak.gov.tr/libreoffice/core/commit/aef6da021da33f099f99ed633814b8771ad4abda which seems to "fix" the warning locally by disabling the warning.
You can try Clang-cl by installing the CLang-cl options in the VS2019 installer, and e.g. running CMake with -T"ClangCL"
, or specifying the compiler manually using -DCMAKE_CXX_COMPILER=path/to/clang-cl.exe
. You can also just use LLVM's version of clang-cl, it seems to be identical. Just make sure you have either VS2017 or VS2019 installed.
We are in the process of making B2 build changes to all of the B2 build files
to support "modular" consumption of the Boost Libraries by users. See this list
post for some details: https://lists.boost.org/Archives/boost/2024/01/255704.php
The process requires making a variety of changes to make each Boost library
independent of the super-project structure. But the changes do not remove the
super-project structure or the comprehensive Boost release. The changes make
solely make it possible, optionally, for users, like package manages, to easily
consume libraries individually.
Generally the changes include:
Some examples of such changes:
We are asking how you would like us to handle the changes. We would prefer if
you allow the owners of the Boost.org GitHub project to make changes to B2
build files, as needed, to accomplish the changes. But understand
that you may want to manage the proposed changes yourself.
We previously sent emails to all known maintainers to fill out a form with their
preference. We are contacting you in this issue as we have not gotten a response
to that email. You can see the ongoing responses for that form and the responses
to these issues here https://github.com/users/grafikrobot/projects/1/views/6
We are now asking if you can reply directly to this issue to indicate your
preference of handling the changes. Please supply a response to this question
and close the issue (so that we can verify you are a maintainer).
How would you like the build changes to be processed?
Also please indicate any special instructions you want us to consider. Or other
information you want us to be aware of.
Thanks you, René
I'm filing this bug, coming from lightspark/lightspark#406, which is due to the BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT
not being defined somewhere along the #include
stack.
The following code compiles just fine, but on aarch64, with -O2, with a recent GCC (at least from version 11 and until the very tip of the master branch), the last assert fails:
#include <cassert>
#include <boost/bimap.hpp>
#include <boost/bimap/unordered_set_of.hpp>
int main()
{
using map_type = boost::bimap<boost::bimaps::set_of<int>,
boost::bimaps::unordered_set_of<int>>;
map_type map;
auto x = map.insert({0, 0}).first;
map.replace_right(x, 42);
auto y = map.find(map_type::value_type{0, 42});
assert(y != map.end());
assert(x == y);
assert(&x->right == &y->right);
assert(y->right != 0);
assert(x->right != 0);
}
With -O2 -fno-strict-aliasing, or with -O1 or -O0, all the asserts pass.
I've filed a bug in GCC (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115767), but I'm afraid this can be a bug in Boost Bimap instead. At least it would be very beneficial to further reduce this code to its absolute minimum, so I'm asking for help the library authors.
Thanks.
Environment:
VS2019+Windows Server 2019
Issue description:
Found \boost\libs\bimap build fails to compile due to errors C3892,C2039 in MSVC, this issue can be reproduced on boostorg/boost@97f075e. Could you please take a look?
Reproduce steps:
1.git clone -c core.autocrlf=true --recursive https://github.com/boostorg/boost.git F:\gitP\boostorg\boost
2.open a VS 2019 x64 command prompt and browse to F:\gitP\boostorg\boost
3..\bootstrap
4..\b2 headers variant=release --build-dir=..\out\amd64rel address-model=64
5..\b2 variant=release --build-dir=..\out\amd64rel address-model=64
6..\b2 -j16 variant=release --build-dir=F:\gitP\boostorg\boost\out\amd64rel libs\bimap\test address-model=64 2>&1
ErrorMessage:
libs\bimap\test\compile_fail\test_bimap_mutable_1.cpp(36): error C3892: 'cbm': you cannot assign to a variable that is const
Line 177: libs\bimap\test\compile_fail\test_bimap_mutable_3.cpp(35): error C3892: 'bm': you cannot assign to a variable that is const
Line 180: libs\bimap\test\compile_fail\test_bimap_mutable_2.cpp(36): error C3892: 'boost::bimaps::container_adaptor::associative_container_adaptor<Base,Iterator,ConstIterator,KeyType,IteratorToBaseConverter,IteratorFromBaseConverter,ValueToBaseConverter,ValueFromBaseConverter,KeyToBaseConverter,boost::mpl::vector1>::find': you cannot assign to a variable that is const
Line 204: libs\bimap\test\compile_fail\test_bimap_info_2.cpp(35): error C2039: 'info': is not a member of 'boost::bimaps::relation::mutant_relation<TA,TB,Info,false>'
Line 230: .\boost/bimap/views/map_view.hpp(108): error C2039: 'info': is not a member of 'boost::bimaps::relation::structured_pair<TA,TB,Info,boost::bimaps::relation::normal_layout>'
Line 266: libs\bimap\test\compile_fail\test_bimap_info_1.cpp(36): error C3892: 'cbm': you cannot assign to a variable that is const
Line 313: ...failed testing.capture-outputF:\gitP\boostorg\boost\out\amd64rel\boost\bin.v2\libs\bimap\test\test_bimap_unordered.test\msvc-14.2\release\threading-multi\test_bimap_unordered.run...
log
test.log.16.txt
`
simply #include <boost/bimap.hpp> crashes the Visual Studio 2019 compiler.
crash occurs when stdafx.h includes boost/bimap.hpp
boost_1_75_0
C/C++ project properties:
Disable language extensions: no
Conformance mode: Defailt
Wchar_t as Built-In: yes
Force loop scope: yes
enforce type conversion: not set
RTTI: not set
Open MP: not set
C++ Language Standard ISO C++ 14
C Language Standard: Default (Legacy MSVC)
Enaable experimental: not set
1>stdafx.cpp
1>H:\Svn\ThirdParty-2019\boost_1_75_0\boost\operators.hpp(161,1): fatal error C1001: Internal compiler error.
1>(compiler file 'msc1.cpp', line 1588)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1>If possible please provide a repro here: https://developercommunity.visualstudio.com
1>Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1>H:\Svn\ThirdParty-2019\boost_1_75_0\boost\operators.hpp(141): message : see reference to class template instantiation 'boost::operators_impl::equality_comparable2<T,U,B>' being compiled
1> with
1> [
1> T=boost::serialization::version_type,
1> U=unsigned int,
1> B=boost::operators_impl::operators_detail::empty_baseboost::serialization::version_type
1> ]
1>H:\Svn\ThirdParty-2019\boost_1_75_0\boost\operators.hpp(421): message : see reference to class template instantiation 'boost::operators_impl::less_than_comparable2<T,U,boost::operators_impl::equality_comparable2<T,U,B>>' being compiled
1> with
1> [
1> T=boost::serialization::version_type,
1> U=unsigned int,
1> B=boost::operators_impl::operators_detail::empty_baseboost::serialization::version_type
1> ]
1>H:\Svn\ThirdParty-2019\boost_1_75_0\boost\operators.hpp(168): message : see reference to class template instantiation 'boost::operators_impl::totally_ordered2<boost::serialization::version_type,unsigned int,boost::operators_impl::operators_detail::empty_base>' being compiled
1> with
1> [
1> T=boost::serialization::version_type
1> ]
1>H:\Svn\ThirdParty-2019\boost_1_75_0\boost\operators.hpp(152): message : see reference to class template instantiation 'boost::operators_impl::equality_comparable1<T,B>' being compiled
1> with
1> [
1> T=boost::serialization::version_type,
1> B=boost::operators_impl::totally_ordered2<boost::serialization::version_type,unsigned int,boost::operators_impl::operators_detail::empty_baseboost::serialization::version_type>
1> ]
1>H:\Svn\ThirdParty-2019\boost_1_75_0\boost\operators.hpp(427): message : see reference to class template instantiation 'boost::operators_impl::less_than_comparable1<T,boost::operators_impl::equality_comparable1<T,B>>' being compiled
1> with
1> [
1> T=boost::serialization::version_type,
1> B=boost::operators_impl::totally_ordered2<boost::serialization::version_type,unsigned int,boost::operators_impl::operators_detail::empty_baseboost::serialization::version_type>
1> ]
1>H:\Svn\ThirdParty-2019\boost_1_75_0\boost\serialization\serialization.hpp(52): message : see reference to class template instantiation 'boost::operators_impl::totally_ordered1<boost::serialization::version_type,boost::operators_impl::totally_ordered2<boost::serialization::version_type,unsigned int,boost::operators_impl::operators_detail::empty_base>>' being compiled
1> with
1> [
1> T=boost::serialization::version_type
1> ]
1>INTERNAL COMPILER ERROR in 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\CL.exe'
1> Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
`
Hi
I am migrating to VS2019, boost Release 1.70.0
C++ Language Standard ISO C++ 14
C Language Standard: Default (Legacy MSVC)
** Visual Studio 2019 Developer Command Prompt v16.9.4
** Copyright (c) 2021 Microsoft Corporation
[vcvarsall.bat] Environment initialized for: 'x64_x86'
C:\Windows\System32>cl /?
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29914 for x86
### The Error
1>C:\Dev\Prj\3rdParty\boost\boost\operators.hpp(154,1): fatal error C1001: Internal compiler error.
1>(compiler file 'msc1.cpp', line 1588)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1>If possible please provide a repro here: https://developercommunity.visualstudio.com
1>Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1>C:\Dev\Prj\3rdParty\boost\boost\operators.hpp(134): message : see reference to class template instantiation 'boost::operators_impl::equality_comparable2<T,U,B>' being compiled
1> with
1> [
1> T=boost::serialization::version_type,
1> U=unsigned int,
1> B=boost::operators_impl::operators_detail::empty_baseboost::serialization::version_type
1> ]
1>C:\Dev\Prj\3rdParty\boost\boost\operators.hpp(414): message : see reference to class template instantiation 'boost::operators_impl::less_than_comparable2<T,U,boost::operators_impl::equality_comparable2<T,U,B>>' being compiled
1> with
1> [
1> T=boost::serialization::version_type,
1> U=unsigned int,
1> B=boost::operators_impl::operators_detail::empty_baseboost::serialization::version_type
1> ]
1>C:\Dev\Prj\3rdParty\boost\boost\operators.hpp(161): message : see reference to class template instantiation 'boost::operators_impl::totally_ordered2<boost::serialization::version_type,unsigned int,boost::operators_impl::operators_detail::empty_base>' being compiled
1> with
1> [
1> T=boost::serialization::version_type
1> ]
1>C:\Dev\Prj\3rdParty\boost\boost\operators.hpp(145): message : see reference to class template instantiation 'boost::operators_impl::equality_comparable1<T,B>' being compiled
1> with
1> [
1> T=boost::serialization::version_type,
1> B=boost::operators_impl::totally_ordered2<boost::serialization::version_type,unsigned int,boost::operators_impl::operators_detail::empty_baseboost::serialization::version_type>
1> ]
1>C:\Dev\Prj\3rdParty\boost\boost\operators.hpp(420): message : see reference to class template instantiation 'boost::operators_impl::less_than_comparable1<T,boost::operators_impl::equality_comparable1<T,B>>' being compiled
1> with
1> [
1> T=boost::serialization::version_type,
1> B=boost::operators_impl::totally_ordered2<boost::serialization::version_type,unsigned int,boost::operators_impl::operators_detail::empty_baseboost::serialization::version_type>
1> ]
1>C:\Dev\Prj\3rdParty\boost\boost\serialization\serialization.hpp(61): message : see reference to class template instantiation 'boost::operators_impl::totally_ordered1<boost::serialization::version_type,boost::operators_impl::totally_ordered2<boost::serialization::version_type,unsigned int,boost::operators_impl::operators_detail::empty_base>>' being compiled
1> with
1> [
1> T=boost::serialization::version_type
1> ]
1>INTERNAL COMPILER ERROR in 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\CL.exe'
1> Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
The error is in this part ;
template <class T, class U, class B = operators_detail::empty_base<T> >
struct equality_comparable2 : B
{
friend bool operator==(const U& y, const T& x) { return x == y; }
friend bool operator!=(const U& y, const T& x) { return !static_cast<bool>(x == y); }
friend bool operator!=(const T& y, const U& x) { return !static_cast<bool>(y == x); }
};
Any help please ?????
gcc 11.4 fails to compile this example with an error template argument 1 is invalid
on this line:
bimap/example/population_bimap.cpp
Line 46 in e5c2657
Specifying the Boost namespace on optional
fixes it (you cannot use std here).
By using boost 1.72.0.0 c++ library and the recent release of Visual Studio 2019 (version 16.9), we found that a warning "warning C4834: discarding return value of function with 'nodiscard' attribute" appears in the bimap construction, as illustrated in the following.
After doing some exploarions, we found that VS 2019 16.9 set all the operators, including std::less, with [[nodiscard]] attribute in the commit https://github.com/microsoft/STL/commit/b4af6e98f88df3a283dc2b2f1af9616684173ab4#diff-e3f9e6952fd73d97f01dd5f71b44bf0f195dc24eae335e5c0138ff25c6b559dd. As the bimap construction process uses std::less operator and seems to discard the returned bool value (see BOOST_concept(BinaryFunction,(Func)(Return)(First)(Second)) in concept_check.hpp), such warning thus appears.
Will bimap community paln to solve this issue?
The documentation's use of countries -- i.e. without an apostrophe -- to mean the possessive, makes for awkward reading. Examples to be found include:
If the plural form of country is imperative -- i.e countries -- then the plural possessive form takes a trailing apostrophe: countries'.
But even when given the trailing apostrophe, countries' remains awkward to read.
I do not think there would be any loss of understanding if:
were used, instead. If we were discussing Ford, Chrysler, GM, and Fiat, we might write "car brands", but we would (hopefully) not write "cars' brands".
I see that the docs have been in their current state for a while. Too late to change?
Adding an explicit default copy assignment operator to boost::bimaps::detail::map_view_iterator
suppresses a warning from GCC 9.1+ about https://en.cppreference.com/w/cpp/language/copy_assignment#Implicitly-defined_copy_assignment_operator due to the explicit copy constructor.
+ map_view_iterator& operator=(map_view_iterator const& iter) = default;
Is that the right thing to do?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.