@@ -510,15 +510,17 @@ class array : public buffer {
510
510
}
511
511
512
512
template <typename ... Ix> size_t byte_offset (Ix... index) const {
513
- check_dimensions (index ...);
514
513
return byte_offset_unsafe (index ...);
515
514
}
516
515
516
+ PYBIND11_DEPRECATED (" Use array<T>::byte_offset() instead" )
517
517
template <size_t dim = 0 , typename ... Ix> size_t byte_offset_unsafe (size_t i, Ix... index) const {
518
518
return i * strides ()[dim] + byte_offset_unsafe<dim + 1 >(index ...);
519
519
}
520
520
521
- template <size_t dim = 0 > size_t byte_offset_unsafe () const { return 0 ; }
521
+ template <size_t dim = 0 > size_t byte_offset_unsafe () const {
522
+ return 0 ;
523
+ }
522
524
523
525
void check_writeable () const {
524
526
if (!writeable ())
@@ -537,21 +539,6 @@ class array : public buffer {
537
539
return strides;
538
540
}
539
541
540
- template <typename ... Ix> void check_dimensions (Ix... index) const {
541
- check_dimensions_impl (size_t (0 ), shape (), size_t (index )...);
542
- }
543
-
544
- void check_dimensions_impl (size_t , const size_t *) const { }
545
-
546
- template <typename ... Ix> void check_dimensions_impl (size_t axis, const size_t * shape, size_t i, Ix... index) const {
547
- if (i >= *shape) {
548
- throw index_error (std::string (" index " ) + std::to_string (i) +
549
- " is out of bounds for axis " + std::to_string (axis) +
550
- " with size " + std::to_string (*shape));
551
- }
552
- check_dimensions_impl (axis + 1 , shape + 1 , index ...);
553
- }
554
-
555
542
// / Create array from any object -- always returns a new reference
556
543
static PyObject *raw_array (PyObject *ptr, int ExtraFlags = 0 ) {
557
544
if (ptr == nullptr )
0 commit comments