|
Boost-Commit : |
From: mconsoni_at_[hidden]
Date: 2007-07-02 14:50:34
Author: mconsoni
Date: 2007-07-02 14:50:33 EDT (Mon, 02 Jul 2007)
New Revision: 7339
URL: http://svn.boost.org/trac/boost/changeset/7339
Log:
- Added support for boost::function. It's optional, is activated with BOOST_EXTENSION_USE_BOOST_FUNCTION variable.
Text files modified:
sandbox/boost/extension/shared_library.hpp | 54 ++++++++++++++++++++++++++++++++++-----
1 files changed, 46 insertions(+), 8 deletions(-)
Modified: sandbox/boost/extension/shared_library.hpp
==============================================================================
--- sandbox/boost/extension/shared_library.hpp (original)
+++ sandbox/boost/extension/shared_library.hpp 2007-07-02 14:50:33 EDT (Mon, 02 Jul 2007)
@@ -14,6 +14,9 @@
#define BOOST_EXTENSION_LINKED_LIBRARY_HPP
#include <boost/extension/impl/library_impl.hpp>
+#ifdef BOOST_EXTENSION_USE_BOOST_FUNCTION
+#include <boost/function.hpp>
+#endif
namespace boost{namespace extensions{
template <class ReturnValue, class Param1 = void, class Param2 = void,
@@ -22,8 +25,13 @@
class functor
{
protected:
+#ifdef BOOST_EXTENSION_USE_BOOST_FUNCTION
+ typedef boost::function6<ReturnValue, Param1, Param2, Param3,
+ Param4, Param5, Param6> FunctionType;
+#else
typedef ReturnValue (*FunctionType)(Param1, Param2, Param3, Param4,
- Param5, Param6);
+ Param5, Param6);
+#endif // BOOST_EXTENSION_USE_BOOST_FUNCTION
FunctionType func_;
public:
bool is_valid(){return func_ != 0;}
@@ -31,7 +39,8 @@
:func_(func)
{}
functor(generic_function_ptr func)
- :func_(FunctionType(func))
+ :func_(FunctionType((ReturnValue (*)(Param1, Param2, Param3, Param4,
+ Param5, Param6)) func))
{}
ReturnValue operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4,
Param5 p5, Param6 p6)
@@ -45,7 +54,12 @@
class functor<ReturnValue, Param1, Param2, Param3, Param4, Param5>
{
protected:
+#ifdef BOOST_EXTENSION_USE_BOOST_FUNCTION
+ typedef boost::function5<ReturnValue, Param1, Param2, Param3,
+ Param4, Param5> FunctionType;
+#else
typedef ReturnValue (*FunctionType)(Param1, Param2, Param3, Param4, Param5);
+#endif // BOOST_EXTENSION_USE_BOOST_FUNCTION
FunctionType func_;
public:
bool is_valid(){return func_ != 0;}
@@ -53,7 +67,8 @@
:func_(func)
{}
functor(generic_function_ptr func)
- :func_(FunctionType(func))
+ :func_(FunctionType((ReturnValue (*)(Param1, Param2, Param3,
+ Param4, Param5)) func))
{}
ReturnValue operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
{
@@ -66,7 +81,12 @@
class functor<ReturnValue, Param1, Param2, Param3, Param4>
{
protected:
+#ifdef BOOST_EXTENSION_USE_BOOST_FUNCTION
+ typedef boost::function4<ReturnValue, Param1, Param2, Param3,
+ Param4> FunctionType;
+#else
typedef ReturnValue (*FunctionType)(Param1, Param2, Param3, Param4);
+#endif // BOOST_EXTENSION_USE_BOOST_FUNCTION
FunctionType func_;
public:
bool is_valid(){return func_ != 0;}
@@ -74,7 +94,8 @@
:func_(func)
{}
functor(generic_function_ptr func)
- :func_(FunctionType(func))
+ :func_(FunctionType((ReturnValue (*)(Param1, Param2, Param3,
+ Param4)) func))
{}
ReturnValue operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4)
{
@@ -86,7 +107,11 @@
class functor<ReturnValue, Param1, Param2, Param3>
{
protected:
+#ifdef BOOST_EXTENSION_USE_BOOST_FUNCTION
+ typedef boost::function3<ReturnValue, Param1, Param2, Param3> FunctionType;
+#else
typedef ReturnValue (*FunctionType)(Param1, Param2, Param3);
+#endif // BOOST_EXTENSION_USE_BOOST_FUNCTION
FunctionType func_;
public:
bool is_valid(){return func_ != 0;}
@@ -94,7 +119,7 @@
:func_(func)
{}
functor(generic_function_ptr func)
- :func_(FunctionType(func))
+ :func_(FunctionType((ReturnValue (*)(Param1, Param2, Param3)) func))
{}
ReturnValue operator()(Param1 p1, Param2 p2, Param3 p3)
{
@@ -106,7 +131,11 @@
class functor<ReturnValue, Param1, Param2>
{
protected:
+#ifdef BOOST_EXTENSION_USE_BOOST_FUNCTION
+ typedef boost::function2<ReturnValue, Param1, Param2> FunctionType;
+#else
typedef ReturnValue (*FunctionType)(Param1, Param2);
+#endif // BOOST_EXTENSION_USE_BOOST_FUNCTION
FunctionType func_;
public:
bool is_valid(){return func_ != 0;}
@@ -114,7 +143,7 @@
:func_(func)
{}
functor(generic_function_ptr func)
- :func_(FunctionType(func))
+ :func_(FunctionType((ReturnValue (*)(Param1, Param2)) func))
{}
ReturnValue operator()(Param1 p1, Param2 p2)
{
@@ -126,7 +155,12 @@
class functor<ReturnValue, Param1>
{
protected:
+#ifdef BOOST_EXTENSION_USE_BOOST_FUNCTION
+ typedef boost::function1<ReturnValue, Param1> FunctionType;
+#else
typedef ReturnValue (*FunctionType)(Param1);
+#endif // BOOST_EXTENSION_USE_BOOST_FUNCTION
+
FunctionType func_;
public:
bool is_valid(){return func_ != 0;}
@@ -134,7 +168,7 @@
:func_(func)
{}
functor(generic_function_ptr func)
- :func_(FunctionType(func))
+ :func_(FunctionType((ReturnValue (*)(Param1)) func))
{}
ReturnValue operator()(Param1 p1)
{
@@ -146,7 +180,11 @@
class functor<ReturnValue>
{
protected:
+#ifdef BOOST_EXTENSION_USE_BOOST_FUNCTION
+ typedef boost::function0<ReturnValue> FunctionType;
+#else
typedef ReturnValue (*FunctionType)();
+#endif // BOOST_EXTENSION_USE_BOOST_FUNCTION
FunctionType func_;
public:
bool is_valid(){return func_ != 0;}
@@ -154,7 +192,7 @@
:func_(func)
{}
functor(generic_function_ptr func)
- :func_(FunctionType(func))
+ :func_(FunctionType((ReturnValue (*)()) func))
{}
ReturnValue operator()()
{
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk