22 #ifndef Rcpp_Dimension_h
23 #define Rcpp_Dimension_h
43 dims[0] =
static_cast<int>(n1) ;
46 dims[0] =
static_cast<int>(n1) ;
47 dims[1] =
static_cast<int>(n2) ;
49 Dimension(
const size_t& n1,
const size_t& n2,
const size_t& n3) :
dims(3){
50 dims[0] =
static_cast<int>(n1) ;
51 dims[1] =
static_cast<int>(n2) ;
52 dims[2] =
static_cast<int>(n3) ;
54 operator SEXP()
const ;
57 return (
int)
dims.size() ;
59 inline R_xlen_t
prod()
const {
60 return std::accumulate(
dims.begin(),
dims.end(),
static_cast<R_xlen_t
>(1), std::multiplies<R_xlen_t>() );
64 if( i < 0 || i>=
static_cast<int>(
dims.size()) )
throw std::range_error(
"index out of bounds") ;
68 if( i < 0 || i>=
static_cast<int>(
dims.size()) )
throw std::range_error(
"index out of bounds") ;
reference operator[](int i)
std::vector< int >::reference reference
Dimension & operator=(const Dimension &other)
const_reference operator[](int i) const
Dimension(const size_t &n1)
Dimension(const size_t &n1, const size_t &n2, const size_t &n3)
std::vector< int >::const_reference const_reference
Dimension(const size_t &n1, const size_t &n2)
Dimension(const Dimension &other)