From 6894a59e87b5cf3aa8895e6ea96d07a70777ebbb Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Thu, 18 Jun 2009 01:37:13 +0000 Subject: [PATCH] Further reduction of redundant code by merging 0 param case for constructors in --- dispatchkit/proxy_constructors.hpp | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/dispatchkit/proxy_constructors.hpp b/dispatchkit/proxy_constructors.hpp index e66edcf..ca59884 100644 --- a/dispatchkit/proxy_constructors.hpp +++ b/dispatchkit/proxy_constructors.hpp @@ -8,23 +8,8 @@ #include #include -namespace dispatchkit -{ - template - boost::shared_ptr constructor() - { - return boost::shared_ptr(new Class()); - } - template - boost::function ()> build_constructor() - { - typedef boost::shared_ptr (*func)(); - return boost::function ()>(func(&(constructor))); - } -} - -#define BOOST_PP_ITERATION_LIMITS ( 1, 10 ) +#define BOOST_PP_ITERATION_LIMITS ( 0, 10 ) #define BOOST_PP_FILENAME_1 "proxy_constructors.hpp" #include BOOST_PP_ITERATE() # endif @@ -33,17 +18,17 @@ namespace dispatchkit namespace dispatchkit { - template + template boost::shared_ptr constructor( BOOST_PP_ENUM_BINARY_PARAMS(n, Param, p) ) { return boost::shared_ptr(new Class( BOOST_PP_ENUM_PARAMS(n, p) )); } - template + template boost::function (BOOST_PP_ENUM_PARAMS(n, Param))> build_constructor() { typedef boost::shared_ptr (*func)(BOOST_PP_ENUM_PARAMS(n, Param)); - return boost::function (BOOST_PP_ENUM_PARAMS(n, Param))>(func(&(constructor))); + return boost::function (BOOST_PP_ENUM_PARAMS(n, Param))>(func(&(constructor))); } }