Boost logo

Boost Users :

Subject: [Boost-users] overloading on keyword signature
From: e r (erwann.rogard_at_[hidden])
Date: 2008-09-15 19:48:14


hi,

i'm following up on an earlier of my posts with a simpler example.

in the example below: the overload is on argument-name and type, yet the
overload is ambiguous.
1) is there a way around this? and if so,
2) is it also possible to have an overload the on argument-name only
(replace string and int below by *).

thanks.

*.hpp
namespace lib{
  BOOST_PARAMETER_NAME(name)
  BOOST_PARAMETER_NAME(index)

  BOOST_PARAMETER_FUNCTION(
    (void), f, tag,
    (required (name,(std::string)))
  )
  {
      std::cout << name << std::endl;
  }

  BOOST_PARAMETER_FUNCTION(
    (void), f, tag,
    (required (index,(int)))
  )
  {
       std::cout << index << std::endl;
  }
}
*.cpp

    lib::f(lib::_name = "jill");
    lib::f(lib::_index = 1);

/home/er/cpp/libs/testing_names/par_fun.hpp||In function ‘typename
lib::boost_param_result_27f<typename
boost::parameter::aux::argument_pack<lib::boost_param_params_27f<int>,
const ParameterArgumentType0, boost::parameter::void_,
boost::parameter::void_, boost::parameter::void_,
boost::parameter::void_>::type>::type lib::f(const
ParameterArgumentType0&, typename
boost::parameter::aux::match<lib::boost_param_params_27f<int>,
ParameterArgumentType0, boost::parameter::void_,
boost::parameter::void_, boost::parameter::void_,
boost::parameter::void_>::type) [with ParameterArgumentType0 =
boost::parameter::aux::tagged_argument<lib::tag::index, const int>]’:|
/home/er/cpp/libs/testing_names/main.cpp|28|instantiated from here|
/home/er/cpp/libs/testing_names/par_fun.hpp|24|error: call of overloaded
‘boost_param_implf(boost::parameter::aux::arg_list<const
boost::parameter::aux::tagged_argument<lib::tag::index, const int>,
boost::parameter::aux::empty_arg_list>)’ is ambiguous|
/home/er/cpp/libs/testing_names/par_fun.hpp|16|note: candidates are:
typename lib::boost_param_result_19f<Args>::type
lib::boost_param_implf(const Args&) [with Args =
boost::parameter::aux::arg_list<const
boost::parameter::aux::tagged_argument<lib::tag::index, const int>,
boost::parameter::aux::empty_arg_list>]|
/home/er/cpp/libs/testing_names/par_fun.hpp|24|note:
typename lib::boost_param_result_27f<Args>::type
lib::boost_param_implf(const Args&) [with Args =
boost::parameter::aux::arg_list<const
boost::parameter::aux::tagged_argument<lib::tag::index, const int>,
boost::parameter::aux::empty_arg_list>]|
/home/er/cpp/libs/testing_names/par_fun.hpp|24|error: return-statement
with a value, in function returning 'void'|
||=== Build finished: 2 errors, 0 warnings ===|


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