Description: Now that C++20 is the baseline for LibreOffice code, it is possible to use C++ features that are only available since C++20. One of the new features of C++20 is the availability of new functions for working with containers more conveniently. This EasyHack is about using contains(). See this commit: 06e3877dc2cf22e00d04b48453e9ab0b948c3ca2 Other than the first part, which is the introduction of contains(), you see changes like this for some variables of type map: - CPPUNIT_ASSERT(aMap.find("LocalURL") != aMap.end()); + CPPUNIT_ASSERT(aMap.contains("LocalURL")); Instead of searching for a specific key, and when reaching .end() concluding that the value is not there, the new code is simply using contains() function to check if the key is present in the map, or not. The actual map data type is SequenceAsHashMapBase, and is based on std::unordered_map. You can read more about contains() here: https://en.cppreference.com/w/cpp/container/map/contains Finding instances: You an use grep to find some instances. For example: $ git grep -n -i "map.find(" | grep "!=" | grep "end(" Working with IDEs: If your IDE is a few years old, there is a chance that it can not recognize contains(). Also, if you have built the project file before, you may have to rebuild the project again. This is needed to make sure that the project files contain the C++20 compatibility option, and not for example C++17. https://wiki.documentfoundation.org/Development/IDE In any case, you need to make sure that LibreOffice can be built correctly.
Luv Sharma committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/a058fa6eb87dcc4a01dac14674e15ff3ba611ced tdf#158237 chart2: use c++20 contains() instead of find() and end() It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Steven Casey (SMCode) committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/a3df4852b8cc1a1445fdc1fe0057b94a5405376d tdf#158237 comphelper: Use C++20 contains() instead of find() and end() It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
AkshayWarrier committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/488cd78f3b30f8b43007a3250d0c11fd0416dde9 tdf#158237 comphelper: Use C++20 contains() instead of find() and end() It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Sujatro Bhadra committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/ddd5017410f4ec2f4860a27f4946e05458686afd tdf#158237 Use C++20 contains() instead of find() and end() It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Beeram_12 committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/7174403b03a7effe8bedf78368c09840b4fdf7a9 tdf#158237 use c++20 contains() instead of find() and end() It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
RMZeroFour committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/74299624ec810f9683326608ad398211cf51787b tdf#158237 Use contains instead of find-end It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Aaron Bourdeaux committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/6c358c28c5cc2d1d8d8bb9d1238e3546a9bf3ce8 tdf#158237 Use C++20 contains() instead of find() and end() It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Zainab Abbasi committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/b00183ebb29d19cb59145a3d240554f8e3573a0b tdf#158237 Use C++20 contains() instead of find() and end() It will be available in 25.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Sohrab Kazak committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/84662e0454eddd928dfdf3cd8f7fe675db6a1fcf tdf#158237 Using C++20 contains instead of find() and end() It will be available in 25.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Sakura286 committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/7bd9aaccb99287e4e50fb18759edc7688502a1fb tdf#158237 comphelper: Use C++20 contains() instead of find() and end() It will be available in 25.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Jack Honour committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/a308151714a2bc811f6f147055175de9767d313a tdf#158237 Use C++20 contains() instead of find() and end() It will be available in 25.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.