20#ifndef Rcpp__vector__Vector_h
21#define Rcpp__vector__Vector_h
28template <
int RTYPE,
template <
class>
class StoragePolicy =
PreserveStorage >
30 public StoragePolicy< Vector<RTYPE,StoragePolicy> >,
35 public VectorBase< RTYPE, true, Vector<RTYPE,StoragePolicy> >
57 Storage::set__( Rf_allocVector(RTYPE, 0 ) );
65 Storage::copy__(other) ;
69 return Storage::copy__(rhs) ;
77 template <
typename Proxy>
84 Storage::set__( Rf_allocVector( RTYPE, obj.
get() ) ) ;
90 RCPP_DEBUG_2(
"Vector<%d>( const T& size = %d, const stored_type& u )", RTYPE,
size)
91 Storage::set__( Rf_allocVector( RTYPE,
size) ) ;
96 RCPP_DEBUG_2(
"Vector<%d>( const int& size = %d, const stored_type& u )", RTYPE,
size)
97 Storage::set__( Rf_allocVector( RTYPE,
size) ) ;
103 RCPP_DEBUG_2(
"Vector<%d>( const std::string& = %s )", RTYPE, st.c_str() )
109 RCPP_DEBUG_2(
"Vector<%d>( const char* = %s )", RTYPE, st )
116 RCPP_DEBUG_2(
"Vector<%d>( const int& siz = %s, stored_type (*gen)(void) )", RTYPE, siz )
117 Storage::set__( Rf_allocVector( RTYPE, siz) ) ;
118 std::generate(
begin(),
end(), gen );
122 template <
typename T>
125 Storage::set__( Rf_allocVector( RTYPE,
size) ) ;
130 Storage::set__( Rf_allocVector( RTYPE,
size) ) ;
135 Storage::set__( Rf_allocVector( RTYPE,
dims.prod() ) ) ;
137 if(
dims.size() > 1 ){
145 template <
typename T>
148 Storage::set__(Rf_allocVector(RTYPE, 1));
152 template <
typename U>
154 RCPP_DEBUG_2(
"Vector<%d>( const Dimension& (%d), const U& )", RTYPE,
dims.size() )
155 Storage::set__( Rf_allocVector( RTYPE,
dims.prod() ) ) ;
157 if(
dims.size() > 1 ){
162 template <
bool NA,
typename VEC>
164 RCPP_DEBUG_2(
"Vector<%d>( const VectorBase<RTYPE,NA,VEC>& ) [VEC = %s]", RTYPE,
DEMANGLE(VEC) )
168 template <
typename T,
typename U>
172 Storage::set__( Rf_allocVector( RTYPE,
size) ) ;
176 template <
bool NA,
typename T>
180 RCPP_DEBUG_2(
"Vector<%d>( const sugar::SingleLogicalResult<NA,T>& ) [T = %s]", RTYPE,
DEMANGLE(T) )
183 template <
typename T,
typename U1>
186 Storage::set__( Rf_allocVector( RTYPE, siz) ) ;
187 RCPP_DEBUG_2(
"const T& siz, stored_type (*gen)(U1), const U1& u1 )", RTYPE, siz )
189 while( first != last ) *first++ = gen(u1) ;
192 template <
typename T,
typename U1,
typename U2>
195 Storage::set__( Rf_allocVector( RTYPE, siz) ) ;
196 RCPP_DEBUG_2(
"const T& siz, stored_type (*gen)(U1,U2), const U1& u1, const U2& u2)", RTYPE, siz )
198 while( first != last ) *first++ = gen(u1,u2) ;
201 template <
typename T,
typename U1,
typename U2,
typename U3>
204 Storage::set__( Rf_allocVector( RTYPE, siz) ) ;
205 RCPP_DEBUG_2(
"const T& siz, stored_type (*gen)(U1,U2,U3), const U1& u1, const U2& u2, const U3& u3)", RTYPE, siz )
207 while( first != last ) *first++ = gen(u1,u2,u3) ;
210 template <
typename InputIterator>
211 Vector( InputIterator first, InputIterator last){
212 RCPP_DEBUG_1(
"Vector<%d>( InputIterator first, InputIterator last", RTYPE )
213 Storage::set__( Rf_allocVector(RTYPE, std::distance(first, last) ) ) ;
214 std::copy( first, last,
begin() ) ;
217 template <
typename InputIterator,
typename T>
218 Vector( InputIterator first, InputIterator last, T n,
220 Storage::set__(Rf_allocVector(RTYPE, n)) ;
221 RCPP_DEBUG_2(
"Vector<%d>( InputIterator first, InputIterator last, T n = %d)", RTYPE, n )
222 std::copy( first, last,
begin() ) ;
225 template <
typename InputIterator,
typename Func>
226 Vector( InputIterator first, InputIterator last, Func func) {
227 Storage::set__( Rf_allocVector( RTYPE, std::distance(first,last) ) );
228 RCPP_DEBUG_1(
"Vector<%d>( InputIterator, InputIterator, Func )", RTYPE )
229 std::transform( first, last,
begin(), func) ;
232 template <
typename InputIterator,
typename Func,
typename T>
233 Vector( InputIterator first, InputIterator last, Func func, T n,
235 Storage::set__( Rf_allocVector( RTYPE, n ) );
236 RCPP_DEBUG_2(
"Vector<%d>( InputIterator, InputIterator, Func, T n = %d )", RTYPE, n )
237 std::transform( first, last,
begin(), func) ;
240 Vector( std::initializer_list<init_type> list ) {
241 assign( list.begin() , list.end() ) ;
244 template <
typename T>
257 #ifdef RCPP_COMMA_INITIALIZATION
260 return internal::ListInitialization<iterator,init_type>( start + 1 ) ; ;
268 return ::Rf_xlength( Storage::get__() ) ;
275 return ::Rf_xlength( Storage::get__() ) ;
281 R_xlen_t
offset(
const int& i,
const int& j)
const {
282 if( !::Rf_isMatrix(Storage::get__()) )
throw not_a_matrix() ;
285 const int* dim =
dims() ;
286 const int nrow = dim[0] ;
287 const int ncol = dim[1] ;
288 if(i < 0|| i >= nrow || j < 0 || j >= ncol ) {
289 const char* fmt =
"Location index is out of bounds: "
290 "[row index=%i; row extent=%i; "
291 "column index=%i; column extent=%i].";
292 throw index_out_of_bounds(fmt, i, nrow, j, ncol);
294 return i +
static_cast<R_xlen_t
>(nrow)*j ;
301 R_xlen_t
offset(
const R_xlen_t& i)
const {
302 if(i < 0 || i >= ::Rf_xlength(Storage::get__()) ) {
303 const char* fmt =
"Index out of bounds: [index=%i; extent=%i].";
304 throw index_out_of_bounds(fmt, i, ::Rf_xlength(Storage::get__()) ) ;
309 R_xlen_t
offset(
const std::string& name)
const {
311 if( Rf_isNull(
names) ) {
312 throw index_out_of_bounds(
"Object was created without names.");
316 for( R_xlen_t i=0; i<n; ++i){
317 if( ! name.compare( CHAR(STRING_ELT(
names, i)) ) ){
322 const char* fmt =
"Index out of bounds: [index='%s'].";
323 throw index_out_of_bounds(fmt, name);
327 template <
typename U>
341#ifndef LONG_VECTOR_SUPPORT
348 template <
typename T>
349 inline typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, R_xlen_t>::value,
Proxy>::type
351 template <
typename T>
352 inline typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, R_xlen_t>::value,
const_Proxy>::type
392 return RObject( Storage::get__() );
396 template <
int RHS_RTYPE,
bool RHS_NA,
typename RHS_T>
405 template <
int RHS_RTYPE,
bool RHS_NA,
typename RHS_T>
420 internal::Sort_is_not_allowed_for_this_type<RTYPE>::do_nothing();
441 template <
typename InputIterator>
442 void assign( InputIterator first, InputIterator last){
448 Storage::set__(casted) ;
451 template <
typename InputIterator>
452 static Vector import( InputIterator first, InputIterator last){
454 v.
assign( first , last ) ;
458 template <
typename InputIterator,
typename F>
460 return Vector( first, last, f) ;
463 template <
typename T>
470 template <
typename T>
471 void push_back(
const T&
object,
const std::string& name ){
477 template <
typename T>
483 template <
typename T>
490 template <
typename T>
497 template <
typename T>
522 cache.update(*
this) ;
525 template <
typename U>
528 it,
names, index, u ) ;
531 template <
typename U>
536 template <
typename U>
541 template <
typename U>
543 RCPP_DEBUG_2(
" Vector::replace_element__dispatch<%s>(true, index= %d) ",
DEMANGLE(U), index ) ;
546 SET_STRING_ELT(
names, index, ::Rf_mkChar( u.name.c_str() ) ) ;
549 template <
typename U>
551 RCPP_DEBUG_2(
" Vector::replace_element__dispatch<%s>(true, index= %d) ",
DEMANGLE(U), index ) ;
554 SET_STRING_ELT(
names, index, ::Rf_mkChar( u.name.c_str() ) ) ;
563 template <
typename EXPR_VEC>
565 const EXPR_VEC& ref = rhs.
get_ref() ;
567 R_xlen_t n =
size() ;
570 for( R_xlen_t i=0; i<n; i++){
571 Proxy left = start[i] ;
580 template <
typename EXPR_VEC>
582 const EXPR_VEC& ref = rhs.
get_ref() ;
584 R_xlen_t n =
size() ;
586 for( R_xlen_t i=0; i<n; i++){
600 if( Rf_isNull(
names) )
return false ;
601 R_xlen_t n = Rf_xlength(
names) ;
602 for( R_xlen_t i=0; i<n; i++){
603 if( !strcmp( target, CHAR(STRING_ELT(
names, i)) ) )
611 if (Rf_isNull(
names))
stop(
"'names' attribute is null");
612 R_xlen_t n = Rf_xlength(
names);
613 for (R_xlen_t i=0; i < n; ++i) {
614 if (strcmp(name.c_str(), CHAR(STRING_ELT(
names, i))) == 0) {
618 std::stringstream ss;
619 ss <<
"no name '" << name <<
"' found";
626 if( !::Rf_isMatrix(Storage::get__()) )
throw not_a_matrix() ;
627 return INTEGER( ::Rf_getAttrib( Storage::get__(), R_DimSymbol ) ) ;
630 RCPP_DEBUG_2(
"VECTOR<%d>::init( SEXP = <%p> )", RTYPE, Storage::get__() )
631 internal::r_init_vector<RTYPE>(Storage::get__()) ;
638 R_xlen_t n =
size() ;
644 if( Rf_isNull(
names) ){
645 for( ; it < this_end; ++it, ++target_it ){
649 Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n + 1) ) ;
651 for( ; it < this_end; ++it, ++target_it, i++ ){
653 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i ) ) ;
655 SET_STRING_ELT( newnames, i, Rf_mkChar(
"") ) ;
656 target.
attr(
"names") = newnames ;
658 *target_it = object_sexp;
659 Storage::set__( target.
get__() ) ;
663 R_xlen_t n =
size() ;
669 if( Rf_isNull(
names) ){
670 for( ; it < this_end; ++it, ++target_it ){
674 Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n + 1) ) ;
676 for( ; it < this_end; ++it, ++target_it, i++ ){
678 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i ) ) ;
680 SET_STRING_ELT( newnames, i, Rf_mkChar(
"") ) ;
681 target.
attr(
"names") = newnames ;
684 Storage::set__( target.
get__() ) ;
689 R_xlen_t n =
size() ;
695 Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n+1 ) ) ;
697 if( Rf_isNull(
names) ){
698 for( ; it < this_end; ++it, ++target_it,i++ ){
700 SET_STRING_ELT( newnames, i , R_BlankString );
703 for( ; it < this_end; ++it, ++target_it, i++ ){
705 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i ) ) ;
708 SET_STRING_ELT( newnames, i, Rf_mkChar( name.c_str() ) );
709 target.
attr(
"names") = newnames ;
711 *target_it = object_sexp;
712 Storage::set__( target.
get__() ) ;
715 R_xlen_t n =
size() ;
721 Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n+1 ) ) ;
723 if( Rf_isNull(
names) ){
725 for( ; it < this_end; ++it, ++target_it,i++ ){
727 SET_STRING_ELT( newnames, i , dummy );
730 for( ; it < this_end; ++it, ++target_it, i++ ){
732 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i ) ) ;
735 SET_STRING_ELT( newnames, i, Rf_mkChar( name.c_str() ) );
736 target.
attr(
"names") = newnames ;
739 Storage::set__( target.
get__() ) ;
744 R_xlen_t n =
size() ;
749 *target_it = object_sexp ;
752 if( Rf_isNull(
names) ){
753 for( ; it<this_end; ++it, ++target_it){
757 Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n + 1) );
759 SET_STRING_ELT( newnames, 0, Rf_mkChar(
"") ) ;
760 for( ; it<this_end; ++it, ++target_it, i++){
762 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i-1 ) ) ;
764 target.
attr(
"names") = newnames ;
766 Storage::set__( target.
get__() ) ;
770 R_xlen_t n =
size() ;
778 if( Rf_isNull(
names) ){
779 for( ; it<this_end; ++it, ++target_it){
783 Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n + 1) );
785 SET_STRING_ELT( newnames, 0, Rf_mkChar(
"") ) ;
786 for( ; it<this_end; ++it, ++target_it, i++){
788 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i-1 ) ) ;
790 target.
attr(
"names") = newnames ;
792 Storage::set__( target.
get__() ) ;
798 R_xlen_t n =
size() ;
804 Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n+1 ) ) ;
806 SET_STRING_ELT( newnames, 0, Rf_mkChar( name.c_str() ) );
807 *target_it = object_sexp;
810 if( Rf_isNull(
names) ){
811 for( ; it < this_end; ++it, ++target_it,i++ ){
813 SET_STRING_ELT( newnames, i , R_BlankString );
816 for( ; it < this_end; ++it, ++target_it, i++ ){
818 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i-1 ) ) ;
821 target.
attr(
"names") = newnames ;
822 Storage::set__( target.
get__() ) ;
826 R_xlen_t n =
size() ;
832 Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n+1 ) ) ;
834 SET_STRING_ELT( newnames, 0, Rf_mkChar( name.c_str() ) );
838 if( Rf_isNull(
names) ){
839 for( ; it < this_end; ++it, ++target_it,i++ ){
841 SET_STRING_ELT( newnames, i , R_BlankString );
844 for( ; it < this_end; ++it, ++target_it, i++ ){
846 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i-1 ) ) ;
849 target.
attr(
"names") = newnames ;
851 Storage::set__( target.
get__() ) ;
857 R_xlen_t n =
size() ;
864 if( Rf_isNull(
names) ){
865 for( ; it < position; ++it, ++target_it){
871 for( ; it < this_end; ++it, ++target_it ){
875 Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n + 1 ) ) ;
877 for( ; it < position; ++it, ++target_it, i++){
879 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i ) ) ;
883 SET_STRING_ELT( newnames, i, ::Rf_mkChar(
"") ) ;
886 for( ; it < this_end; ++it, ++target_it, i++ ){
888 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i - 1) ) ;
890 target.
attr(
"names" ) = newnames ;
892 Storage::set__( target.
get__() ) ;
897 R_xlen_t n =
size() ;
904 if( Rf_isNull(
names) ){
905 for( ; it < position; ++it, ++target_it){
911 for( ; it < this_end; ++it, ++target_it ){
915 Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n + 1 ) ) ;
917 for( ; it < position; ++it, ++target_it, i++){
919 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i ) ) ;
923 SET_STRING_ELT( newnames, i, ::Rf_mkChar(
"") ) ;
926 for( ; it < this_end; ++it, ++target_it, i++ ){
928 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i - 1) ) ;
930 target.
attr(
"names" ) = newnames ;
932 Storage::set__( target.
get__() ) ;
937 if( position <
begin() || position >
end() ) {
938 R_xlen_t requested_loc;
939 R_xlen_t available_locs = std::distance(
begin(),
end());
941 if(position >
end()){
942 requested_loc = std::distance(position,
begin());
945 requested_loc = std::distance(
begin(), position);
947 const char* fmt =
"Iterator index is out of bounds: "
948 "[iterator index=%i; iterator extent=%i]";
949 throw index_out_of_bounds(fmt, requested_loc, available_locs ) ;
952 R_xlen_t n =
size() ;
959 if( Rf_isNull(
names) ){
961 for( ; it < position; ++it, ++target_it, i++){
965 for( ; it < this_end ; ++it, ++target_it){
968 Storage::set__( target.
get__() ) ;
973 for( ; it < position; ++it, ++target_it,i++){
975 SET_STRING_ELT( newnames, i , STRING_ELT(
names,i) ) ;
980 for( ; it < this_end ; ++it, ++target_it, i++){
982 SET_STRING_ELT( newnames, i-1, STRING_ELT(
names,i) ) ;
984 target.
attr(
"names" ) = newnames ;
985 Storage::set__( target.
get__() ) ;
991 if( first > last )
throw std::range_error(
"invalid range") ;
992 if( last >
end() || first <
begin() ) {
993 R_xlen_t requested_loc;
994 R_xlen_t available_locs = std::distance(
begin(),
end());
995 std::string iter_problem;
998 requested_loc = std::distance(last,
begin());
999 iter_problem =
"last";
1002 requested_loc = std::distance(
begin(), first);
1003 iter_problem =
"first";
1005 const char* fmt =
"Iterator index is out of bounds: "
1006 "[iterator=%s; index=%i; extent=%i]";
1007 throw index_out_of_bounds(fmt, iter_problem,
1008 requested_loc, available_locs ) ;
1013 R_xlen_t nremoved = std::distance(first,last) ;
1014 R_xlen_t target_size =
size() - nremoved ;
1015 Vector target( target_size ) ;
1020 if( Rf_isNull(
names) ){
1022 for( ; it < first; ++it, ++target_it, i++ ){
1026 for( it = last ; it < this_end; ++it, ++target_it ){
1030 Shield<SEXP> newnames( ::Rf_allocVector(STRSXP, target_size) ) ;
1032 for( ; it < first; ++it, ++target_it, i++ ){
1034 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i ) );
1037 for( it = last ; it < this_end; ++it, ++target_it, i++ ){
1039 SET_STRING_ELT( newnames, i, STRING_ELT(
names, i + nremoved ) );
1041 target.
attr(
"names" ) = newnames ;
1043 Storage::set__( target.
get__() ) ;
1049 template <
typename T>
1051 R_xlen_t n =
size() ;
1052 if( n == x.size() ){
1059 Storage::set__(casted);
1064 template <
typename T>
1070 template <
typename T>
1074 Storage::set__(casted);
1078 template <
bool NA,
typename VEC>
1080 RCPP_DEBUG_4(
"Vector<%d>::import_sugar_expression( VectorBase<%d,%d,%s>, false_type )", RTYPE,
NA, RTYPE,
DEMANGLE(VEC) ) ;
1081 R_xlen_t n = other.
size() ;
1082 Storage::set__( Rf_allocVector( RTYPE, n ) ) ;
1087 template <
bool NA,
typename VEC>
1089 RCPP_DEBUG_4(
"Vector<%d>::import_sugar_expression( VectorBase<%d,%d,%s>, true_type )", RTYPE,
NA, RTYPE,
DEMANGLE(VEC) ) ;
1090 Storage::set__( other.
get_ref() ) ;
1094 template <
typename T>
1100 template <
typename T>
1105 template <
typename T>
1109 while( first != last ) *first++ = gen() ;
1112 template <
typename T>
1117 template <
typename U>
1122 for( R_xlen_t i=0; i<
size() ; i++, ++it){
1123 *it = ::Rf_duplicate( elem ) ;
1127 template <
typename U>
1139 template <
typename... T>
1147 template <
typename... T>
1149 Vector res(
sizeof...(T)) ;
1155 template <
typename... T>
1157 Vector res(
sizeof...(T)) ;
1166 template <
typename T>
1171 template <
typename T,
typename... TArgs>
1177 template <
typename T>
1182 template <
typename T,
typename... TArgs>
1191 return Rcpp_eval( Storage::get__(), R_GlobalEnv ) ;
1195 return Rcpp_eval( Storage::get__(), env );
1201template <
int RTYPE,
template <
class>
class StoragePolicy >
1205 typename VECTOR::iterator i =
const_cast<VECTOR &
>(rhs).begin();
1206 typename VECTOR::iterator iend =
const_cast<VECTOR &
>(rhs).end();
1212 for ( ; i != iend; ++i) {
1220template<
template <
class>
class StoragePolicy >
1224 typename VECTOR::iterator i =
const_cast<VECTOR &
>(rhs).begin();
1225 typename VECTOR::iterator iend =
const_cast<VECTOR &
>(rhs).end();
1228 s <<
"\"" << (*i) <<
"\"";
1231 for ( ; i != iend; ++i) {
1232 s <<
" \"" << (*i) <<
"\"";
AttributeProxy attr(const std::string &name)
void fill_or_generate__impl(const T &t, traits::false_type)
traits::storage_type< RTYPE >::type stored_type
void fill_or_generate(const T &t)
iterator erase_range__impl(iterator first, iterator last)
static Vector import_transform(InputIterator first, InputIterator last, F f)
iterator erase(int position)
internal::RangeIndexer< RTYPE, true, Vector > Indexer
Vector & operator=(const T &x)
SEXP eval(SEXP env) const
Vector(const GenericProxy< Proxy > &proxy)
Vector(std::initializer_list< init_type > list)
Vector(const T &size, const U &u, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
Vector(const Dimension &dims)
R_xlen_t findName(const std::string &name) const
Vector(const T &size, const stored_type &u, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
void push_front_name__impl(const stored_type &object, const std::string &name, traits::false_type)
void import_sugar_expression(const Rcpp::VectorBase< RTYPE, NA, VEC > &other, traits::true_type)
void push_back__impl(const stored_type &object, traits::true_type)
iterator erase_single__impl(iterator position)
traits::r_vector_cache_type< RTYPE, StoragePolicy >::type cache
std::enable_if< std::is_integral< T >::value &&!std::is_same< T, R_xlen_t >::value, const_Proxy >::type operator[](T i) const
const_Proxy operator[](R_xlen_t i) const
Vector & operator+=(const VectorBase< RTYPE, false, EXPR_VEC > &rhs)
void assign(InputIterator first, InputIterator last)
Vector & operator+=(const VectorBase< RTYPE, true, EXPR_VEC > &rhs)
void push_back_name__impl(const stored_type &object, const std::string &name, traits::true_type)
static Vector create(const T &... t)
Vector(const std::string &st)
const_iterator begin() const
NameProxy operator[](const std::string &name) const
static bool is_na(stored_type x)
void push_front__impl(const stored_type &object, traits::true_type)
const_Proxy operator()(const size_t &i) const
void push_front_name__impl(const stored_type &object, const std::string &name, traits::true_type)
Vector(const Dimension &dims, const U &u)
Vector(const T &siz, stored_type(*gen)(void), typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
static Vector create__dispatch(traits::false_type, const T &... t)
static Vector create__dispatch(traits::true_type, const T &... t)
iterator insert__impl(iterator position, const stored_type &object_, traits::true_type)
bool containsElementNamed(const char *target) const
static void create_dispatch_impl(iterator &it, const T &t, const TArgs &... args)
Proxy operator()(const size_t &i, const size_t &j)
traits::r_vector_const_iterator< RTYPE, StoragePolicy >::type const_iterator
static void replace_element__dispatch(traits::true_type, iterator it, SEXP names, R_xlen_t index, const U &u)
static void replace_element(iterator it, SEXP names, R_xlen_t index, const U &u)
Proxy operator[](R_xlen_t i)
void fill__dispatch(traits::false_type, const U &u)
const_Proxy operator()(const size_t &i, const size_t &j) const
Indexer operator[](const Range &range)
R_xlen_t offset(const int &i, const int &j) const
iterator insert(iterator position, const T &object)
Vector(const sugar::SingleLogicalResult< NA, T > &obj)
const_iterator end() const
NameProxy operator()(const std::string &name) const
static void replace_element__dispatch__isArgument(traits::false_type, iterator it, SEXP names, R_xlen_t index, const U &u)
traits::r_vector_name_proxy< RTYPE, StoragePolicy >::type NameProxy
traits::r_vector_proxy< RTYPE, StoragePolicy >::type value_type
const SubsetProxy< RTYPE, StoragePolicy, RHS_RTYPE, RHS_NA, RHS_T > operator[](const VectorBase< RHS_RTYPE, RHS_NA, RHS_T > &rhs) const
static void replace_element_impl(iterator &it, Shield< SEXP > &names, int &index, const T &t, const TArgs &... args)
traits::r_vector_element_converter< RTYPE >::type converter_type
Vector(T size, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
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)
void push_front(const T &object, const std::string &name)
Vector(const T &siz, stored_type(*gen)(U1), const U1 &u1, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
void push_front__impl(const stored_type &object, traits::false_type)
static stored_type get_na()
void import_sugar_expression(const Rcpp::VectorBase< RTYPE, NA, VEC > &other, traits::false_type)
static void replace_element_impl(iterator &it, Shield< SEXP > &names, int &index, const T &t)
NameProxy operator()(const std::string &name)
void import_expression(const T &other, R_xlen_t n)
StoragePolicy< Vector > Storage
const_iterator cbegin() const
SubsetProxy< RTYPE, StoragePolicy, RHS_RTYPE, RHS_NA, RHS_T > operator[](const VectorBase< RHS_RTYPE, RHS_NA, RHS_T > &rhs)
void push_back(const T &object)
Vector(InputIterator first, InputIterator last, Func func, T n, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
Vector(const int &size, const stored_type &u)
void push_front(const T &object)
R_xlen_t offset(const R_xlen_t &i) const
Proxy at(const size_t &i)
void assign_object(const T &x, traits::true_type)
static void create_dispatch_impl(iterator &it, const T &t)
static void replace_element__dispatch(traits::false_type, iterator it, SEXP names, R_xlen_t index, const U &u)
Vector(InputIterator first, InputIterator last, Func func)
const_Proxy at(const size_t &i) const
void push_back__impl(const stored_type &object, traits::false_type)
Vector(InputIterator first, InputIterator last)
NameProxy operator[](const std::string &name)
static void replace_element__dispatch__isArgument(traits::true_type, iterator it, SEXP names, R_xlen_t index, const U &u)
Vector & operator=(const Vector &rhs)
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)
traits::r_vector_iterator< RTYPE, StoragePolicy >::type iterator
Vector(const no_init_vector &obj)
const_iterator cend() const
traits::init_type< RTYPE >::type init_type
void fill__dispatch(traits::true_type, const U &u)
std::enable_if< std::is_integral< T >::value &&!std::is_same< T, R_xlen_t >::value, Proxy >::type operator[](T i)
Vector(InputIterator first, InputIterator last, T n, typename Rcpp::traits::enable_if< traits::is_arithmetic< T >::value, void >::type *=0)
Vector(const Vector &other)
iterator insert(int position, const T &object)
Proxy operator()(const size_t &i)
Vector(const VectorBase< RTYPE, NA, VEC > &other)
iterator insert__impl(iterator position, const stored_type &object, traits::false_type)
void push_back(const T &object, const std::string &name)
traits::r_vector_const_proxy< RTYPE, StoragePolicy >::type const_Proxy
void fill_or_generate__impl(const T &gen, traits::true_type)
Vector(T value, typename Rcpp::traits::enable_if< traits::is_bool< T >::value &&RTYPE==LGLSXP, void >::type *=0)
iterator erase(iterator position)
iterator erase(iterator first, iterator last)
traits::r_vector_proxy< RTYPE, StoragePolicy >::type Proxy
R_xlen_t offset(const std::string &name) const
iterator erase(int first, int last)
void assign_sugar_expression(const T &x)
void push_back_name__impl(const stored_type &object, const std::string &name, traits::false_type)
void assign_object(const T &x, traits::false_type)
Vector & sort(bool decreasing=false)
static target get(const T &input)
#define RCPP_DEBUG_2(fmt, M1, M2)
#define RCPP_DEBUG_1(fmt, MSG)
#define RCPP_DEBUG_4(fmt, M1, M2, M3, M4)
#define DEMANGLE(__TYPE__)
#define RCPP_GET_NAMES(x)
SEXP vector_from_string(const std::string &st)
storage_type< RTYPE >::type get_na()
integral_constant< bool, true > true_type
bool is_na(typename storage_type< RTYPE >::type)
integral_constant< bool, false > false_type
std::ostream & operator<<(std::ostream &os, const Date d)
void NORET stop(const std::string &message)
sugar::Range< RTYPE, NA, T > range(const VectorBase< RTYPE, NA, T > &x)
DottedPairProxyPolicy< Language_Impl >::const_DottedPairProxy const_Proxy
SEXP Rcpp_eval(SEXP expr, SEXP env)
RObject_Impl< PreserveStorage > RObject
SEXP wrap(const Date &date)
storage_type< RTYPE >::type type
integral_constant< bool, _V > type
r_vector_cache< RTYPE, StoragePolicy > type
const storage_type< RTYPE >::type * type
const storage_type< RTYPE >::type & type
::Rcpp::internal::element_converter< RTYPE > type
storage_type< RTYPE >::type * type
::Rcpp::internal::simple_name_proxy< RTYPE, StoragePolicy > type
storage_type< RTYPE >::type & type
#define RCPP_LOOP_UNROLL(TARGET, SOURCE)