Skip to content

Commit 3024f1f

Browse files
generic_proxy moves to its own file
1 parent 6d57868 commit 3024f1f

File tree

2 files changed

+2
-65
lines changed

2 files changed

+2
-65
lines changed

inst/include/Rcpp/Vector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ template <int RTYPE> class SubMatrix ;
6363
#include <Rcpp/vector/string_proxy.h>
6464
#include <Rcpp/vector/const_string_proxy.h>
6565
}
66+
67+
#include <Rcpp/vector/generic_proxy.h>
6668
#include <Rcpp/vector/const_generic_proxy.h>
6769

6870

inst/include/Rcpp/vector/string_proxy.h

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -240,71 +240,6 @@ namespace internal{
240240
return x + static_cast<const char*>(y) ;
241241
}
242242

243-
template <int RTYPE>
244-
class generic_proxy{
245-
public:
246-
typedef typename ::Rcpp::Vector<RTYPE> VECTOR ;
247-
248-
generic_proxy(): parent(0), index(-1){}
249-
250-
generic_proxy( const generic_proxy& other ) :
251-
parent(other.parent), index(other.index){} ;
252-
253-
generic_proxy( VECTOR& v, int i ) : parent(&v), index(i){} ;
254-
255-
generic_proxy& operator=(SEXP rhs) {
256-
set(rhs) ;
257-
return *this ;
258-
}
259-
260-
generic_proxy& operator=(const generic_proxy& rhs) {
261-
set(rhs.get());
262-
return *this ;
263-
}
264-
265-
template <typename T>
266-
generic_proxy& operator=( const T& rhs){
267-
set(wrap(rhs)) ;
268-
return *this;
269-
}
270-
271-
operator SEXP() const {
272-
return get() ;
273-
}
274-
275-
template <typename U> operator U() const {
276-
return ::Rcpp::as<U>(get()) ;
277-
}
278-
279-
// helping the compiler (not sure why it can't help itself)
280-
operator bool() const { return ::Rcpp::as<bool>(get()) ; }
281-
operator int() const { return ::Rcpp::as<int>(get()) ; }
282-
283-
void swap(generic_proxy& other){
284-
Shield<SEXP> tmp(get()) ;
285-
set( other.get() ) ;
286-
other.set(tmp) ;
287-
}
288-
289-
VECTOR* parent;
290-
int index ;
291-
inline void move(int n) { index += n ; }
292-
293-
void import( const generic_proxy& other){
294-
parent = other.parent ;
295-
index = other.index ;
296-
}
297-
298-
private:
299-
inline void set(SEXP x) {
300-
SET_VECTOR_ELT( *parent, index, x ) ;
301-
}
302-
inline SEXP get() const {
303-
return VECTOR_ELT(*parent, index );
304-
}
305-
306-
} ;
307-
308243
}
309244

310245
#endif

0 commit comments

Comments
 (0)