|
Boost-Commit : |
From: oryol_at_[hidden]
Date: 2007-09-12 22:22:05
Author: jeremypack
Date: 2007-09-12 22:22:04 EDT (Wed, 12 Sep 2007)
New Revision: 39228
URL: http://svn.boost.org/trac/boost/changeset/39228
Log:
Primarily a fix for MSVC - static member functions became free functions. Also a fix for two tests, which were pointing to the wrong directories.
Text files modified:
sandbox/boost/extension/factory_map.hpp | 2
sandbox/boost/reflection/reflector.hpp | 48 ++++++++++++++++-----------------------
sandbox/libs/extension/test/multiple_inheritance_test.cpp | 15 ++++++-----
sandbox/libs/extension/test/parameters_test.cpp | 3 +
4 files changed, 31 insertions(+), 37 deletions(-)
Modified: sandbox/boost/extension/factory_map.hpp
==============================================================================
--- sandbox/boost/extension/factory_map.hpp (original)
+++ sandbox/boost/extension/factory_map.hpp 2007-09-12 22:22:04 EDT (Wed, 12 Sep 2007)
@@ -90,4 +90,4 @@
#undef BOOST_EXTENSION_FACTORY_MAP_GET_FUNCTION
#undef BOOST_EXTENSION_FACTORY_MAP_CONVERT_FUNCTION
-#endif
\ No newline at end of file
+#endif
Modified: sandbox/boost/reflection/reflector.hpp
==============================================================================
--- sandbox/boost/reflection/reflector.hpp (original)
+++ sandbox/boost/reflection/reflector.hpp 2007-09-12 22:22:04 EDT (Wed, 12 Sep 2007)
@@ -24,7 +24,9 @@
BOOST_PP_ENUM_PARAMS(N, class Param)> \
void reflect_constructor() { \
add_constructor<ParamFirst BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param)>(&construct); \
+ BOOST_PP_ENUM_PARAMS(N, Param)>(&construct<T, ParamFirst \
+ BOOST_PP_COMMA_IF(N) \
+ BOOST_PP_ENUM_PARAMS(N, Param)>); \
}
#define BOOST_REFLECTION_REFLECTOR_REFLECT_FUNCTION(Z, N, _) \
template <class ReturnValue BOOST_PP_COMMA_IF(N) \
@@ -36,7 +38,7 @@
::get_class_type(), info); \
ReturnValue (*f2)(void *, MemberFunctionPtr BOOST_PP_COMMA_IF(N) \
BOOST_PP_ENUM_PARAMS(N, Param)) = \
- &call_member<ReturnValue BOOST_PP_COMMA_IF(N) \
+ &call_member<T, ReturnValue BOOST_PP_COMMA_IF(N) \
BOOST_PP_ENUM_PARAMS(N, Param)>; \
std::pair<MemberFunctionPtr, FunctionPtr> \
p(reinterpret_cast<MemberFunctionPtr>(func), \
@@ -58,16 +60,14 @@
reinterpret_cast<FunctionPtr>(func))); \
}
#define BOOST_REFLECTION_REFLECTOR_CONSTRUCT_FUNCTION(Z, N, _) \
-template <class ParamFirst BOOST_PP_COMMA_IF(N) \
+template <class T BOOST_PP_COMMA_IF(N) \
BOOST_PP_ENUM_PARAMS(N, class Param)> \
-static instance construct(ParamFirst pf BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) { \
- return instance(static_cast<void*>(new T(pf BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, p))), \
- &destruct); \
+instance construct(BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) { \
+ return instance(static_cast<void*>(new T(BOOST_PP_ENUM_PARAMS(N, p))), \
+ &destruct<T>); \
}
#define BOOST_REFLECTION_REFLECTOR_CALL_MEMBER_FUNCTION(Z, N, _) \
-template <class ReturnValue BOOST_PP_COMMA_IF(N) \
+template <class T, class ReturnValue BOOST_PP_COMMA_IF(N) \
BOOST_PP_ENUM_PARAMS(N, class Param)> \
static ReturnValue call_member(void * val, \
MemberFunctionPtr member_function \
@@ -79,6 +79,16 @@
(member_function); \
return (actual->*func)(BOOST_PP_ENUM_PARAMS(N, p)); \
}
+template <class T>
+void destruct(void * val) {
+ delete static_cast<T*>(val);
+}
+BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS), \
+ BOOST_REFLECTION_REFLECTOR_CONSTRUCT_FUNCTION, _)
+BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS), \
+ BOOST_REFLECTION_REFLECTOR_CALL_MEMBER_FUNCTION, _)
+
+
template <class T, class Info = std::string,
class TypeInfo = extensions::default_type_info>
@@ -92,7 +102,7 @@
}
typedef basic_function_info<Info, TypeInfo> function_info;
void reflect_constructor() {
- add_constructor(&construct);
+ add_constructor(&construct<T>);
}
BOOST_PP_REPEAT(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS, \
BOOST_REFLECTION_REFLECTOR_REFLECT_CONSTRUCTOR_FUNCTION, _)
@@ -118,24 +128,6 @@
}
BOOST_PP_REPEAT(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS, \
BOOST_REFLECTION_REFLECTOR_ADD_CONSTRUCTOR_FUNCTION, _)
- static instance construct() {
- return instance(static_cast<void*>(new T()), &destruct);
- }
- BOOST_PP_REPEAT(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS, \
- BOOST_REFLECTION_REFLECTOR_CONSTRUCT_FUNCTION, _)
- /* template <class ReturnValue>
- static ReturnValue call_member(void * val,
- MemberFunctionPtr member_function) {
- T * actual = static_cast<T*>(val);
- ReturnValue (T::*func)() =
- reinterpret_cast<ReturnValue (T::*)()>(member_function);
- return (actual->*func)();
- }*/
- BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS), \
- BOOST_REFLECTION_REFLECTOR_CALL_MEMBER_FUNCTION, _)
- static void destruct(void * val) {
- delete static_cast<T*>(val);
- }
basic_reflection<Info, TypeInfo> * reflection_;
};
#undef BOOST_REFLECTION_REFLECTOR_REFLECT_CONSTRUCTOR_FUNCTION
Modified: sandbox/libs/extension/test/multiple_inheritance_test.cpp
==============================================================================
--- sandbox/libs/extension/test/multiple_inheritance_test.cpp (original)
+++ sandbox/libs/extension/test/multiple_inheritance_test.cpp 2007-09-12 22:22:04 EDT (Wed, 12 Sep 2007)
@@ -43,17 +43,18 @@
// less descriptive
// check if the libraries can be loaded
- shared_library libVehicle((std::string("libVehicle")
+ shared_library libVehicle((std::string("../bin/libVehicle")
+ ".extension").c_str());
- shared_library libCar((std::string("libCar") + ".extension").c_str());
- shared_library libComputer((std::string("libComputer")
+ shared_library libCar((std::string("../bin/libCar") + ".extension").c_str());
+ shared_library libComputer((std::string("../bin/libComputer")
+ ".extension").c_str());
- shared_library libBoat((std::string("libBoat") + ".extension").c_str());
- shared_library libFlyingCar((std::string("libFlyingCar")
+ shared_library libBoat((std::string("../bin/libBoat") + ".extension").c_str());
+ shared_library libFlyingCar((std::string("../bin/libFlyingCar")
+ ".extension").c_str());
- shared_library libCarOfTheFuture((std::string("libCarOfTheFuture")
+ shared_library libCarOfTheFuture((std::string("../bin/libCarOfTheFuture")
+ ".extension").c_str());
- shared_library libPlane((std::string("libPlane") + ".extension").c_str());
+ shared_library libPlane((std::string("../bin/libPlane")
+ + ".extension").c_str());
BOOST_CHECK_EQUAL( libVehicle.open(), true );
BOOST_CHECK_EQUAL( libCar.open(), true );
BOOST_CHECK_EQUAL( libComputer.open(), true );
Modified: sandbox/libs/extension/test/parameters_test.cpp
==============================================================================
--- sandbox/libs/extension/test/parameters_test.cpp (original)
+++ sandbox/libs/extension/test/parameters_test.cpp 2007-09-12 22:22:04 EDT (Wed, 12 Sep 2007)
@@ -25,7 +25,8 @@
BOOST_AUTO_TEST_CASE(parameters_example)
{
// check if the library can be loaded
- shared_library l((std::string("libParametersLib") + ".extension").c_str());
+ shared_library l((std::string("../bin/libParametersLib")
+ + ".extension").c_str());
BOOST_CHECK_EQUAL( l.open(), true );
// check if the factory can return the functor
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