NamedParams renaming

[SVN r2547]
This commit is contained in:
Daniel Wallin
2005-03-26 08:44:37 +00:00
parent f7631d89a7
commit c5826cb47b
2 changed files with 44 additions and 37 deletions

View File

@@ -11,23 +11,19 @@
namespace test
{
using boost::keyword;
using boost::keywords;
using boost::named_param;
using namespace boost::named_params;
struct name_t; keyword<name_t> name;
struct value_t; keyword<value_t> value;
keyword<struct name_> name;
keyword<struct value_> value;
struct f_keywords
: keywords<
named_param<
name_t
, boost::mpl::true_
optional<
name_
, boost::is_convertible<boost::mpl::_, std::string>
>
, named_param<
value_t
, boost::mpl::true_
, optional<
value_
, boost::is_convertible<boost::mpl::_, float>
>
>

View File

@@ -12,29 +12,19 @@
namespace test
{
using namespace boost::named_params;
using boost::keyword;
using boost::keywords;
using boost::named_param;
struct name_t;
keyword<name_t> name;
struct value_t;
keyword <value_t> value;
struct index_t;
keyword<index_t> index;
struct tester_t;
keyword<tester_t> tester;
keyword<struct name_> name;
keyword<struct value_> value;
keyword<struct index_> index;
keyword<struct tester_> tester;
struct f_keywords // vc6 is happier with inheritance than with a typedef
: keywords<
tester_t
, name_t
, value_t
, index_t
tester_
, name_
, value_
, index_
>
{};
@@ -49,6 +39,7 @@ namespace test
p[tester](
p[name]
, p[value || boost::bind(&value_default) ]
// , p[value | 666.222 ]
, p[index | 999 ]
);
return 1;
@@ -128,6 +119,26 @@ namespace test
{
return values_t<Name,Value,Index>(n,v,i);
}
typedef f_keywords g_keywords;
template<class Args>
int g_impl(Args const& args)
{
return f(args);
}
template<class A0>
int g(A0 const& a0)
{
return g_impl(g_keywords(a0));
}
template<class A0, class A1>
int g(A0 const& a0, A1 const& a1)
{
return g_impl(g_keywords(a0, a1));
}
}
// GCC2 has a problem with char (&)[] deduction, so we'll cast string