Skip to content

Commit c81e76a

Browse files
committed
Make operator[] of vec_ptr return a const vector to prevent assignment
1 parent 6edcd19 commit c81e76a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/kernel_float/memory.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,14 @@ struct vector_ptr {
457457
/**
458458
* Shorthand for `read(index)`.
459459
*/
460-
KERNEL_FLOAT_INLINE vector<value_type, extent<N>> operator[](size_t index) const {
460+
KERNEL_FLOAT_INLINE const vector<value_type, extent<N>> operator[](size_t index) const {
461461
return read(index);
462462
}
463463

464464
/**
465465
* Shorthand for `read(0)`.
466466
*/
467-
KERNEL_FLOAT_INLINE vector<value_type, extent<N>> operator*() const {
467+
KERNEL_FLOAT_INLINE const vector<value_type, extent<N>> operator*() const {
468468
return read(0);
469469
}
470470

@@ -522,11 +522,11 @@ struct vector_ptr<T, N, const U> {
522522
return this->template at<K>(index).read();
523523
}
524524

525-
KERNEL_FLOAT_INLINE vector<value_type, extent<N>> operator[](size_t index) const {
525+
KERNEL_FLOAT_INLINE const vector<value_type, extent<N>> operator[](size_t index) const {
526526
return read(index);
527527
}
528528

529-
KERNEL_FLOAT_INLINE vector<value_type, extent<N>> operator*() const {
529+
KERNEL_FLOAT_INLINE const vector<value_type, extent<N>> operator*() const {
530530
return read(0);
531531
}
532532

0 commit comments

Comments
 (0)