-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathString.cpp
More file actions
59 lines (48 loc) · 1.2 KB
/
String.cpp
File metadata and controls
59 lines (48 loc) · 1.2 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
#include <Rcpp.h>
using namespace Rcpp ;
// [[Rcpp::export]]
List test_compare_Strings( String aa, String bb ){
return List::create(
_["a < b" ] = aa < bb,
_["a > b" ] = aa > bb,
_["a == b"] = aa == bb,
_["a == a"] = aa == aa
) ;
}
// [[Rcpp::export]]
CharacterVector CharacterVector_wstring( ){
CharacterVector res(2) ;
res[0] = L"foo" ;
res[0] += L"bar" ;
res[1] = std::wstring( L"foo" ) ;
res[1] += std::wstring( L"bar" ) ;
return res ;
}
// [[Rcpp::export]]
std::wstring wstring_return(){
return L"foo" ;
}
// [[Rcpp::export]]
String wstring_param(std::wstring s1, std::wstring s2){
String s = s1 ;
s += s2 ;
return s ;
}
// [[Rcpp::export]]
std::vector<std::wstring> wrap_vector_wstring(){
std::vector<std::wstring> res(2 );
res[0] = L"foo" ;
res[1] = L"bar" ;
return res;
}
// [[Rcpp::export]]
bool String_encoding_equality(String a, String b){
return a == b ;
}
// [[Rcpp::export]]
std::vector<std::wstring> as_vector_wstring( std::vector<std::wstring> x){
for( size_t i=0; i<x.size(); i++){
x[i] += L"€" ;
}
return x ;
}