File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 112013-09-15 Dirk Eddelbuettel <edd@debian.org>
22
3+ * inst/include/Rcpp/InputParameter.h (Rcpp): Add 'const' case
4+
35 * inst/unitTests/cpp/Vector.cpp: New unit tests for std::vector
46 conversions, using both int and double arguments
57 * inst/unitTests/runit.Vector.R: R complement of these tests
Original file line number Diff line number Diff line change @@ -50,6 +50,19 @@ namespace Rcpp {
5050 private:
5151 T obj ;
5252 } ;
53+
54+ // same for const
55+ template <typename T>
56+ class ConstInputParameter {
57+ public:
58+ typedef const T const_nonref ;
59+ ConstInputParameter (SEXP x_) : obj( as<T>(x_) ){}
60+
61+ inline operator const_nonref () { return obj ; }
62+
63+ private:
64+ T obj ;
65+ } ;
5366
5467 // same for const references
5568 template <typename T>
@@ -74,6 +87,10 @@ namespace Rcpp {
7487 typedef typename Rcpp::ReferenceInputParameter<T> type ;
7588 } ;
7689 template <typename T>
90+ struct input_parameter <const T> {
91+ typedef typename Rcpp::ConstInputParameter<T> type ;
92+ } ;
93+ template <typename T>
7794 struct input_parameter <const T&> {
7895 typedef typename Rcpp::ConstReferenceInputParameter<T> type ;
7996 } ;
You can’t perform that action at this time.
0 commit comments