-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathstorage_type.h
More file actions
60 lines (51 loc) · 1.13 KB
/
storage_type.h
File metadata and controls
60 lines (51 loc) · 1.13 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef Rcpp__traits__storage_type__h
#define Rcpp__traits__storage_type__h
namespace Rcpp{
namespace traits{
/**
* Indicates the storage type associated with a SEXP type
* for example: storage_type<INTSXP>::type is a typedef to int
*
* The default is SEXP, which works for VECSXP, EXPRSXP and STRSXP
*/
template<int RTYPE> struct storage_type{
typedef SEXP type ;
} ;
/**
* Total specialization for integer vector (INTSXP)
* typedef to int
*/
template<> struct storage_type<INTSXP>{
typedef int type ;
} ;
/**
* Total specialization for numeric vectors (REALSXP)
* typedef to double
*/
template<> struct storage_type<REALSXP>{
typedef double type ;
} ;
/**
* Total specialization for numeric vectors (CPLXSXP)
* typedef to Rcomplex
*/
template<> struct storage_type<CPLXSXP>{
typedef Rcomplex type ;
} ;
/**
* Total specialization for raw vectors (RAWSXP)
* typedef to Rbyte
*/
template<> struct storage_type<RAWSXP>{
typedef Rbyte type ;
} ;
/**
* Total specialization for logical vectors (LGLSXP)
* typedef to int
*/
template<> struct storage_type<LGLSXP>{
typedef int type ;
} ;
} // traits
} // Rcpp
#endif