rice/Constructor.hpp in rice-3.0.0 vs rice/Constructor.hpp in rice-4.0.0
- old
+ new
@@ -1,13 +1,11 @@
#ifndef Rice__Constructor__hpp_
#define Rice__Constructor__hpp_
-// This causes problems with certain C++ libraries
-#undef TYPE
+#include "detail/Wrapper.hpp"
+#include "cpp_api/Object_defn.hpp"
-#include "to_from_ruby_defn.hpp"
-
namespace Rice
{
//! Define a Type's Constructor and it's arguments.
/*! E.g. for the default constructor on a Type:
\code
@@ -19,29 +17,29 @@
* Afterwards any extra types must match the appropriate constructor
* to be used in C++ when constructing the object.
*
* For more information, see Rice::Data_Type::define_constructor.
*/
- template<typename T, typename ...Arg_T>
+ template<typename T, typename...Arg_Ts>
class Constructor
{
public:
- static void construct(Object self, Arg_T... args)
+ static void construct(VALUE self, Arg_Ts...args)
{
- DATA_PTR(self.value()) = new T(args...);
+ T* data = new T(args...);
+ detail::replace<T>(self, Data_Type<T>::rb_type(), data, true);
}
};
//! Special-case Constructor used when defining Directors.
- template<typename T, typename ...Arg_T>
- class Constructor<T, Object, Arg_T...>
+ template<typename T, typename...Arg_Ts>
+ class Constructor<T, Object, Arg_Ts...>
{
public:
- static void construct(Object self, Arg_T... args)
+ static void construct(Object self, Arg_Ts...args)
{
- DATA_PTR(self.value()) = new T(self, args...);
+ T* data = new T(self, args...);
+ detail::replace<T>(self.value(), Data_Type<T>::rb_type(), data, true);
}
};
}
-
-#endif
-
+#endif // Rice__Constructor__hpp_
\ No newline at end of file