@@ -484,14 +484,10 @@ class shape {
484
484
return at (std::make_tuple (indices...));
485
485
}
486
486
/* * Compute the flat offset of the index 'indices'. */
487
- index_t operator () (const index_type& indices) const {
488
- return internal::flat_offset (dims_, indices);
489
- }
487
+ index_t operator () (const index_type& indices) const { return internal::flat_offset (dims_, indices); }
490
488
template <typename ... Indices,
491
489
typename = typename std::enable_if<internal::all_integral<Indices...>::value>::type>
492
- index_t operator () (Indices... indices) const {
493
- return (*this )(std::make_tuple (indices...));
494
- }
490
+ index_t operator () (Indices... indices) const { return (*this )(std::make_tuple (indices...)); }
495
491
496
492
/* * Get a specific dim of this shape. */
497
493
template <size_t D>
@@ -1100,24 +1096,17 @@ class array_ref {
1100
1096
1101
1097
/* * Get a reference to the element at the given 'indices'. If the 'indices'
1102
1098
* are out of range of 'shape()', throws std::out_of_range. */
1103
- reference at (const index_type& indices) const {
1104
- return base_[shape_.at (indices)];
1105
- }
1099
+ reference at (const index_type& indices) const { return base_[shape_.at (indices)]; }
1106
1100
template <typename ... Indices,
1107
1101
typename = typename std::enable_if<internal::all_integral<Indices...>::value>::type>
1108
- reference at (Indices... indices) const {
1109
- return base_[shape_.at (indices...)];
1110
- }
1102
+ reference at (Indices... indices) const { return base_[shape_.at (indices...)]; }
1111
1103
1112
1104
/* * Get a reference to the element at the given indices. */
1113
- reference operator () (const index_type& indices) const {
1114
- return base_[shape_ (indices)];
1115
- }
1105
+ reference operator () (const index_type& indices) const { return base_[shape_ (indices)]; }
1106
+ reference operator [] (const index_type& indices) const { return base_[shape_ (indices)]; }
1116
1107
template <typename ... Indices,
1117
1108
typename = typename std::enable_if<internal::all_integral<Indices...>::value>::type>
1118
- reference operator () (Indices... indices) const {
1119
- return base_[shape_ (indices...)];
1120
- }
1109
+ reference operator () (Indices... indices) const { return base_[shape_ (indices...)]; }
1121
1110
1122
1111
/* * Call a function with a reference to each value in this array_ref. The
1123
1112
* order in which 'fn' is called is undefined. */
@@ -1463,22 +1452,16 @@ class array {
1463
1452
1464
1453
/* * Compute the flat offset of the indices. Does not check if the indices are
1465
1454
* in bounds. */
1466
- reference operator () (const index_type& indices) {
1467
- return base_[shape_ (indices)];
1468
- }
1455
+ reference operator () (const index_type& indices) { return base_[shape_ (indices)]; }
1456
+ reference operator [] (const index_type& indices) { return base_[shape_ (indices)]; }
1457
+ const_reference operator () (const index_type& indices) const { return base_[shape_ (indices)]; }
1458
+ const_reference operator [] (const index_type& indices) const { return base_[shape_ (indices)]; }
1469
1459
template <typename ... Indices,
1470
1460
typename = typename std::enable_if<internal::all_integral<Indices...>::value>::type>
1471
- reference operator () (Indices... indices) {
1472
- return base_[shape_ (indices...)];
1473
- }
1474
- const_reference operator () (const index_type& indices) const {
1475
- return base_[shape_ (indices)];
1476
- }
1461
+ reference operator () (Indices... indices) { return base_[shape_ (indices...)]; }
1477
1462
template <typename ... Indices,
1478
1463
typename = typename std::enable_if<internal::all_integral<Indices...>::value>::type>
1479
- const_reference operator () (Indices... indices) const {
1480
- return base_[shape_ (indices...)];
1481
- }
1464
+ const_reference operator () (Indices... indices) const { return base_[shape_ (indices...)]; }
1482
1465
1483
1466
/* * Call a function with a reference to each value in this array. The order in
1484
1467
* which 'fn' is called is undefined. */
0 commit comments