-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathSugarMatrixExpression.h
More file actions
32 lines (24 loc) · 942 Bytes
/
SugarMatrixExpression.h
File metadata and controls
32 lines (24 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef Rcpp__vector__SugarMatrixExpression_h
#define Rcpp__vector__SugarMatrixExpression_h
namespace Rcpp{
namespace sugar{
struct custom_sugar_matrix_expression{} ;
}
template <typename eT, typename Expr>
struct SugarMatrixExpression :
public SugarMatrixExpressionBase,
public CRTP<Expr>
{
using CRTP<Expr>::get_ref;
typedef Expr expr_type ;
typedef eT value_type ;
typedef typename std::integral_constant<int, traits::r_sexptype_traits<eT>::rtype >::type r_type ;
template <typename Target>
void apply( Target& target ) const ;
inline int nrow() const { return get_ref().nrow(); }
inline int ncol() const { return get_ref().ncol(); }
inline int size() const { return get_ref().size(); }
inline eT operator()(int i, int j) const { return get_ref()(i,j) ; }
} ;
}
#endif