Skip to content

Commit cc6abcc

Browse files
cleaning up as_module_object
1 parent fbc5be7 commit cc6abcc

5 files changed

Lines changed: 3 additions & 34 deletions

File tree

inst/include/Rcpp/Module.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,6 @@ namespace Rcpp{
5858
T* ptr;
5959
} ;
6060

61-
template <typename T>
62-
class object {
63-
public:
64-
typedef T object_type ;
65-
object( T* ptr_ ) : ptr(ptr_){}
66-
operator T*(){ return ptr ; }
67-
T* operator->(){ return ptr ; }
68-
T& operator&(){ return *ptr ; }
69-
T* ptr ;
70-
} ;
71-
7261
namespace internal {
7362
template <typename Class>
7463
SEXP make_new_object( Class* ptr ){

inst/include/Rcpp/api/meat/meat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <Rcpp/api/meat/Matrix.h>
3030
#include <Rcpp/api/meat/Reference.h>
3131
#include <Rcpp/api/meat/is.h>
32+
#include <Rcpp/api/meat/as.h>
3233
#include <Rcpp/api/meat/export.h>
3334
#include <Rcpp/api/meat/wrap.h>
3435

inst/include/Rcpp/as.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,10 @@ namespace Rcpp{
7676
return exporter.get() ;
7777
}
7878

79-
void* as_module_object_internal(SEXP) ;
80-
template <typename T> object<T> as_module_object(SEXP x){
81-
return (T*) as_module_object_internal(x) ;
82-
}
79+
template <typename T> T* as_module_object(SEXP x) ;
8380

84-
/** handling object<T> */
8581
template <typename T> T as(SEXP x, ::Rcpp::traits::r_type_module_object_const_pointer_tag ) {
86-
typedef typename std::remove_const<T>::type T_NON_CONST ;
87-
return const_cast<T>( (T_NON_CONST)as_module_object_internal(x) ) ;
82+
return const_cast<T>( as_module_object< typename std::remove_const<T>::type >( x ) ) ;
8883
}
8984

9085
template <typename T> T as(SEXP x, ::Rcpp::traits::r_type_module_object_pointer_tag ) {

inst/include/Rcpp/traits/wrap_type_traits.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ struct wrap_type_primitive_tag{};
3232
* unknown. Implicit conversion to SEXP will be tried.
3333
*/
3434
struct wrap_type_unknown_tag{};
35-
36-
/**
37-
* module objects pointers (object<T>). conversion done using make_new_object<>()
38-
*/
39-
struct wrap_type_module_object_pointer_tag{} ;
4035

4136
/**
4237
* declared module object type (by the RCPP_EXPOSED_CLASS macro)
@@ -88,9 +83,6 @@ template <> struct wrap_type_traits<long double> { typedef wrap_type_primitive_t
8883
template <> struct wrap_type_traits<short> { typedef wrap_type_primitive_tag wrap_category; } ;
8984
template <> struct wrap_type_traits<unsigned short> { typedef wrap_type_primitive_tag wrap_category; } ;
9085

91-
template <typename T> struct wrap_type_traits< Rcpp::object<T> > { typedef wrap_type_module_object_pointer_tag wrap_category; } ;
92-
93-
9486
} // namespace traits
9587
} // namespace Rcpp
9688
#endif

src/Module.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,5 @@ namespace Rcpp{
495495
return it->second ;
496496
}
497497

498-
namespace internal{
499-
void* as_module_object_internal(SEXP obj){
500-
Environment env(obj) ;
501-
SEXP xp = env.get(".pointer") ;
502-
return R_ExternalPtrAddr(xp );
503-
}
504-
}
505-
506498
}
507499

0 commit comments

Comments
 (0)