|
Boost : |
Subject: Re: [boost] [parameter] type requirement compiler error
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-11-02 18:51:43
On Wed, Nov 2, 2011 at 4:40 PM, Lorenzo Caminiti <lorcaminiti_at_[hidden]> wrote:
> On Mon, Oct 24, 2011 at 2:16 PM, Dave Abrahams <dave_at_[hidden]> wrote:
>>
>> on Mon Oct 24 2011, lcaminiti <lorcaminiti-AT-gmail.com> wrote:
>>
>>> Hello all,
>>>
>>> The following parameter type requirement:
>>>
>>> (required (graph, *) )
>>> (optional (root_vertex,
>>> (typename
>>> boost::graph_traits<graph_type>::vertex_descriptor),
>>> *boost::vertices(graph).first) )
>>>
>>> Generates a GCC error:
>>>
>>> dfs.05.cpp:40: error: graph_type was not declared in this scope
>>
>> Yeah.... I'm guessing this is what graphs::graph::_ is all about, but
>> according to revision control, Daniel made this happen, and there's
>> basically no documentation for it. Daniel?
>
> Help anyone??
>
> I'm just trying to compile the graph example from the Boost.Parameter
> docs, in an ideal world (doc examples added to regression tests) it'd
> be easier... please help :)
Here's the deal. If I use tag::graph::_ instead of graph_type, that
type is define by the expansion of BOOST_PARAMETER_NAME(graph) as:
namespace tag {
struct graph {
static char const* keyword_name() { return "graph"; }
typedef boost::parameter::value_type< boost::mpl::_2, graph,
boost::parameter::void_ > _;
typedef boost::parameter::value_type< boost::mpl::_2, graph,
boost::parameter::void_ > _1;
};
}
namespace {
::boost::parameter::keyword<tag::graph> const& _graph =
::boost::parameter::keyword<tag::graph>::instance;
}
Then if I use this type in the declaration of the root_vertex parameter type:
(optional
(root_vertex,
(typename
boost::graph_traits<tag::graph::_>::vertex_descriptor),
*boost::vertices(graph).first)
)
)
I get the error:
/usr/include/boost/parameter/value_type.hpp: In instantiation of
âboost::parameter::value_type<mpl_::arg<2>, graphs::tag::graph,
boost::parameter::void_>â:
/usr/include/boost/graph/graph_traits.hpp:29:52: instantiated from
âboost::graph_traits<boost::parameter::value_type<mpl_::arg<2>,
graphs::tag::graph, boost::parameter::void_> >â
dfs.06.cpp:85:1: instantiated from here
/usr/include/boost/parameter/value_type.hpp:60:13: error: no type
named âbindingâ in âstruct mpl_::arg<2>â
/usr/include/boost/parameter/value_type.hpp:62:5: error: no type named
âbindingâ in âstruct mpl_::arg<2>â
I am not sure but it seems that the mpl::_2 in graph::_ declaration is
not bound to anything while it should be bound to Boost.Parameter
argument pack... how is this supposed to work? Who should bind mpl::_2
to the argument pack?
Thanks a lot.
--Lorenzo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk