From b16b2d2aea3782c9dd1b970aaa3721b67f1ca6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Wed, 18 Mar 2026 16:31:56 +0100 Subject: [PATCH] Added segmented all_of, none_of, any_of versions --- .../experimental/segmented_all_of.hpp | 43 +++++++++++++++++++ .../experimental/segmented_any_of.hpp | 42 ++++++++++++++++++ .../experimental/segmented_none_of.hpp | 42 ++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 include/boost/container/experimental/segmented_all_of.hpp create mode 100644 include/boost/container/experimental/segmented_any_of.hpp create mode 100644 include/boost/container/experimental/segmented_none_of.hpp diff --git a/include/boost/container/experimental/segmented_all_of.hpp b/include/boost/container/experimental/segmented_all_of.hpp new file mode 100644 index 0000000..dd774cf --- /dev/null +++ b/include/boost/container/experimental/segmented_all_of.hpp @@ -0,0 +1,43 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2025-2026. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_EXPERIMENTAL_SEGMENTED_ALL_OF_HPP +#define BOOST_CONTAINER_EXPERIMENTAL_SEGMENTED_ALL_OF_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include +#include +#include + +namespace boost { +namespace container { + +//! Returns \c true if \c pred returns true for all elements +//! in [first, last), or if the range is empty. +template +BOOST_CONTAINER_FORCEINLINE +bool segmented_all_of(InpIter first, Sent last, Pred pred) +{ + return (segmented_find_if)(first, last, not_pred(pred)) == last; +} + +} // namespace container +} // namespace boost + +#include + +#endif // BOOST_CONTAINER_EXPERIMENTAL_SEGMENTED_ALL_OF_HPP diff --git a/include/boost/container/experimental/segmented_any_of.hpp b/include/boost/container/experimental/segmented_any_of.hpp new file mode 100644 index 0000000..3ffcc33 --- /dev/null +++ b/include/boost/container/experimental/segmented_any_of.hpp @@ -0,0 +1,42 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2025-2026. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_EXPERIMENTAL_SEGMENTED_ANY_OF_HPP +#define BOOST_CONTAINER_EXPERIMENTAL_SEGMENTED_ANY_OF_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include +#include + +namespace boost { +namespace container { + +//! Returns \c true if \c pred returns true for at least one element +//! in [first, last). Returns \c false if the range is empty. +template +BOOST_CONTAINER_FORCEINLINE +bool segmented_any_of(InpIter first, Sent last, Pred pred) +{ + return !((segmented_find_if)(first, last, pred) == last); +} + +} // namespace container +} // namespace boost + +#include + +#endif // BOOST_CONTAINER_EXPERIMENTAL_SEGMENTED_ANY_OF_HPP diff --git a/include/boost/container/experimental/segmented_none_of.hpp b/include/boost/container/experimental/segmented_none_of.hpp new file mode 100644 index 0000000..e53722d --- /dev/null +++ b/include/boost/container/experimental/segmented_none_of.hpp @@ -0,0 +1,42 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2025-2026. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_EXPERIMENTAL_SEGMENTED_NONE_OF_HPP +#define BOOST_CONTAINER_EXPERIMENTAL_SEGMENTED_NONE_OF_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include +#include + +namespace boost { +namespace container { + +//! Returns \c true if \c pred returns false for all elements +//! in [first, last), or if the range is empty. +template +BOOST_CONTAINER_FORCEINLINE +bool segmented_none_of(InpIter first, Sent last, Pred pred) +{ + return (segmented_find_if)(first, last, pred) == last; +} + +} // namespace container +} // namespace boost + +#include + +#endif // BOOST_CONTAINER_EXPERIMENTAL_SEGMENTED_NONE_OF_HPP