diff --git a/cpp/opaque-rust.cpp b/cpp/opaque-rust.cpp index e4034e5..8a24bb9 100644 --- a/cpp/opaque-rust.cpp +++ b/cpp/opaque-rust.cpp @@ -340,7 +340,8 @@ typename Slice::iterator::difference_type Slice::iterator::operator-(const iterator &other) const noexcept { auto diff = std::distance(static_cast(other.pos), static_cast(this->pos)); - return diff / this->stride; + return diff / static_cast::iterator::difference_type>( + this->stride); } template diff --git a/cpp/opaque-rust.h b/cpp/opaque-rust.h index 5d674da..14241a0 100644 --- a/cpp/opaque-rust.h +++ b/cpp/opaque-rust.h @@ -340,7 +340,8 @@ typename Slice::iterator::difference_type Slice::iterator::operator-(const iterator &other) const noexcept { auto diff = std::distance(static_cast(other.pos), static_cast(this->pos)); - return diff / this->stride; + return diff / static_cast::iterator::difference_type>( + this->stride); } template