From 0fffa4a6ba0ca751aac7c45b95ca2a1512bee424 Mon Sep 17 00:00:00 2001 From: Daniel Wallin Date: Sat, 17 Jan 2004 14:15:09 +0000 Subject: [PATCH] cleanup [SVN r1890] --- test/named_params_test.cpp | 64 ++++++++++---------------------------- 1 file changed, 16 insertions(+), 48 deletions(-) diff --git a/test/named_params_test.cpp b/test/named_params_test.cpp index 2cd0f96..e8b5534 100755 --- a/test/named_params_test.cpp +++ b/test/named_params_test.cpp @@ -4,31 +4,19 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include #include -//#include +#include #include -/* -BOOST_NAMED_PARAMS_FUN(int, f, 0, 3, f_keywords) -{ - return p[index]; -} -*/ namespace test { using boost::keyword; using boost::keywords; - using boost::arg; - - struct name_t - { - // At some point maybe we should use has_xxx to allow this - typedef boost::is_convertible predicate; - }; + using boost::named_param; + struct name_t; keyword name; struct value_t; @@ -40,68 +28,48 @@ namespace test struct tester_t; keyword tester; - struct X - { - X(const char*) {} - }; - - template - struct convertible_from - { - template - struct apply : boost::is_convertible - {}; - }; - struct f_keywords // vc6 is happier with inheritance than with a typedef : keywords< tester_t - , arg > + , name_t , value_t , index_t > {}; - struct value_default + double value_default() { - typedef double result_type; - - double operator()() const - { - return 666.222; - } - }; - + return 666.222; + } + template int f_impl(const Params& p) { p[tester]( p[name] - , p[value || value_default() ] + , p[value || boost::bind(&value_default) ] , p[index | 999] ); return 1; } template - int f(Tester const& t, const Name& name_, const Value& value_, const Index& index_, - typename f_keywords::restrict::type x = f_keywords()) + int f(Tester const& t, const Name& name_, + const Value& value_, const Index& index_) { - return f_impl(x(t, name_, value_, index_)); + return f_impl(f_keywords()(t, name_, value_, index_)); } template - int f(Tester const& t, const Name& name_, const Value& value_, - typename f_keywords::restrict::type x = f_keywords()) + int f(Tester const& t, const Name& name_, const Value& value_) { - return f_impl(x(t, name_, value_)); + return f_impl(f_keywords()(t, name_, value_)); } template - int f(Tester const& t, const Name& name_, - typename f_keywords::restrict::type x = f_keywords()) + int f(Tester const& t, const Name& name_) { - return f_impl(x(t, name_)); + return f_impl(f_keywords()(t, name_)); } template