Boost logo

Boost :

Subject: Re: [boost] [BGL] Visual Studio 12 finish_edge() failure, general BOOST_TTI_HAS_MEMBER_FUNCTION failure?
From: Edward Diener (eldiener_at_[hidden])
Date: 2014-03-31 18:30:51


On 3/31/2014 1:27 PM, Michael Behrns-Miller wrote:
> Hello boost!
>
> In the BGL, finish_edge() is a visitor function of DFS, but it is
> optional. It is made optional via BOOST_TTI_HAS_MEMBER_FUNCTION. Here's
> how BGL defines it:
>
> -------------
>
> BOOST_TTI_HAS_MEMBER_FUNCTION(finish_edge)
>
> template <bool IsCallable> struct do_call_finish_edge {
> template <typename E, typename G, typename Vis>
> static void call_finish_edge(Vis& vis, const E& e, const G& g) {
> vis.finish_edge(e, g);
> }
> };
>
> template <> struct do_call_finish_edge<false> {
> template <typename E, typename G, typename Vis>
> static void call_finish_edge(Vis&, const E&, const G&) {}
> };
>
> template <typename E, typename G, typename Vis>
> void call_finish_edge(Vis& vis, const E& e, const G& g) { // Only
> call if method exists
> do_call_finish_edge<has_member_function_finish_edge<Vis,
> void>::value>::call_finish_edge(vis, e, g);
> }

The invocation of has_member_function_finish_edge has to match the
member function signature which you are invoking. If the member function
signature for finish_edge is:

void finish_edge(const E&, const G&);

then your invocation for do_call_finish_edge must be:

do_call_finish_edge
   <
   has_member_function_finish_edge
     <
     Vis,
     void,
     boost::mpl::vector
       <
       const E&,
       const G&
>
>
   ::value
>::call_finish_edge(vis, e, g);

or

do_call_finish_edge
   <
   has_member_function_finish_edge
     <
     void Vis::* (const E&,const G&)
>
   ::value
>::call_finish_edge(vis, e, g);


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk