From e9a94cb62a2b0395e7ce9efc17d42651362fb328 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Mon, 10 Oct 2022 15:47:00 -0700 Subject: [PATCH] Force inlining for find() member functions in the flat containers --- include/boost/unordered/unordered_flat_map.hpp | 11 +++++++---- include/boost/unordered/unordered_flat_set.hpp | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/boost/unordered/unordered_flat_map.hpp b/include/boost/unordered/unordered_flat_map.hpp index f9309ac7..46784ac4 100644 --- a/include/boost/unordered/unordered_flat_map.hpp +++ b/include/boost/unordered/unordered_flat_map.hpp @@ -353,15 +353,18 @@ namespace boost { return pos != table_.end() ? 1 : 0; } - iterator find(key_type const& key) { return table_.find(key); } + BOOST_FORCEINLINE iterator find(key_type const& key) + { + return table_.find(key); + } - const_iterator find(key_type const& key) const + BOOST_FORCEINLINE const_iterator find(key_type const& key) const { return table_.find(key); } template - typename std::enable_if< + BOOST_FORCEINLINE typename std::enable_if< boost::unordered::detail::are_transparent::value, iterator>::type find(K const& key) @@ -370,7 +373,7 @@ namespace boost { } template - typename std::enable_if< + BOOST_FORCEINLINE typename std::enable_if< boost::unordered::detail::are_transparent::value, const_iterator>::type find(K const& key) const diff --git a/include/boost/unordered/unordered_flat_set.hpp b/include/boost/unordered/unordered_flat_set.hpp index 83b57484..98f2534c 100644 --- a/include/boost/unordered/unordered_flat_set.hpp +++ b/include/boost/unordered/unordered_flat_set.hpp @@ -247,15 +247,18 @@ namespace boost { return pos != table_.end() ? 1 : 0; } - iterator find(key_type const& key) { return table_.find(key); } + BOOST_FORCEINLINE iterator find(key_type const& key) + { + return table_.find(key); + } - const_iterator find(key_type const& key) const + BOOST_FORCEINLINE const_iterator find(key_type const& key) const { return table_.find(key); } template - typename std::enable_if< + BOOST_FORCEINLINE typename std::enable_if< boost::unordered::detail::are_transparent::value, iterator>::type find(K const& key) @@ -264,7 +267,7 @@ namespace boost { } template - typename std::enable_if< + BOOST_FORCEINLINE typename std::enable_if< boost::unordered::detail::are_transparent::value, const_iterator>::type find(K const& key) const