mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-16 13:47:53 +00:00
Fixing warnings about conversions in GCC 7+ (#1753)
This commit is contained in:
parent
73b840dc34
commit
9bb3313162
@ -855,14 +855,14 @@ public:
|
|||||||
|
|
||||||
// Reference to element at a given index
|
// Reference to element at a given index
|
||||||
template<typename... Ix> const T& at(Ix... index) const {
|
template<typename... Ix> const T& at(Ix... index) const {
|
||||||
if (sizeof...(index) != ndim())
|
if ((ssize_t) sizeof...(index) != ndim())
|
||||||
fail_dim_check(sizeof...(index), "index dimension mismatch");
|
fail_dim_check(sizeof...(index), "index dimension mismatch");
|
||||||
return *(static_cast<const T*>(array::data()) + byte_offset(ssize_t(index)...) / itemsize());
|
return *(static_cast<const T*>(array::data()) + byte_offset(ssize_t(index)...) / itemsize());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mutable reference to element at a given index
|
// Mutable reference to element at a given index
|
||||||
template<typename... Ix> T& mutable_at(Ix... index) {
|
template<typename... Ix> T& mutable_at(Ix... index) {
|
||||||
if (sizeof...(index) != ndim())
|
if ((ssize_t) sizeof...(index) != ndim())
|
||||||
fail_dim_check(sizeof...(index), "index dimension mismatch");
|
fail_dim_check(sizeof...(index), "index dimension mismatch");
|
||||||
return *(static_cast<T*>(array::mutable_data()) + byte_offset(ssize_t(index)...) / itemsize());
|
return *(static_cast<T*>(array::mutable_data()) + byte_offset(ssize_t(index)...) / itemsize());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user