From f8d365013195edc22f04028b5c6202d5a2f664b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Wed, 4 May 2022 22:51:06 +0200 Subject: [PATCH] Add is_empty function --- include/boost/intrusive/circular_list_algorithms.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/boost/intrusive/circular_list_algorithms.hpp b/include/boost/intrusive/circular_list_algorithms.hpp index 8c886aa..a4efc02 100644 --- a/include/boost/intrusive/circular_list_algorithms.hpp +++ b/include/boost/intrusive/circular_list_algorithms.hpp @@ -97,6 +97,16 @@ class circular_list_algorithms NodeTraits::set_previous(this_node, this_node); } + //! Effects: Returns true if this_node_points to an empty list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + BOOST_INTRUSIVE_FORCEINLINE static bool is_empty(const_node_ptr this_node) BOOST_NOEXCEPT + { + return NodeTraits::get_next(this_node) == this_node; + } + //! Requires: this_node must be in a circular list or be an empty circular list. //! //! Effects: Returns true is "this_node" is the only node of a circular list: