-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpriority_queue.cpp
More file actions
59 lines (58 loc) · 2.83 KB
/
priority_queue.cpp
File metadata and controls
59 lines (58 loc) · 2.83 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
// [[Rcpp::plugins(cpp20)]]
#include <Rcpp.h>
#include <queue>
#include <string>
#include <vector>
#include <functional>
// [[Rcpp::export]]
Rcpp::XPtr<std::priority_queue<int> > priority_queue_i_d(Rcpp::IntegerVector& v) {
std::priority_queue<int>* s = new std::priority_queue<int>(v.begin(), v.end());
Rcpp::XPtr<std::priority_queue<int> > p(s);
return p;
}
// [[Rcpp::export]]
Rcpp::XPtr<std::priority_queue<double> > priority_queue_d_d(Rcpp::NumericVector& v) {
std::priority_queue<double>* s = new std::priority_queue<double>(v.begin(), v.end());
Rcpp::XPtr<std::priority_queue<double> > p(s);
return p;
}
// [[Rcpp::export]]
Rcpp::XPtr<std::priority_queue<std::string> > priority_queue_s_d(Rcpp::CharacterVector& v) {
std::priority_queue<std::string>* s = new std::priority_queue<std::string>(v.begin(), v.end());
Rcpp::XPtr<std::priority_queue<std::string> > p(s);
return p;
}
// [[Rcpp::export]]
Rcpp::XPtr<std::priority_queue<bool> > priority_queue_b_d(Rcpp::LogicalVector& v) {
std::priority_queue<bool>* s = new std::priority_queue<bool>(v.begin(), v.end());
Rcpp::XPtr<std::priority_queue<bool> > p(s);
return p;
}
// [[Rcpp::export]]
Rcpp::XPtr<std::priority_queue<int, std::vector<int>, std::greater<int> > > priority_queue_i_a(Rcpp::IntegerVector& v) {
std::priority_queue<int, std::vector<int>, std::greater<int> >* s = new std::priority_queue<int, std::vector<int>, std::greater<int> >(v.begin(),
v.end());
Rcpp::XPtr<std::priority_queue<int, std::vector<int>, std::greater<int> > > p(s);
return p;
}
// [[Rcpp::export]]
Rcpp::XPtr<std::priority_queue<double, std::vector<double>, std::greater<double> > > priority_queue_d_a(Rcpp::NumericVector& v) {
std::priority_queue<double, std::vector<double>, std::greater<double> >* s = new std::priority_queue<double, std::vector<double>,
std::greater<double> >(v.begin(), v.end());
Rcpp::XPtr<std::priority_queue<double, std::vector<double>, std::greater<double> > > p(s);
return p;
}
// [[Rcpp::export]]
Rcpp::XPtr<std::priority_queue<std::string, std::vector<std::string>, std::greater<std::string> > > priority_queue_s_a(Rcpp::CharacterVector& v) {
std::priority_queue<std::string, std::vector<std::string>, std::greater<std::string> >* s = new std::priority_queue<std::string,
std::vector<std::string>, std::greater<std::string> >(v.begin(), v.end());
Rcpp::XPtr<std::priority_queue<std::string, std::vector<std::string>, std::greater<std::string> > > p(s);
return p;
}
// [[Rcpp::export]]
Rcpp::XPtr<std::priority_queue<bool, std::vector<bool>, std::greater<bool> > > priority_queue_b_a(Rcpp::LogicalVector& v) {
std::priority_queue<bool, std::vector<bool>, std::greater<bool> >* s = new std::priority_queue<bool, std::vector<bool>, std::greater<bool> >(v.begin(),
v.end());
Rcpp::XPtr<std::priority_queue<bool, std::vector<bool>, std::greater<bool> > > p(s);
return p;
}