|
Boost : |
Subject: Re: [boost] [parameter] type requirement compiler error
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-11-04 18:46:02
On Thu, Nov 3, 2011 at 8:14 PM, Jeffrey Lee Hellrung, Jr.
<jeffrey.hellrung_at_[hidden]> wrote:
> On Thu, Nov 3, 2011 at 5:04 PM, Lorenzo Caminiti <lorcaminiti_at_[hidden]>wrote:
>
>> I'm sorry for spamming requests for help every day... I'm really stuck
>> here and any help would be very welcome :) Please let me know if I
>> need to clarify my question better. Thanks!
>>
> [...]
>
> You might have better luck if you include [graph] in the subject, as (to
> me) it looks like an issue with Boost.Graph (or...whatever the graph
> library is called :)
>
> In any case, I'm of no help otherwise.
Thanks but this question is just on how Boost.Parameter allows to
refer to the named parameter type within parameter declaration. It
does not involve Boost.Graph at all. The following example raises the
same Boost.Parameter error and it uses no graph library:
// File: 01.cpp
#include <boost/parameter.hpp>
#include <iostream>
BOOST_PARAMETER_NAME(x)
BOOST_PARAMETER_NAME(y)
BOOST_PARAMETER_FUNCTION(
(void),
f,
tag,
(required
(x, *)
(y, (tag::x::_))
)
) {
std::cout << x << " " << y << std::endl;
}
int main ( void )
{
f(1, 2);
return 0;
}
$ g++ -Wall 01.cpp
In file included from /usr/include/boost/parameter.hpp:14:0,
from 01.cpp:2:
/usr/include/boost/parameter/value_type.hpp: In instantiation of
âboost::parameter::value_type<mpl_::arg<2>, tag::x,
boost::parameter::void_>â:
01.cpp:16:1: instantiated from âtypename
boost_param_result_16f<Args>::type boost_param_implf(const Args&)
[with Args = boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<tag::y,
const int>, boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<tag::x,
const int>, boost::parameter::aux::empty_arg_list> >, typename
boost_param_result_16f<Args>::type = void]â
01.cpp:16:1: instantiated from âtypename
boost_param_result_16f<typename
boost::parameter::aux::argument_pack<boost_param_params_16f<int>,
const ParameterArgumentType0, const
ParameterArgumentType1>::type>::type f(const ParameterArgumentType0&,
const ParameterArgumentType1&, typename
boost::parameter::aux::match<boost_param_params_16f<int>,
ParameterArgumentType0, ParameterArgumentType1>::type) [with
ParameterArgumentType0 = int, ParameterArgumentType1 = int, typename
boost_param_result_16f<typename
boost::parameter::aux::argument_pack<boost_param_params_16f<int>,
const ParameterArgumentType0, const
ParameterArgumentType1>::type>::type = void, typename
boost::parameter::aux::match<boost_param_params_16f<int>,
ParameterArgumentType0, ParameterArgumentType1>::type =
boost::parameter::parameters<boost::parameter::required<tag::x,
boost::mpl::always<mpl_::bool_<true> > >,
boost::parameter::required<tag::y,
boost::is_convertible<mpl_::arg<-0x000000001>,
boost::parameter::value_type<mpl_::arg<2>, tag::x,
boost::parameter::void_> > > >]â
01.cpp:22:11: 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>â
01.cpp: In function âtypename boost_param_result_16f<Args>::type
boost_param_implf(const Args&) [with Args =
boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<tag::y,
const int>, boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<tag::x,
const int>, boost::parameter::aux::empty_arg_list> >, typename
boost_param_result_16f<Args>::type = void]â:
01.cpp:16:1: instantiated from âtypename
boost_param_result_16f<typename
boost::parameter::aux::argument_pack<boost_param_params_16f<int>,
const ParameterArgumentType0, const
ParameterArgumentType1>::type>::type f(const ParameterArgumentType0&,
const ParameterArgumentType1&, typename
boost::parameter::aux::match<boost_param_params_16f<int>,
ParameterArgumentType0, ParameterArgumentType1>::type) [with
ParameterArgumentType0 = int, ParameterArgumentType1 = int, typename
boost_param_result_16f<typename
boost::parameter::aux::argument_pack<boost_param_params_16f<int>,
const ParameterArgumentType0, const
ParameterArgumentType1>::type>::type = void, typename
boost::parameter::aux::match<boost_param_params_16f<int>,
ParameterArgumentType0, ParameterArgumentType1>::type =
boost::parameter::parameters<boost::parameter::required<tag::x,
boost::mpl::always<mpl_::bool_<true> > >,
boost::parameter::required<tag::y,
boost::is_convertible<mpl_::arg<-0x000000001>,
boost::parameter::value_type<mpl_::arg<2>, tag::x,
boost::parameter::void_> > > >]â
01.cpp:22:11: instantiated from here
01.cpp:16:1: error: no matching function for call to
âboost::parameter::aux::cast<void(boost::parameter::value_type<mpl_::arg<2>,
tag::x, boost::parameter::void_>)>::execute(const int&)â
/usr/include/boost/parameter/aux_/cast.hpp:99:28: note: candidates
are: static boost::parameter::aux::use_default_tag
boost::parameter::aux::cast<void(T)>::execute(boost::parameter::aux::use_default_tag)
[with T = boost::parameter::value_type<mpl_::arg<2>, tag::x,
boost::parameter::void_>]
/usr/include/boost/parameter/aux_/cast.hpp:109:14: note:
static T boost::parameter::aux::cast<void(T)>::execute(T) [with T =
boost::parameter::value_type<mpl_::arg<2>, tag::x,
boost::parameter::void_>]
01.cpp:16:1: error: return-statement with a value, in function returning 'void'
--Lorenzo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk