mirror of
https://github.com/boostorg/utility.git
synced 2025-08-02 14:24:30 +02:00
NamedParams renaming
[SVN r2547]
This commit is contained in:
@@ -11,25 +11,21 @@
|
|||||||
|
|
||||||
namespace test
|
namespace test
|
||||||
{
|
{
|
||||||
using boost::keyword;
|
using namespace boost::named_params;
|
||||||
using boost::keywords;
|
|
||||||
using boost::named_param;
|
|
||||||
|
|
||||||
struct name_t; keyword<name_t> name;
|
keyword<struct name_> name;
|
||||||
struct value_t; keyword<value_t> value;
|
keyword<struct value_> value;
|
||||||
|
|
||||||
struct f_keywords
|
struct f_keywords
|
||||||
: keywords<
|
: keywords<
|
||||||
named_param<
|
optional<
|
||||||
name_t
|
name_
|
||||||
, boost::mpl::true_
|
, boost::is_convertible<boost::mpl::_, std::string>
|
||||||
, boost::is_convertible<boost::mpl::_, std::string>
|
>
|
||||||
>
|
, optional<
|
||||||
, named_param<
|
value_
|
||||||
value_t
|
, boost::is_convertible<boost::mpl::_, float>
|
||||||
, boost::mpl::true_
|
>
|
||||||
, boost::is_convertible<boost::mpl::_, float>
|
|
||||||
>
|
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
@@ -12,29 +12,19 @@
|
|||||||
|
|
||||||
namespace test
|
namespace test
|
||||||
{
|
{
|
||||||
|
using namespace boost::named_params;
|
||||||
using boost::keyword;
|
|
||||||
using boost::keywords;
|
keyword<struct name_> name;
|
||||||
using boost::named_param;
|
keyword<struct value_> value;
|
||||||
|
keyword<struct index_> index;
|
||||||
struct name_t;
|
keyword<struct tester_> tester;
|
||||||
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;
|
|
||||||
|
|
||||||
struct f_keywords // vc6 is happier with inheritance than with a typedef
|
struct f_keywords // vc6 is happier with inheritance than with a typedef
|
||||||
: keywords<
|
: keywords<
|
||||||
tester_t
|
tester_
|
||||||
, name_t
|
, name_
|
||||||
, value_t
|
, value_
|
||||||
, index_t
|
, index_
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
@@ -49,7 +39,8 @@ namespace test
|
|||||||
p[tester](
|
p[tester](
|
||||||
p[name]
|
p[name]
|
||||||
, p[value || boost::bind(&value_default) ]
|
, p[value || boost::bind(&value_default) ]
|
||||||
, p[index | 999]
|
// , p[value | 666.222 ]
|
||||||
|
, p[index | 999 ]
|
||||||
);
|
);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -128,6 +119,26 @@ namespace test
|
|||||||
{
|
{
|
||||||
return values_t<Name,Value,Index>(n,v,i);
|
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
|
// GCC2 has a problem with char (&)[] deduction, so we'll cast string
|
||||||
|
Reference in New Issue
Block a user