#3298 closed Bugs (duplicate)
Iterating over a map fails to compile with MSVC 9 (works with CYGWIN GCC 4.3.2)
Reported by: | Owned by: | Aleksey Gurtovoy | |
---|---|---|---|
Milestone: | Boost 1.40.0 | Component: | mpl |
Version: | Boost 1.39.0 | Severity: | Showstopper |
Keywords: | map | Cc: |
Description
I have written a template metafunction that takes two maps and joins them into a single map. However, if keys are erased from both maps before joining them, the iterators of the joined map fail to compile with MSVC 9. The code compiles with CYGWIN GCC 4.3.2. If a key is erased from only one of the original maps, the code compiles with both compilers.
Attachments (2)
Change History (7)
by , 13 years ago
Attachment: | join_map_test.cpp added |
---|
comment:1 by , 13 years ago
First I want to acknowledge that I am an MPL novice, and am still learning the ropes of this extremely useful library. I have attached an updated example of the problem. This implementation takes better advantage of the tools provided in the mpl library.
I have two template meta functions defined in this example which joins two maps, MapL and MapR. The first function, join_maps_1, generates a new copy of the joint maps using copy and joint_view. If I understand things correctly, this requires size<MapL> + size<MapR> instantiations. This version seems to work without problems.
The second function, join_maps_2, inserts MapR into MapL using copy<>. It should require size<MapL> instantiations. However, if the resulting map is passed to for_each<>, the code fails to compile with MSVC 9 if a key has been erase from MapL.
by , 13 years ago
Attachment: | join_map_test_2.cpp added |
---|
Updated example using MPL functions to join maps
comment:2 by , 13 years ago
This sounds like a result of #2042. Does the patch there fix your problem?
follow-up: 4 comment:3 by , 13 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
This patch did indeed resolve the problem. I apologize for not discovering it on my own.
Is there a reason why the patch has not made it into the main repository?
follow-up: 5 comment:4 by , 13 years ago
Replying to Marshall Galbraith:
Is there a reason why the patch has not made it into the main repository?
I'll try to get it in soon, but it's probably too late for 1.40.
comment:5 by , 13 years ago
Replying to steven_watanabe:
Replying to Marshall Galbraith:
Is there a reason why the patch has not made it into the main repository?
I'll try to get it in soon, but it's probably too late for 1.40.
I've just merged Steven's fix to the release branch, so it should make it to 1.40 after all.
Example code that compiles with CYGWIN GCC 4.3.2 but now MSVC 9