unum-cloud / usearch

Fast Open-Source Search & Clustering engine × for Vectors & 🔜 Strings × in C++, C, Python, JavaScript, Rust, Java, Objective-C, Swift, C#, GoLang, and Wolfram 🔍
https://unum-cloud.github.io/usearch/
Apache License 2.0
2.15k stars 130 forks source link

Fix -Wdeprecated-this-capture with GCC 11 #387

Closed mbautin closed 6 months ago

mbautin commented 6 months ago

Fixing the warnings below:

../../src/inline-thirdparty/usearch/usearch/index_dense.hpp: In lambda function:
../../src/inline-thirdparty/usearch/usearch/index_dense.hpp:711:22: error: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Werror=deprecated]
  711 |         auto allow = [=](member_cref_t const& member) noexcept { return member.key != free_key_; };
      |                      ^
../../src/inline-thirdparty/usearch/usearch/index_dense.hpp:711:22: note: add explicit ‘this’ or ‘*this’ capture
../../src/inline-thirdparty/usearch/usearch/index_dense.hpp: In lambda function:
../../src/inline-thirdparty/usearch/usearch/index_dense.hpp:1790:22: error: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Werror=deprecated]
 1790 |         auto allow = [=](member_cref_t const& member) noexcept { return member.key != free_key_; };
      |                      ^
../../src/inline-thirdparty/usearch/usearch/index_dense.hpp:1790:22: note: add explicit ‘this’ or ‘*this’ capture
../../src/inline-thirdparty/usearch/usearch/index_dense.hpp: In lambda function:
../../src/inline-thirdparty/usearch/usearch/index_dense.hpp:1813:22: error: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Werror=deprecated]
 1813 |         auto allow = [=](member_cref_t const& member) noexcept { return member.key != free_key_; };
      |                      ^
../../src/inline-thirdparty/usearch/usearch/index_dense.hpp:1813:22: note: add explicit ‘this’ or ‘*this’ capture
cc1plus: all warnings being treated as errors
ashvardanian commented 6 months ago

Sadly this breaks Windows builds. Do you know a good cross-platform fix, @mbautin?

ashvardanian commented 5 months ago

:tada: This PR is included in version 2.11.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: