Boost logo

Boost Users :

Subject: [Boost-users] fusion error when compiling graphviz code using VC2010
From: Carl Wallace (carl_at_[hidden])
Date: 2015-06-29 07:36:08


We have been using Boost's graphviz support for several years and have
upgraded through a few versions of Boost with no issues in some long
stable code. However, when we moved to 1.58 our Windows build broke. We
are still using VC2010, with plans to move to 2015 in the not-too-distant
future. We have not yet tried 1.58 in VC2015. The error message is very
large but emanates from here:

boost/include/boost-1_58\boost/fusion/container/list/cons.hpp(86): error
C2664:
'boost::xpressive::detail::alternates_list<Head,Tail>::alternates_list(cons
t Head &,const boost::fusion::nil &)' : cannot convert parameter 1 from
'const boost::fusion::cons_iterator<Cons>' to 'const
boost::xpressive::detail::static_xpression<Matcher,Next> &’

I am not familiar with the fusion or xpressive libraries, but after
picking through the error messages and review of diff of changes since
1.54 (the version we are moving from), this looks like a template
specialization problem. The problem is rooted in a regex that uses
xpressive in the escape_dot_string function in the graphviz library. In
1.58 the function at the line identified in the error snip above is
defined as follows:

template <typename Sequence> BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
        cons(
 Sequence const& seq,
 typename boost::enable_if<
  mpl::and_<
   traits::is_sequence<Sequence>,
   mpl::not_<is_convertible<Sequence, Car> > > // use copy to car instead
>::type* /*dummy*/ = 0
        )
            : car(*fusion::begin(seq)),
  cdr(fusion::next(fusion::begin(seq)), mpl::true_()) {}

When we replace this with the following implementation from 1.54 the build
works and it appears the desired functionality is working (though more
testing is required).

template <typename Sequence> BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons(
 Sequence const& seq,
 typename boost::disable_if<
  mpl::or_<
   is_convertible<Sequence, cons>, // use copy ctor instead
   is_convertible<Sequence, Car> // use copy to car instead
>
>::type* /*dummy*/ = 0
        )
            : car(*fusion::begin(seq)),
  cdr(fusion::next(fusion::begin(seq)), mpl::true_()) {}

Any thoughts? The new code in 1.58 builds and runs fine with no mods on OS
X. We have not tried Linux yet.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net