Rcpp Version 1.0.14
Loading...
Searching...
No Matches
Vector.h
Go to the documentation of this file.
1// Vector.h: Rcpp R/C++ interface class library -- vectors
2//
3// Copyright (C) 2010 - 2024 Dirk Eddelbuettel and Romain Francois
4//
5// This file is part of Rcpp.
6//
7// Rcpp is free software: you can redistribute it and/or modify it
8// under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 2 of the License, or
10// (at your option) any later version.
11//
12// Rcpp is distributed in the hope that it will be useful, but
13// WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
19
20#ifndef Rcpp__vector__Vector_h
21#define Rcpp__vector__Vector_h
22
24
25namespace Rcpp{
26
27template <int RTYPE, template <class> class StoragePolicy = PreserveStorage >
28class Vector :
29 public StoragePolicy< Vector<RTYPE,StoragePolicy> >,
30 public SlotProxyPolicy< Vector<RTYPE,StoragePolicy> >,
31 public AttributeProxyPolicy< Vector<RTYPE,StoragePolicy> >,
32 public NamesProxyPolicy< Vector<RTYPE, StoragePolicy> >,
33 public RObjectMethods< Vector<RTYPE, StoragePolicy> >,
34 public VectorBase< RTYPE, true, Vector<RTYPE,StoragePolicy> >
35{
36public:
37
39
50
56 Storage::set__( Rf_allocVector(RTYPE, 0 ) );
57 init() ;
58 }
59
64 Storage::copy__(other) ;
65 }
66
67 Vector& operator=(const Vector& rhs) {
68 return Storage::copy__(rhs) ;
69 }
70
71 Vector( SEXP x ) {
73 Storage::set__( r_cast<RTYPE>(safe) ) ;
74 }
75
76 template <typename Proxy>
77 Vector( const GenericProxy<Proxy>& proxy ){
79 Storage::set__( r_cast<RTYPE>(safe) ) ;
80 }
81
82 explicit Vector( const no_init_vector& obj) {
83 Storage::set__( Rf_allocVector( RTYPE, obj.get() ) ) ;
84 }
85
86 template<typename T>
87 Vector( const T& size, const stored_type& u,
89 RCPP_DEBUG_2( "Vector<%d>( const T& size = %d, const stored_type& u )", RTYPE, size)
90 Storage::set__( Rf_allocVector( RTYPE, size) ) ;
91 fill( u ) ;
92 }
93
94 Vector( const int& size, const stored_type& u) {
95 RCPP_DEBUG_2( "Vector<%d>( const int& size = %d, const stored_type& u )", RTYPE, size)
96 Storage::set__( Rf_allocVector( RTYPE, size) ) ;
97 fill( u ) ;
98 }
99
100 // constructor for CharacterVector()
101 Vector( const std::string& st ){
102 RCPP_DEBUG_2( "Vector<%d>( const std::string& = %s )", RTYPE, st.c_str() )
103 Storage::set__( internal::vector_from_string<RTYPE>(st) ) ;
104 }
105
106 // constructor for CharacterVector()
107 Vector( const char* st ) {
108 RCPP_DEBUG_2( "Vector<%d>( const char* = %s )", RTYPE, st )
109 Storage::set__(internal::vector_from_string<RTYPE>(st) ) ;
110 }
111
112 template<typename T>
113 Vector( const T& siz, stored_type (*gen)(void),
114 typename Rcpp::traits::enable_if<traits::is_arithmetic<T>::value, void>::type* = 0) {
115 RCPP_DEBUG_2( "Vector<%d>( const int& siz = %s, stored_type (*gen)(void) )", RTYPE, siz )
116 Storage::set__( Rf_allocVector( RTYPE, siz) ) ;
117 std::generate( begin(), end(), gen );
118 }
119
120 // Add template class T and then restict T to arithmetic.
121 template <typename T>
123 typename Rcpp::traits::enable_if<traits::is_arithmetic<T>::value, void>::type* = 0) {
124 Storage::set__( Rf_allocVector( RTYPE, size) ) ;
125 init() ;
126 }
127
128 Vector( const int& size ) {
129 Storage::set__( Rf_allocVector( RTYPE, size) ) ;
130 init() ;
131 }
132
134 Storage::set__( Rf_allocVector( RTYPE, dims.prod() ) ) ;
135 init() ;
136 if( dims.size() > 1 ){
138 }
139 }
140
141 // Enable construction from bool for LogicalVectors
142 // SFINAE only work for template. Add template class T and then restict T to
143 // bool.
144 template <typename T>
145 Vector(T value,
146 typename Rcpp::traits::enable_if<traits::is_bool<T>::value && RTYPE == LGLSXP, void>::type* = 0) {
147 Storage::set__(Rf_allocVector(RTYPE, 1));
148 fill(value);
149 }
150
151 template <typename U>
152 Vector( const Dimension& dims, const U& u) {
153 RCPP_DEBUG_2( "Vector<%d>( const Dimension& (%d), const U& )", RTYPE, dims.size() )
154 Storage::set__( Rf_allocVector( RTYPE, dims.prod() ) ) ;
155 fill(u) ;
156 if( dims.size() > 1 ){
158 }
159 }
160
161 template <bool NA, typename VEC>
163 RCPP_DEBUG_2( "Vector<%d>( const VectorBase<RTYPE,NA,VEC>& ) [VEC = %s]", RTYPE, DEMANGLE(VEC) )
165 }
166
167 template <typename T, typename U>
168 Vector( const T& size, const U& u,
169 typename Rcpp::traits::enable_if<traits::is_arithmetic<T>::value, void>::type* = 0) {
170 RCPP_DEBUG_2( "Vector<%d>( const T& size, const U& u )", RTYPE, size )
171 Storage::set__( Rf_allocVector( RTYPE, size) ) ;
173 }
174
175 template <bool NA, typename T>
177 Rcpp::Shield<SEXP> safe(const_cast<sugar::SingleLogicalResult<NA,T>&>(obj).get_sexp() );
178 Storage::set__( r_cast<RTYPE>(safe) ) ;
179 RCPP_DEBUG_2( "Vector<%d>( const sugar::SingleLogicalResult<NA,T>& ) [T = %s]", RTYPE, DEMANGLE(T) )
180 }
181
182 template <typename T, typename U1>
183 Vector( const T& siz, stored_type (*gen)(U1), const U1& u1,
184 typename Rcpp::traits::enable_if<traits::is_arithmetic<T>::value, void>::type* = 0) {
185 Storage::set__( Rf_allocVector( RTYPE, siz) ) ;
186 RCPP_DEBUG_2( "const T& siz, stored_type (*gen)(U1), const U1& u1 )", RTYPE, siz )
187 iterator first = begin(), last = end() ;
188 while( first != last ) *first++ = gen(u1) ;
189 }
190
191 template <typename T, typename U1, typename U2>
192 Vector( const T& siz, stored_type (*gen)(U1,U2), const U1& u1, const U2& u2,
193 typename Rcpp::traits::enable_if<traits::is_arithmetic<T>::value, void>::type* = 0) {
194 Storage::set__( Rf_allocVector( RTYPE, siz) ) ;
195 RCPP_DEBUG_2( "const T& siz, stored_type (*gen)(U1,U2), const U1& u1, const U2& u2)", RTYPE, siz )
196 iterator first = begin(), last = end() ;
197 while( first != last ) *first++ = gen(u1,u2) ;
198 }
199
200 template <typename T, typename U1, typename U2, typename U3>
201 Vector( const T& siz, stored_type (*gen)(U1,U2,U3), const U1& u1, const U2& u2, const U3& u3,
202 typename Rcpp::traits::enable_if<traits::is_arithmetic<T>::value, void>::type* = 0) {
203 Storage::set__( Rf_allocVector( RTYPE, siz) ) ;
204 RCPP_DEBUG_2( "const T& siz, stored_type (*gen)(U1,U2,U3), const U1& u1, const U2& u2, const U3& u3)", RTYPE, siz )
205 iterator first = begin(), last = end() ;
206 while( first != last ) *first++ = gen(u1,u2,u3) ;
207 }
208
209 template <typename InputIterator>
211 RCPP_DEBUG_1( "Vector<%d>( InputIterator first, InputIterator last", RTYPE )
212 Storage::set__( Rf_allocVector(RTYPE, std::distance(first, last) ) ) ;
213 std::copy( first, last, begin() ) ;
214 }
215
216 template <typename InputIterator, typename T>
218 typename Rcpp::traits::enable_if<traits::is_arithmetic<T>::value, void>::type* = 0) {
219 Storage::set__(Rf_allocVector(RTYPE, n)) ;
220 RCPP_DEBUG_2( "Vector<%d>( InputIterator first, InputIterator last, T n = %d)", RTYPE, n )
221 std::copy( first, last, begin() ) ;
222 }
223
224 template <typename InputIterator, typename Func>
226 Storage::set__( Rf_allocVector( RTYPE, std::distance(first,last) ) );
227 RCPP_DEBUG_1( "Vector<%d>( InputIterator, InputIterator, Func )", RTYPE )
228 std::transform( first, last, begin(), func) ;
229 }
230
231 template <typename InputIterator, typename Func, typename T>
234 Storage::set__( Rf_allocVector( RTYPE, n ) );
235 RCPP_DEBUG_2( "Vector<%d>( InputIterator, InputIterator, Func, T n = %d )", RTYPE, n )
236 std::transform( first, last, begin(), func) ;
237 }
238
239#ifdef HAS_CXX0X_INITIALIZER_LIST
240 Vector( std::initializer_list<init_type> list ) {
241 assign( list.begin() , list.end() ) ;
242 }
243#endif
244
245 template <typename T>
246 Vector& operator=( const T& x) {
248 return *this ;
249 }
250
251 static inline stored_type get_na() {
252 return traits::get_na<RTYPE>();
253 }
254 static inline bool is_na( stored_type x){
255 return traits::is_na<RTYPE>(x);
256 }
257
258 #ifdef RCPP_COMMA_INITIALIZATION
260 iterator start = begin() ; *start = x;
262 }
263 #endif
264
268 inline R_xlen_t length() const {
269 return ::Rf_xlength( Storage::get__() ) ;
270 }
271
275 inline R_xlen_t size() const {
276 return ::Rf_xlength( Storage::get__() ) ;
277 }
278
282 R_xlen_t offset(const int& i, const int& j) const {
283 if( !::Rf_isMatrix(Storage::get__()) ) throw not_a_matrix() ;
284
285 /* we need to extract the dimensions */
286 const int* dim = dims() ;
287 const int nrow = dim[0] ;
288 const int ncol = dim[1] ;
289 if(i < 0|| i >= nrow || j < 0 || j >= ncol ) {
290 const char* fmt = "Location index is out of bounds: "
291 "[row index=%i; row extent=%i; "
292 "column index=%i; column extent=%i].";
293 throw index_out_of_bounds(fmt, i, nrow, j, ncol);
294 }
295 return i + static_cast<R_xlen_t>(nrow)*j ;
296 }
297
302 R_xlen_t offset(const R_xlen_t& i) const { // #nocov start
303 if(i < 0 || i >= ::Rf_xlength(Storage::get__()) ) {
304 const char* fmt = "Index out of bounds: [index=%i; extent=%i].";
305 throw index_out_of_bounds(fmt, i, ::Rf_xlength(Storage::get__()) ) ;
306 }
307 return i ; // #nocov end
308 }
309
310 R_xlen_t offset(const std::string& name) const {
311 SEXP names = RCPP_GET_NAMES( Storage::get__() ) ;
312 if( Rf_isNull(names) ) {
313 throw index_out_of_bounds("Object was created without names.");
314 }
315
316 R_xlen_t n=size() ;
317 for( R_xlen_t i=0; i<n; ++i){
318 if( ! name.compare( CHAR(STRING_ELT(names, i)) ) ){
319 return i ;
320 }
321 }
322
323 const char* fmt = "Index out of bounds: [index='%s'].";
324 throw index_out_of_bounds(fmt, name);
325 return -1 ; /* -Wall */
326 }
327
328 template <typename U>
329 void fill( const U& u){
331 }
332
333 inline iterator begin() { return cache.get() ; }
334 inline iterator end() { return cache.get() + size(); }
335 inline const_iterator begin() const{ return cache.get_const() ; }
336 inline const_iterator end() const{ return cache.get_const() + size() ; }
337 inline const_iterator cbegin() const{ return cache.get_const() ; }
338 inline const_iterator cend() const{ return cache.get_const() + size() ; }
339
340 inline Proxy operator[]( R_xlen_t i ){ return cache.ref(i) ; }
341 inline const_Proxy operator[]( R_xlen_t i ) const { return cache.ref(i) ; }
342
343 inline Proxy operator()( const size_t& i) {
344 return cache.ref( offset(i) ) ;
345 }
346 inline const_Proxy operator()( const size_t& i) const {
347 return cache.ref( offset(i) ) ;
348 }
349
350 inline Proxy at( const size_t& i) {
351 return cache.ref( offset(i) ) ;
352 }
353 inline const_Proxy at( const size_t& i) const { // #nocov start
354 return cache.ref( offset(i) ) ;
355 } // #nocov end
356
357 inline Proxy operator()( const size_t& i, const size_t& j) {
358 return cache.ref( offset(i,j) ) ;
359 }
360 inline const_Proxy operator()( const size_t& i, const size_t& j) const {
361 return cache.ref( offset(i,j) ) ;
362 }
363
364 inline NameProxy operator[]( const std::string& name ){
365 return NameProxy( *this, name ) ;
366 }
367 inline NameProxy operator()( const std::string& name ){
368 return NameProxy( *this, name ) ;
369 }
370
371 inline NameProxy operator[]( const std::string& name ) const {
372 return NameProxy( const_cast<Vector&>(*this), name ) ;
373 }
374 inline NameProxy operator()( const std::string& name ) const {
375 return NameProxy( const_cast<Vector&>(*this), name ) ;
376 }
377
378 inline operator RObject() const {
379 return RObject( Storage::get__() );
380 }
381
382 // sugar subsetting requires dispatch on VectorBase
383 template <int RHS_RTYPE, bool RHS_NA, typename RHS_T>
391
392 template <int RHS_RTYPE, bool RHS_NA, typename RHS_T>
400
401 Vector& sort(bool decreasing = false) {
402 // sort() does not apply to List, RawVector or ExpressionVector.
403 //
404 // The function below does nothing for qualified Vector types,
405 // and is undefined for other types. Hence there will be a
406 // compiler error when sorting List, RawVector or ExpressionVector.
407 internal::Sort_is_not_allowed_for_this_type<RTYPE>::do_nothing();
408
409 typename traits::storage_type<RTYPE>::type* start = internal::r_vector_start<RTYPE>( Storage::get__() );
410
411 if (!decreasing) {
412 std::sort(
413 start,
414 start + size(),
416 );
417 } else {
418 std::sort(
419 start,
420 start + size(),
422 );
423 }
424
425 return *this;
426 }
427
428 template <typename InputIterator>
430 /* FIXME: we can do better than this r_cast to avoid
431 allocating an unnecessary temporary object
432 */
435 Storage::set__(casted) ;
436 }
437
438 template <typename InputIterator>
440 Vector v ;
441 v.assign( first , last ) ;
442 return v ;
443 }
444
445 template <typename InputIterator, typename F>
449
450 template <typename T>
451 void push_back( const T& object){
454 ) ;
455 }
456
457 template <typename T>
458 void push_back( const T& object, const std::string& name ){
461 ) ;
462 }
463
464 template <typename T>
465 void push_front( const T& object){
468 }
469
470 template <typename T>
471 void push_front( const T& object, const std::string& name){
474 }
475
476
477 template <typename T>
478 iterator insert( iterator position, const T& object){
481 ) ;
482 }
483
484 template <typename T>
485 iterator insert( int position, const T& object){
486 return insert__impl( cache.get() + position, converter_type::get(object),
488 );
489 }
490
492 return erase_single__impl( cache.get() + position) ;
493 }
494
498
500 iterator start = cache.get() ;
501 return erase_range__impl( start + first, start + last ) ;
502 }
503
507
509 cache.update(*this) ;
510 }
511
512 template <typename U>
513 static void replace_element( iterator it, SEXP names, R_xlen_t index, const U& u){
515 it, names, index, u ) ;
516 }
517
518 template <typename U>
522
523 template <typename U>
527
528 template <typename U>
530 RCPP_DEBUG_2( " Vector::replace_element__dispatch<%s>(true, index= %d) ", DEMANGLE(U), index ) ;
531
532 *it = converter_type::get(u.object ) ;
533 SET_STRING_ELT( names, index, ::Rf_mkChar( u.name.c_str() ) ) ;
534 }
535
536 template <typename U>
538 RCPP_DEBUG_2( " Vector::replace_element__dispatch<%s>(true, index= %d) ", DEMANGLE(U), index ) ;
539
540 *it = R_MissingArg ;
541 SET_STRING_ELT( names, index, ::Rf_mkChar( u.name.c_str() ) ) ;
542 }
543
545
546 inline Indexer operator[]( const Range& range ){
547 return Indexer( const_cast<Vector&>(*this), range );
548 }
549
550 template <typename EXPR_VEC>
552 const EXPR_VEC& ref = rhs.get_ref() ;
553 iterator start = begin() ;
554 R_xlen_t n = size() ;
555 // TODO: maybe unroll this
557 for( R_xlen_t i=0; i<n; i++){
558 Proxy left = start[i] ;
559 if( ! traits::is_na<RTYPE>( left ) ){
560 tmp = ref[i] ;
561 left = traits::is_na<RTYPE>( tmp ) ? tmp : ( left + tmp ) ;
562 }
563 }
564 return *this ;
565 }
566
567 template <typename EXPR_VEC>
569 const EXPR_VEC& ref = rhs.get_ref() ;
570 iterator start = begin() ;
571 R_xlen_t n = size() ;
573 for( R_xlen_t i=0; i<n; i++){
574 if( ! traits::is_na<RTYPE>(start[i]) ){
575 start[i] += ref[i] ;
576 }
577 }
578 return *this ;
579
580 }
581
585 bool containsElementNamed( const char* target ) const {
586 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
587 if( Rf_isNull(names) ) return false ;
589 for( R_xlen_t i=0; i<n; i++){
590 if( !strcmp( target, CHAR(STRING_ELT(names, i)) ) )
591 return true ;
592 }
593 return false ;
594 }
595
596 R_xlen_t findName(const std::string& name) const {
597 SEXP names = RCPP_GET_NAMES(Storage::get__());
598 if (Rf_isNull(names)) stop("'names' attribute is null");
600 for (R_xlen_t i=0; i < n; ++i) {
601 if (strcmp(name.c_str(), CHAR(STRING_ELT(names, i))) == 0) {
602 return i;
603 }
604 }
605 std::stringstream ss;
606 ss << "no name '" << name << "' found";
607 stop(ss.str());
608 return -1;
609 }
610
611protected:
612 inline int* dims() const {
613 if( !::Rf_isMatrix(Storage::get__()) ) throw not_a_matrix() ;
614 return INTEGER( ::Rf_getAttrib( Storage::get__(), R_DimSymbol ) ) ;
615 }
616 void init(){
617 RCPP_DEBUG_2( "VECTOR<%d>::init( SEXP = <%p> )", RTYPE, Storage::get__() )
618 internal::r_init_vector<RTYPE>(Storage::get__()) ;
619 }
620
621private:
622
624 Shield<SEXP> object_sexp( object ) ;
625 R_xlen_t n = size() ;
626 Vector target( n + 1 ) ;
627 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
628 iterator target_it( target.begin() ) ;
629 iterator it(begin()) ;
631 if( Rf_isNull(names) ){
632 for( ; it < this_end; ++it, ++target_it ){
633 *target_it = *it ; // #nocov start
634 }
635 } else {
637 int i = 0 ;
638 for( ; it < this_end; ++it, ++target_it, i++ ){
639 *target_it = *it ;
641 }
643 target.attr("names") = newnames ; // #nocov end
644 }
646 Storage::set__( target.get__() ) ;
647 }
648
650 R_xlen_t n = size() ;
651 Vector target( n + 1 ) ;
652 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
653 iterator target_it( target.begin() ) ;
654 iterator it(begin()) ;
656 if( Rf_isNull(names) ){
657 for( ; it < this_end; ++it, ++target_it ){
658 *target_it = *it ;
659 }
660 } else {
662 int i = 0 ;
663 for( ; it < this_end; ++it, ++target_it, i++ ){
664 *target_it = *it ;
666 }
668 target.attr("names") = newnames ;
669 }
670 *target_it = object;
671 Storage::set__( target.get__() ) ;
672 }
673
674 void push_back_name__impl(const stored_type& object, const std::string& name, traits::true_type ) {
675 Shield<SEXP> object_sexp( object ) ;
676 R_xlen_t n = size() ;
677 Vector target( n + 1 ) ;
678 iterator target_it( target.begin() ) ;
679 iterator it(begin()) ;
681 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
683 int i=0;
684 if( Rf_isNull(names) ){
685 for( ; it < this_end; ++it, ++target_it,i++ ){
686 *target_it = *it ; // #nocov
687 SET_STRING_ELT( newnames, i , R_BlankString ); // #nocov
688 }
689 } else {
690 for( ; it < this_end; ++it, ++target_it, i++ ){
691 *target_it = *it ;
693 }
694 }
695 SET_STRING_ELT( newnames, i, Rf_mkChar( name.c_str() ) );
696 target.attr("names") = newnames ;
697
699 Storage::set__( target.get__() ) ;
700 }
701 void push_back_name__impl(const stored_type& object, const std::string& name, traits::false_type ) {
702 R_xlen_t n = size() ;
703 Vector target( n + 1 ) ;
704 iterator target_it( target.begin() ) ;
705 iterator it(begin()) ;
707 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
709 int i=0;
710 if( Rf_isNull(names) ){
711 Shield<SEXP> dummy( Rf_mkChar("") );
712 for( ; it < this_end; ++it, ++target_it,i++ ){
713 *target_it = *it ;
714 SET_STRING_ELT( newnames, i , dummy );
715 }
716 } else {
717 for( ; it < this_end; ++it, ++target_it, i++ ){
718 *target_it = *it ;
720 }
721 }
722 SET_STRING_ELT( newnames, i, Rf_mkChar( name.c_str() ) );
723 target.attr("names") = newnames ;
724
725 *target_it = object;
726 Storage::set__( target.get__() ) ;
727 }
728
730 Shield<SEXP> object_sexp( object ) ;
731 R_xlen_t n = size() ;
732 Vector target( n+1);
733 iterator target_it(target.begin());
734 iterator it(begin());
737 ++target_it ;
738 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
739 if( Rf_isNull(names) ){
740 for( ; it<this_end; ++it, ++target_it){
741 *target_it = *it ;
742 }
743 } else{
745 int i=1 ;
747 for( ; it<this_end; ++it, ++target_it, i++){
748 *target_it = *it ;
750 }
751 target.attr("names") = newnames ;
752 }
753 Storage::set__( target.get__() ) ;
754
755 }
757 R_xlen_t n = size() ;
758 Vector target( n+1);
759 iterator target_it(target.begin());
760 iterator it(begin());
762 *target_it = object ;
763 ++target_it ;
764 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
765 if( Rf_isNull(names) ){
766 for( ; it<this_end; ++it, ++target_it){
767 *target_it = *it ;
768 }
769 } else{
771 int i=1 ;
773 for( ; it<this_end; ++it, ++target_it, i++){
774 *target_it = *it ;
776 }
777 target.attr("names") = newnames ;
778 }
779 Storage::set__( target.get__() ) ;
780
781 }
782
783 void push_front_name__impl(const stored_type& object, const std::string& name, traits::true_type ) {
784 Shield<SEXP> object_sexp(object) ;
785 R_xlen_t n = size() ;
786 Vector target( n + 1 ) ;
787 iterator target_it( target.begin() ) ;
788 iterator it(begin()) ;
790 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
792 int i=1;
793 SET_STRING_ELT( newnames, 0, Rf_mkChar( name.c_str() ) );
795 ++target_it ;
796
797 if( Rf_isNull(names) ){
798 for( ; it < this_end; ++it, ++target_it,i++ ){
799 *target_it = *it ;
801 }
802 } else {
803 for( ; it < this_end; ++it, ++target_it, i++ ){
804 *target_it = *it ;
806 }
807 }
808 target.attr("names") = newnames ;
809 Storage::set__( target.get__() ) ;
810
811 }
812 void push_front_name__impl(const stored_type& object, const std::string& name, traits::false_type ) {
813 R_xlen_t n = size() ;
814 Vector target( n + 1 ) ;
815 iterator target_it( target.begin() ) ;
816 iterator it(begin()) ;
818 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
820 int i=1;
821 SET_STRING_ELT( newnames, 0, Rf_mkChar( name.c_str() ) );
822 *target_it = object;
823 ++target_it ;
824
825 if( Rf_isNull(names) ){
826 for( ; it < this_end; ++it, ++target_it,i++ ){
827 *target_it = *it ;
829 }
830 } else {
831 for( ; it < this_end; ++it, ++target_it, i++ ){
832 *target_it = *it ;
834 }
835 }
836 target.attr("names") = newnames ;
837
838 Storage::set__( target.get__() ) ;
839
840 }
841
844 R_xlen_t n = size() ;
845 Vector target( n+1 ) ;
846 iterator target_it = target.begin();
847 iterator it = begin() ;
848 iterator this_end = end() ;
849 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
851 if( Rf_isNull(names) ){
852 for( ; it < position; ++it, ++target_it){
853 *target_it = *it ;
854 }
856 *target_it = object ;
857 ++target_it ;
858 for( ; it < this_end; ++it, ++target_it ){
859 *target_it = *it ;
860 }
861 } else{
863 int i=0;
864 for( ; it < position; ++it, ++target_it, i++){
865 *target_it = *it ;
867 }
869 *target_it = object ;
871 i++ ;
872 ++target_it ;
873 for( ; it < this_end; ++it, ++target_it, i++ ){
874 *target_it = *it ;
875 SET_STRING_ELT( newnames, i, STRING_ELT(names, i - 1) ) ;
876 }
877 target.attr( "names" ) = newnames ;
878 }
879 Storage::set__( target.get__() ) ;
880 return result ;
881 }
882
884 R_xlen_t n = size() ;
885 Vector target( n+1 ) ;
886 iterator target_it = target.begin();
887 iterator it = begin() ;
888 iterator this_end = end() ;
889 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
891 if( Rf_isNull(names) ){
892 for( ; it < position; ++it, ++target_it){
893 *target_it = *it ;
894 }
896 *target_it = object ;
897 ++target_it ;
898 for( ; it < this_end; ++it, ++target_it ){
899 *target_it = *it ;
900 }
901 } else{
903 int i=0;
904 for( ; it < position; ++it, ++target_it, i++){
905 *target_it = *it ;
907 }
909 *target_it = object ;
911 i++ ;
912 ++target_it ;
913 for( ; it < this_end; ++it, ++target_it, i++ ){
914 *target_it = *it ;
915 SET_STRING_ELT( newnames, i, STRING_ELT(names, i - 1) ) ;
916 }
917 target.attr( "names" ) = newnames ;
918 }
919 Storage::set__( target.get__() ) ;
920 return result ;
921 }
922
924 if( position < begin() || position > end() ) {
926 R_xlen_t available_locs = std::distance(begin(), end());
927
928 if(position > end()){
929 requested_loc = std::distance(position, begin());
930 } else {
931 // This will be a negative number
932 requested_loc = std::distance(begin(), position);
933 }
934 const char* fmt = "Iterator index is out of bounds: "
935 "[iterator index=%i; iterator extent=%i]";
937 }
938
939 R_xlen_t n = size() ;
940
941 Vector target( n - 1 ) ;
942 iterator target_it(target.begin()) ;
943 iterator it(begin()) ;
945 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
946 if( Rf_isNull(names) ){
947 int i=0;
948 for( ; it < position; ++it, ++target_it, i++){
949 *target_it = *it;
950 }
951 ++it ;
952 for( ; it < this_end ; ++it, ++target_it){
953 *target_it = *it;
954 }
955 Storage::set__( target.get__() ) ;
956 return begin()+i ;
957 } else {
959 int i= 0 ;
960 for( ; it < position; ++it, ++target_it,i++){
961 *target_it = *it;
963 }
964 int result=i ;
965 ++it ;
966 i++ ;
967 for( ; it < this_end ; ++it, ++target_it, i++){
968 *target_it = *it;
970 }
971 target.attr( "names" ) = newnames ;
972 Storage::set__( target.get__() ) ;
973 return begin()+result ;
974 }
975 }
976
978 if( first > last ) throw std::range_error("invalid range") ;
979 if( last > end() || first < begin() ) {
981 R_xlen_t available_locs = std::distance(begin(), end());
982 std::string iter_problem;
983
984 if(last > end()){
985 requested_loc = std::distance(last, begin());
986 iter_problem = "last";
987 } else {
988 // This will be a negative number
989 requested_loc = std::distance(begin(), first);
990 iter_problem = "first";
991 }
992 const char* fmt = "Iterator index is out of bounds: "
993 "[iterator=%s; index=%i; extent=%i]";
996 }
997
998 iterator it = begin() ;
999 iterator this_end = end() ;
1000 R_xlen_t nremoved = std::distance(first,last) ;
1002 Vector target( target_size ) ;
1003 iterator target_it = target.begin() ;
1004
1005 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
1006 int result = 0;
1007 if( Rf_isNull(names) ){
1008 int i=0;
1009 for( ; it < first; ++it, ++target_it, i++ ){
1010 *target_it = *it ;
1011 }
1012 result = i;
1013 for( it = last ; it < this_end; ++it, ++target_it ){
1014 *target_it = *it ;
1015 }
1016 } else{
1018 int i= 0 ;
1019 for( ; it < first; ++it, ++target_it, i++ ){
1020 *target_it = *it ;
1022 }
1023 result = i;
1024 for( it = last ; it < this_end; ++it, ++target_it, i++ ){
1025 *target_it = *it ;
1027 }
1028 target.attr("names" ) = newnames ;
1029 }
1030 Storage::set__( target.get__() ) ;
1031
1032 return begin() + result;
1033
1034 }
1035
1036 template <typename T>
1037 inline void assign_sugar_expression( const T& x ) {
1038 R_xlen_t n = size() ;
1039 if( n == x.size() ){
1040 // just copy the data
1041 import_expression<T>(x, n ) ;
1042 } else{
1043 // different size, so we change the memory
1046 Storage::set__(casted);
1047 }
1048 }
1049
1050 // sugar
1051 template <typename T>
1052 inline void assign_object( const T& x, traits::true_type ) {
1053 assign_sugar_expression( x.get_ref() ) ;
1054 }
1055
1056 // anything else
1057 template <typename T>
1058 inline void assign_object( const T& x, traits::false_type ) {
1061 Storage::set__(casted);
1062 }
1063
1064 // we are importing a real sugar expression, i.e. not a vector
1065 template <bool NA, typename VEC>
1067 RCPP_DEBUG_4( "Vector<%d>::import_sugar_expression( VectorBase<%d,%d,%s>, false_type )", RTYPE, NA, RTYPE, DEMANGLE(VEC) ) ;
1068 R_xlen_t n = other.size() ;
1069 Storage::set__( Rf_allocVector( RTYPE, n ) ) ;
1070 import_expression<VEC>( other.get_ref() , n ) ;
1071 }
1072
1073 // we are importing a sugar expression that actually is a vector
1074 template <bool NA, typename VEC>
1076 RCPP_DEBUG_4( "Vector<%d>::import_sugar_expression( VectorBase<%d,%d,%s>, true_type )", RTYPE, NA, RTYPE, DEMANGLE(VEC) ) ;
1077 Storage::set__( other.get_ref() ) ;
1078 }
1079
1080
1081 template <typename T>
1082 inline void import_expression( const T& other, R_xlen_t n ) {
1083 iterator start = begin() ;
1084 RCPP_LOOP_UNROLL(start,other)
1085 }
1086
1087 template <typename T>
1088 inline void fill_or_generate( const T& t) {
1090 }
1091
1092 template <typename T>
1094 iterator first = begin() ;
1095 iterator last = end() ;
1096 while( first != last ) *first++ = gen() ;
1097 }
1098
1099 template <typename T>
1100 inline void fill_or_generate__impl( const T& t, traits::false_type) {
1101 fill(t) ;
1102 }
1103
1104 template <typename U>
1106 // when this is not trivial, this is SEXP
1108 iterator it(begin());
1109 for( R_xlen_t i=0; i<size() ; i++, ++it){
1110 *it = ::Rf_duplicate( elem ) ;
1111 }
1112 }
1113
1114 template <typename U>
1116 std::fill( begin(), end(), converter_type::get( u ) ) ;
1117 }
1118
1119public:
1120
1121 static Vector create(){
1122 return Vector( 0 ) ;
1123 }
1124
1125 #if defined(HAS_VARIADIC_TEMPLATES)
1126 public:
1127 template <typename... T>
1128 static Vector create(const T&... t){
1129 return create__dispatch( typename traits::integral_constant<bool,
1130 traits::is_any_named<T...>::value
1131 >::type(), t... ) ;
1132 }
1133
1134 private:
1135 template <typename... T>
1136 static Vector create__dispatch(traits::false_type, const T&... t){
1137 Vector res(sizeof...(T)) ;
1138 iterator it(res.begin());
1139 create_dispatch_impl(it, t...);
1140 return res;
1141 }
1142 template <typename... T>
1143 static Vector create__dispatch( traits::true_type, const T&... t) {
1144 Vector res(sizeof...(T)) ;
1145 Shield<SEXP> names(::Rf_allocVector(STRSXP, sizeof...(T)));
1146 int index = 0;
1147 iterator it(res.begin());
1148 replace_element_impl(it, names, index, t...);
1149 res.attr("names") = names;
1150 return res;
1151 }
1152 template <typename T>
1153 static void create_dispatch_impl(iterator& it, const T& t) {
1154 *it = converter_type::get(t);
1155 }
1156
1157 template <typename T, typename... TArgs>
1158 static void create_dispatch_impl(iterator& it, const T& t, const TArgs&... args) {
1159 *it = converter_type::get(t);
1161 }
1162 template <typename T>
1163 static void replace_element_impl(iterator& it, Shield<SEXP>& names, int& index, const T& t) {
1164 replace_element(it, names, index, t);
1165 }
1166 template <typename T, typename... TArgs>
1167 static void replace_element_impl(iterator& it, Shield<SEXP>& names, int& index, const T& t, const TArgs&... args) {
1168 replace_element(it, names, index, t);
1169 replace_element_impl(++it, names, ++index, args...);
1170 }
1171 #else
1172 #include <Rcpp/generated/Vector__create.h>
1173 #endif
1174
1175public:
1176
1177 inline SEXP eval() const {
1178 return Rcpp_eval( Storage::get__(), R_GlobalEnv ) ;
1179 }
1180
1181 inline SEXP eval(SEXP env) const {
1182 return Rcpp_eval( Storage::get__(), env );
1183 }
1184
1185
1186} ; /* Vector */
1187
1188template <int RTYPE, template <class> class StoragePolicy >
1189inline std::ostream &operator<<(std::ostream & s, const Vector<RTYPE, StoragePolicy> & rhs) {
1190 typedef Vector<RTYPE, StoragePolicy> VECTOR;
1191
1192 typename VECTOR::iterator i = const_cast<VECTOR &>(rhs).begin();
1193 typename VECTOR::iterator iend = const_cast<VECTOR &>(rhs).end();
1194
1195 if (i != iend) {
1196 s << (*i);
1197 ++i;
1198
1199 for ( ; i != iend; ++i) {
1200 s << " " << (*i);
1201 }
1202 }
1203
1204 return s;
1205}
1206
1207template<template <class> class StoragePolicy >
1208inline std::ostream &operator<<(std::ostream & s, const Vector<STRSXP, StoragePolicy> & rhs) {
1209 typedef Vector<STRSXP, StoragePolicy> VECTOR;
1210
1211 typename VECTOR::iterator i = const_cast<VECTOR &>(rhs).begin();
1212 typename VECTOR::iterator iend = const_cast<VECTOR &>(rhs).end();
1213
1214 if (i != iend) {
1215 s << "\"" << (*i) << "\"";
1216 ++i;
1217
1218 for ( ; i != iend; ++i) {
1219 s << " \"" << (*i) << "\"";
1220 }
1221 }
1222
1223 return s;
1224}
1225
1226}
1227
1228#endif
AttributeProxy attr(const std::string &name)
VECTOR & get_ref()
Definition VectorBase.h:37
void fill_or_generate__impl(const T &t, traits::false_type)
Definition Vector.h:1100
traits::storage_type< RTYPE >::type stored_type
Definition Vector.h:49
void fill_or_generate(const T &t)
Definition Vector.h:1088
iterator erase_range__impl(iterator first, iterator last)
Definition Vector.h:977
static Vector import_transform(InputIterator first, InputIterator last, F f)
Definition Vector.h:446
iterator erase(int position)
Definition Vector.h:491
internal::RangeIndexer< RTYPE, true, Vector > Indexer
Definition Vector.h:544
Vector & operator=(const T &x)
Definition Vector.h:246
SEXP eval(SEXP env) const
Definition Vector.h:1181
Vector(const GenericProxy< Proxy > &proxy)
Definition Vector.h:77
Vector(const T &size, const U &u, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
Definition Vector.h:168
Vector(const Dimension &dims)
Definition Vector.h:133
R_xlen_t findName(const std::string &name) const
Definition Vector.h:596
Vector(const T &size, const stored_type &u, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
Definition Vector.h:87
void push_front_name__impl(const stored_type &object, const std::string &name, traits::false_type)
Definition Vector.h:812
void import_sugar_expression(const Rcpp::VectorBase< RTYPE, NA, VEC > &other, traits::true_type)
Definition Vector.h:1075
void push_back__impl(const stored_type &object, traits::true_type)
Definition Vector.h:623
iterator erase_single__impl(iterator position)
Definition Vector.h:923
traits::r_vector_cache_type< RTYPE, StoragePolicy >::type cache
Definition Vector.h:40
Vector(SEXP x)
Definition Vector.h:71
const_Proxy operator[](R_xlen_t i) const
Definition Vector.h:341
Vector & operator+=(const VectorBase< RTYPE, false, EXPR_VEC > &rhs)
Definition Vector.h:568
void assign(InputIterator first, InputIterator last)
Definition Vector.h:429
Vector & operator+=(const VectorBase< RTYPE, true, EXPR_VEC > &rhs)
Definition Vector.h:551
int * dims() const
Definition Vector.h:612
void push_back_name__impl(const stored_type &object, const std::string &name, traits::true_type)
Definition Vector.h:674
Vector(const std::string &st)
Definition Vector.h:101
const_iterator begin() const
Definition Vector.h:335
NameProxy operator[](const std::string &name) const
Definition Vector.h:371
static bool is_na(stored_type x)
Definition Vector.h:254
void push_front__impl(const stored_type &object, traits::true_type)
Definition Vector.h:729
const_Proxy operator()(const size_t &i) const
Definition Vector.h:346
void push_front_name__impl(const stored_type &object, const std::string &name, traits::true_type)
Definition Vector.h:783
Vector(const Dimension &dims, const U &u)
Definition Vector.h:152
Vector(const T &siz, stored_type(*gen)(void), typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
Definition Vector.h:113
iterator insert__impl(iterator position, const stored_type &object_, traits::true_type)
Definition Vector.h:842
bool containsElementNamed(const char *target) const
Definition Vector.h:585
R_xlen_t size() const
Definition Vector.h:275
Proxy operator()(const size_t &i, const size_t &j)
Definition Vector.h:357
traits::r_vector_const_iterator< RTYPE, StoragePolicy >::type const_iterator
Definition Vector.h:46
iterator end()
Definition Vector.h:334
static void replace_element__dispatch(traits::true_type, iterator it, SEXP names, R_xlen_t index, const U &u)
Definition Vector.h:524
static void replace_element(iterator it, SEXP names, R_xlen_t index, const U &u)
Definition Vector.h:513
Proxy operator[](R_xlen_t i)
Definition Vector.h:340
void fill__dispatch(traits::false_type, const U &u)
Definition Vector.h:1105
R_xlen_t length() const
Definition Vector.h:268
const_Proxy operator()(const size_t &i, const size_t &j) const
Definition Vector.h:360
Indexer operator[](const Range &range)
Definition Vector.h:546
R_xlen_t offset(const int &i, const int &j) const
Definition Vector.h:282
Vector(const int &size)
Definition Vector.h:128
iterator insert(iterator position, const T &object)
Definition Vector.h:478
Vector(const sugar::SingleLogicalResult< NA, T > &obj)
Definition Vector.h:176
const_iterator end() const
Definition Vector.h:336
NameProxy operator()(const std::string &name) const
Definition Vector.h:374
static void replace_element__dispatch__isArgument(traits::false_type, iterator it, SEXP names, R_xlen_t index, const U &u)
Definition Vector.h:529
traits::r_vector_name_proxy< RTYPE, StoragePolicy >::type NameProxy
Definition Vector.h:43
void fill(const U &u)
Definition Vector.h:329
traits::r_vector_proxy< RTYPE, StoragePolicy >::type value_type
Definition Vector.h:44
const SubsetProxy< RTYPE, StoragePolicy, RHS_RTYPE, RHS_NA, RHS_T > operator[](const VectorBase< RHS_RTYPE, RHS_NA, RHS_T > &rhs) const
Definition Vector.h:394
traits::r_vector_element_converter< RTYPE >::type converter_type
Definition Vector.h:48
Vector(T size, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
Definition Vector.h:122
Vector(const T &siz, stored_type(*gen)(U1, U2), const U1 &u1, const U2 &u2, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
Definition Vector.h:192
void push_front(const T &object, const std::string &name)
Definition Vector.h:471
Vector(const T &siz, stored_type(*gen)(U1), const U1 &u1, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
Definition Vector.h:183
void push_front__impl(const stored_type &object, traits::false_type)
Definition Vector.h:756
void update(SEXP)
Definition Vector.h:508
static stored_type get_na()
Definition Vector.h:251
void import_sugar_expression(const Rcpp::VectorBase< RTYPE, NA, VEC > &other, traits::false_type)
Definition Vector.h:1066
NameProxy operator()(const std::string &name)
Definition Vector.h:367
void import_expression(const T &other, R_xlen_t n)
Definition Vector.h:1082
StoragePolicy< Vector > Storage
Definition Vector.h:38
const_iterator cbegin() const
Definition Vector.h:337
SubsetProxy< RTYPE, StoragePolicy, RHS_RTYPE, RHS_NA, RHS_T > operator[](const VectorBase< RHS_RTYPE, RHS_NA, RHS_T > &rhs)
Definition Vector.h:385
void push_back(const T &object)
Definition Vector.h:451
Vector(InputIterator first, InputIterator last, Func func, T n, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
Definition Vector.h:232
Vector(const int &size, const stored_type &u)
Definition Vector.h:94
void push_front(const T &object)
Definition Vector.h:465
iterator begin()
Definition Vector.h:333
R_xlen_t offset(const R_xlen_t &i) const
Definition Vector.h:302
Proxy at(const size_t &i)
Definition Vector.h:350
void assign_object(const T &x, traits::true_type)
Definition Vector.h:1052
static void replace_element__dispatch(traits::false_type, iterator it, SEXP names, R_xlen_t index, const U &u)
Definition Vector.h:519
Vector(InputIterator first, InputIterator last, Func func)
Definition Vector.h:225
const_Proxy at(const size_t &i) const
Definition Vector.h:353
void push_back__impl(const stored_type &object, traits::false_type)
Definition Vector.h:649
Vector(InputIterator first, InputIterator last)
Definition Vector.h:210
NameProxy operator[](const std::string &name)
Definition Vector.h:364
static Vector create()
Definition Vector.h:1121
Vector(const char *st)
Definition Vector.h:107
static void replace_element__dispatch__isArgument(traits::true_type, iterator it, SEXP names, R_xlen_t index, const U &u)
Definition Vector.h:537
Vector & operator=(const Vector &rhs)
Definition Vector.h:67
Vector(const T &siz, stored_type(*gen)(U1, U2, U3), const U1 &u1, const U2 &u2, const U3 &u3, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
Definition Vector.h:201
traits::r_vector_iterator< RTYPE, StoragePolicy >::type iterator
Definition Vector.h:45
Vector(const no_init_vector &obj)
Definition Vector.h:82
const_iterator cend() const
Definition Vector.h:338
traits::init_type< RTYPE >::type init_type
Definition Vector.h:47
void fill__dispatch(traits::true_type, const U &u)
Definition Vector.h:1115
Vector(InputIterator first, InputIterator last, T n, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
Definition Vector.h:217
Vector(const Vector &other)
Definition Vector.h:63
iterator insert(int position, const T &object)
Definition Vector.h:485
Proxy operator()(const size_t &i)
Definition Vector.h:343
Vector(const VectorBase< RTYPE, NA, VEC > &other)
Definition Vector.h:162
iterator insert__impl(iterator position, const stored_type &object, traits::false_type)
Definition Vector.h:883
void push_back(const T &object, const std::string &name)
Definition Vector.h:458
traits::r_vector_const_proxy< RTYPE, StoragePolicy >::type const_Proxy
Definition Vector.h:42
SEXP eval() const
Definition Vector.h:1177
void fill_or_generate__impl(const T &gen, traits::true_type)
Definition Vector.h:1093
Vector(T value, typename Rcpp::traits::enable_if< traits::is_bool< T >::value &&RTYPE==LGLSXP, void >::type *=0)
Definition Vector.h:145
iterator erase(iterator position)
Definition Vector.h:495
iterator erase(iterator first, iterator last)
Definition Vector.h:504
traits::r_vector_proxy< RTYPE, StoragePolicy >::type Proxy
Definition Vector.h:41
R_xlen_t offset(const std::string &name) const
Definition Vector.h:310
iterator erase(int first, int last)
Definition Vector.h:499
void init()
Definition Vector.h:616
void assign_sugar_expression(const T &x)
Definition Vector.h:1037
void push_back_name__impl(const stored_type &object, const std::string &name, traits::false_type)
Definition Vector.h:701
void assign_object(const T &x, traits::false_type)
Definition Vector.h:1058
Vector & sort(bool decreasing=false)
Definition Vector.h:401
static target get(const T &input)
Definition converter.h:33
R_xlen_t get() const
Definition no_init.h:34
#define RCPP_DEBUG_2(fmt, M1, M2)
Definition debug.h:45
#define RCPP_DEBUG_1(fmt, MSG)
Definition debug.h:44
#define RCPP_DEBUG_4(fmt, M1, M2, M3, M4)
Definition debug.h:47
#define DEMANGLE(__TYPE__)
Definition exceptions.h:382
#define RCPP_GET_NAMES(x)
Definition macros.h:45
T as(SEXP x, ::Rcpp::traits::r_type_primitive_tag)
Definition as.h:43
integral_constant< bool, true > true_type
integral_constant< bool, false > false_type
Rcpp API.
Definition algo.h:28
std::ostream & operator<<(std::ostream &os, const Date d)
Definition Date.h:172
void NORET stop(const std::string &message)
Definition exceptions.h:117
sugar::Range< RTYPE, NA, T > range(const VectorBase< RTYPE, NA, T > &x)
Definition range.h:86
SEXP Rcpp_eval(SEXP expr, SEXP env)
Definition Rcpp_eval.h:75
RObject_Impl< PreserveStorage > RObject
Definition RObject.h:58
T as(SEXP x)
Definition as.h:151
static Na_Proxy NA
Definition Na_Proxy.h:52
SEXP wrap(const Date &date)
Definition Date.h:38
SEXP get() const
storage_type< RTYPE >::type type
Definition init_type.h:29
const storage_type< RTYPE >::type * type
Definition proxy.h:255
const storage_type< RTYPE >::type & type
Definition proxy.h:234
storage_type< RTYPE >::type * type
Definition proxy.h:251
storage_type< RTYPE >::type & type
Definition proxy.h:217
#define RCPP_LOOP_UNROLL(TARGET, SOURCE)
Definition unroll.h:47