mirror of
https://github.com/boostorg/utility.git
synced 2025-08-02 06:15:22 +02:00
NamedParams renaming
[SVN r2547]
This commit is contained in:
@@ -11,25 +11,21 @@
|
||||
|
||||
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_
|
||||
, boost::is_convertible<boost::mpl::_, std::string>
|
||||
>
|
||||
, named_param<
|
||||
value_t
|
||||
, boost::mpl::true_
|
||||
, boost::is_convertible<boost::mpl::_, float>
|
||||
>
|
||||
: keywords<
|
||||
optional<
|
||||
name_
|
||||
, boost::is_convertible<boost::mpl::_, std::string>
|
||||
>
|
||||
, optional<
|
||||
value_
|
||||
, boost::is_convertible<boost::mpl::_, float>
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
|
@@ -12,29 +12,19 @@
|
||||
|
||||
namespace test
|
||||
{
|
||||
|
||||
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;
|
||||
using namespace boost::named_params;
|
||||
|
||||
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,7 +39,8 @@ namespace test
|
||||
p[tester](
|
||||
p[name]
|
||||
, p[value || boost::bind(&value_default) ]
|
||||
, p[index | 999]
|
||||
// , 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
|
||||
|
Reference in New Issue
Block a user