| 811 | // {{{ wrap a container that is structured in row major order |
| 812 | template <typename value_type, typename InputIterator> |
| 813 | inline SEXP rowmajor_wrap__dispatch(InputIterator first, int nrow, int ncol, ::Rcpp::traits::r_type_generic_tag) { |
| 814 | Shield<SEXP> out(::Rf_allocVector(VECSXP, nrow * ncol)); |
| 815 | int i=0, j=0; |
| 816 | for (j=0; j<ncol; j++) { |
| 817 | for (i=0; i<nrow; i++, ++first) { |
| 818 | SET_VECTOR_ELT(out, j + ncol*i, ::Rcpp::wrap(*first)); |
| 819 | } |
| 820 | } |
| 821 | Shield<SEXP> dims(::Rf_allocVector(INTSXP, 2)); |
| 822 | INTEGER(dims)[0] = nrow; |
| 823 | INTEGER(dims)[1] = ncol; |
| 824 | ::Rf_setAttrib(out, R_DimSymbol, dims); |
| 825 | return out; |
| 826 | } |
| 827 | |
| 828 | template <typename value_type, typename InputIterator> |
| 829 | inline SEXP rowmajor_wrap__dispatch(InputIterator first, int nrow, int ncol, ::Rcpp::traits::r_type_string_tag) { |
nothing calls this directly
no test coverage detected