Opened 10 years ago
Closed 10 years ago
#7569 closed Bugs (fixed)
Compile Error using BOOST_FUSION_DEFINE_STRUCT_INLINE with VC10 and GCC <4.5
Reported by: | Owned by: | Joel de Guzman | |
---|---|---|---|
Milestone: | To Be Determined | Component: | fusion |
Version: | Boost 1.51.0 | Severity: | Problem |
Keywords: | Cc: |
Description
As laid out on the mailing list, because of too much class nesting, a few compilers won't get the macro to work with partial template spcialisations of the nested classes.
a work around is instead of doing something like this (for example in iterator::deref):
//using (A1, a1)(A2, a2)...(AN, an) as struct arguments typedef A1 t1_type; typedef A2 t2_type; ... t1_type& t1;//linked to a1 t2_type& t2;//linked to a2 ... template<int> struct deref{}; template<> struct deref<1>{ typedef t1_type& type; type call(Sequence& seq){ return seq.t1; } };
use a fusion vector to get rid of the partial template specialisation
typedef boost::fusion::vector<A1&,A2&,...AN&> t_seq; t_seq t;//tied to a1...an template<int N> struct deref{ typedef result_of::at_c<t_seq,N> type; type call(Sequence& seq){ return at_c<N>(seq.t); } };
Attachments (2)
Change History (4)
by , 10 years ago
Attachment: | define-struct-inline-msvc-wknd.patch added |
---|
by , 10 years ago
Attachment: | define-struct-inline-msvc-wknd-tests.patch added |
---|
Patch to regression tests
comment:1 by , 10 years ago
I implemented the workaround and tested it with MSVC and various GCC versions, including GCC 4.2. It seems to be working. Oswin, please try it out and let me know if it works for you now.
Note:
See TracTickets
for help on using tickets.
Patch that implements the workaround