#8418 closed Bugs (fixed)
Boost Fusion foreach works for std::tuple OR boost::tuple depending on inclusion order
Reported by: | Owned by: | Joel de Guzman | |
---|---|---|---|
Milestone: | To Be Determined | Component: | fusion |
Version: | Boost 1.53.0 | Severity: | Problem |
Keywords: | fusion tuple adapted | Cc: | bugs@…, william@… |
Description
As my attached repro sample shows can't adapt std::tuple and boost::tuple at the same time.
The headers
# include <boost/fusion/adapted/boost_tuple.hpp> # include <boost/fusion/adapted/std_tuple.hpp>
seem to mutually exclude each other (at least in this code sample). Which ever header of the two gets included _first_, determines which type of tuple will be usable as a fusion sequence in that TU.
In the case of the 'blanket' include boost/fusion/adapted.hpp
this means that std::tuple is not usable as a Fusion Sequence - unless one explicitely include boost/fusion/adapted/std_tuple.hpp
_ahead_ of that.
This is rather surprising, and obviously causes problems for people mixing std::tuple and boost::tuple within a sinlge TU.
Also, although I haven't looked too deeply into the mechanics of it, I worry a bit that this may be a signal that ODR violations could be lurking when different TUs include the headers in different order.
Attachments (2)
Change History (8)
by , 10 years ago
comment:1 by , 10 years ago
Component: | None → fusion |
---|---|
Owner: | set to |
comment:2 by , 10 years ago
Hi,
I believe the issue behind this is that the header guards for the following 2 files have the SAME header guard value of BOOST_FUSION_CATEGORY_OF_IMPL_09272006_0726
.
- boost/fusion/adapted/boost_tuple/detail/category_of_impl.hpp
- boost/fusion/adapted/std_tuple/detail/category_of_impl.hpp
comment:3 by , 10 years ago
Cc: | added |
---|
follow-up: 6 comment:4 by , 10 years ago
Amazing! I had this hunch, but on looking at the header guards, I concluded they looked like they are automatically generated :|
On that ground I dismissed the possibility of a collision... How did you 'make up' a new 'unique' header guard name?
Thanks!
comment:6 by , 10 years ago
Replying to anonymous:
Amazing! I had this hunch, but on looking at the header guards, I concluded they looked like they are automatically generated :|
On that ground I dismissed the possibility of a collision... How did you 'make up' a new 'unique' header guard name?
Thanks!
The tail end of the header guard appears to be a datetime string, so I changed that to today's date. I imagined that if I was wrong with that assumption, that Joel would have used a different one.
Simple reproducer for ticket #8418