From eeed3ade012a6352ed224eefb18840150c1b47d2 Mon Sep 17 00:00:00 2001 From: Benjamin Elbers Date: Tue, 19 Sep 2023 13:59:52 +0200 Subject: [PATCH] use std::string instead of String --- src/RcppExports.cpp | 6 +++--- src/compression.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 87fd8e8..841a4da 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -27,13 +27,13 @@ BEGIN_RCPP END_RCPP } // get_crosswalk_cpp -List get_crosswalk_cpp(StringVector old_unit, StringVector new_unit); +List get_crosswalk_cpp(std::vector old_unit, std::vector new_unit); RcppExport SEXP _segregation_get_crosswalk_cpp(SEXP old_unitSEXP, SEXP new_unitSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< StringVector >::type old_unit(old_unitSEXP); - Rcpp::traits::input_parameter< StringVector >::type new_unit(new_unitSEXP); + Rcpp::traits::input_parameter< std::vector >::type old_unit(old_unitSEXP); + Rcpp::traits::input_parameter< std::vector >::type new_unit(new_unitSEXP); rcpp_result_gen = Rcpp::wrap(get_crosswalk_cpp(old_unit, new_unit)); return rcpp_result_gen; END_RCPP diff --git a/src/compression.cpp b/src/compression.cpp index a1f0dae..e66e922 100644 --- a/src/compression.cpp +++ b/src/compression.cpp @@ -309,7 +309,7 @@ List compress_compute_cpp( _["new_unit"] = results.new_unit); } -int find_in_sets(String needle, std::vector> haystack) +int find_in_sets(std::string needle, std::vector> haystack) { for (int i = 0; i < haystack.size(); i++) { @@ -321,9 +321,9 @@ int find_in_sets(String needle, std::vector> haystack) } // [[Rcpp::export]] -List get_crosswalk_cpp(StringVector old_unit, StringVector new_unit) +List get_crosswalk_cpp(std::vector old_unit, std::vector new_unit) { - std::vector> bags; + std::vector> bags; for (int i = 0; i < old_unit.size(); i++) { @@ -357,7 +357,7 @@ List get_crosswalk_cpp(StringVector old_unit, StringVector new_unit) List l(bags.size()); for (int i = 0; i < bags.size(); i++) { - StringVector bag(bags[i].size()); + std::vector bag(bags[i].size()); int index = 0; for (auto el : bags[i]) {