
There's an issue using get expressions returning optionals with BOOST_FUSION_ADAPT_ADT, demonstrated in the simplest case below. Optional<T> is trying initialize its internal T object using the attribute proxy object returned by fusion, but this can only degrade to optional<T> and not T, so the assignment fails. C++ wizard, K-Ballo, took a quick look at this in #boost and seemed to suggest it's the way op= is SFINAEd up for optional. Does anyone have a work around for this? #include <boost/optional.hpp> #include <boost/fusion/adapted/struct/adapt_struct.hpp> #include <boost/fusion/adapted/adt/adapt_adt.hpp> #include <boost/fusion/algorithm/auxiliary/copy.hpp> struct A { boost::optional<int> x; }; struct B { boost::optional<int> y; }; BOOST_FUSION_ADAPT_STRUCT(B, (boost::optional<int>, y)) BOOST_FUSION_ADAPT_ADT(A, (boost::optional<int>, boost::optional<int>, obj.x, obj.x = val)) int main() { A a; B b; // doesn't work: boost::fusion::copy (a, b); // this works: // boost::fusion::copy (b, a); }