This commit is contained in:
2026-03-23 20:54:41 +08:00
commit e13b3650e9
4596 changed files with 1015768 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
// (C) Copyright David Abrahams 2002.
// (C) Copyright Jeremy Siek 2002.
// (C) Copyright Thomas Witt 2002.
// 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)
// no include guard multiple inclusion intended
//
// This is a temporary workaround until the bulk of this is
// available in boost config.
// 23/02/03 thw
//
#include <boost/config.hpp> // for prior
#include <boost/detail/workaround.hpp>
#ifdef BOOST_ITERATOR_CONFIG_DEF
# error you have nested config_def #inclusion.
#else
# define BOOST_ITERATOR_CONFIG_DEF
#endif
// We enable this always now. Otherwise, the simple case in
// libs/iterator/test/constant_iterator_arrow.cpp fails to compile
// because the operator-> return is improperly deduced as a non-const
// pointer.
// Recall that in general, compilers without partial specialization
// can't strip constness. Consider counting_iterator, which normally
// passes a const Value to iterator_facade. As a result, any code
// which makes a std::vector of the iterator's value_type will fail
// when its allocator declares functions overloaded on reference and
// const_reference (the same type).
//
// Furthermore, Borland 5.5.1 drops constness in enough ways that we
// end up using a proxy for operator[] when we otherwise shouldn't.
// Using reference constness gives it an extra hint that it can
// return the value_type from operator[] directly, but is not
// strictly necessary. Not sure how best to resolve this one.
# define BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY 1
// no include guard; multiple inclusion intended

View File

@@ -0,0 +1,20 @@
// (C) Copyright Thomas Witt 2002.
// 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)
// no include guard multiple inclusion intended
//
// This is a temporary workaround until the bulk of this is
// available in boost config.
// 23/02/03 thw
//
#undef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
#ifdef BOOST_ITERATOR_CONFIG_DEF
# undef BOOST_ITERATOR_CONFIG_DEF
#else
# error missing or nested #include config_def
#endif

View File

@@ -0,0 +1,44 @@
/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2025 Andrey Semashev
*/
#ifndef BOOST_ITERATOR_DETAIL_EVAL_IF_DEFAULT_HPP_INCLUDED_
#define BOOST_ITERATOR_DETAIL_EVAL_IF_DEFAULT_HPP_INCLUDED_
#include <boost/core/use_default.hpp>
#include <boost/iterator/detail/type_traits/type_identity.hpp>
namespace boost {
namespace iterators {
namespace detail {
// If T is use_default, return the result of invoking
// DefaultNullaryFn, otherwise - of NondefaultNullaryFn.
// By default, NondefaultNullaryFn returns T, which means
// the metafunction can be called with just two parameters
// and in that case will return either T or the result of
// invoking DefaultNullaryFn.
template< typename T, typename DefaultNullaryFn, typename NondefaultNullaryFn = detail::type_identity< T > >
struct eval_if_default
{
using type = typename NondefaultNullaryFn::type;
};
template< typename DefaultNullaryFn, typename NondefaultNullaryFn >
struct eval_if_default< use_default, DefaultNullaryFn, NondefaultNullaryFn >
{
using type = typename DefaultNullaryFn::type;
};
template< typename T, typename DefaultNullaryFn, typename NondefaultNullaryFn = detail::type_identity< T > >
using eval_if_default_t = typename eval_if_default< T, DefaultNullaryFn, NondefaultNullaryFn >::type;
} // namespace detail
} // namespace iterators
} // namespace boost
#endif // BOOST_ITERATOR_DETAIL_EVAL_IF_DEFAULT_HPP_INCLUDED_

View File

@@ -0,0 +1,179 @@
// Copyright David Abrahams 2003. Use, modification and distribution is
// subject to 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)
#ifndef FACADE_ITERATOR_CATEGORY_DWA20031118_HPP
#define FACADE_ITERATOR_CATEGORY_DWA20031118_HPP
#include <iterator>
#include <type_traits>
#include <boost/mp11/utility.hpp>
#include <boost/iterator/iterator_categories.hpp>
#include <boost/iterator/detail/type_traits/conjunction.hpp>
#include <boost/iterator/detail/type_traits/disjunction.hpp>
#include <boost/iterator/detail/config_def.hpp> // try to keep this last
//
// iterator_category deduction for iterator_facade
//
namespace boost {
namespace iterators {
namespace detail {
#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
template< typename T >
struct is_const_lvalue_reference :
public std::false_type
{};
template< typename T >
struct is_const_lvalue_reference< T const& > :
public std::true_type
{};
#endif // BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
//
// True iff the user has explicitly disabled writability of this
// iterator. Pass the iterator_facade's Value parameter and its
// nested ::reference type.
//
template< typename ValueParam, typename Reference >
struct iterator_writability_disabled :
# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY // Adding Thomas' logic?
public detail::disjunction<
detail::is_const_lvalue_reference< Reference >,
std::is_const< Reference >,
std::is_const< ValueParam >
>
# else
public std::is_const< ValueParam >
# endif
{};
template< typename Traversal, typename ValueParam, typename Reference >
using is_traversal_of_input_iterator = detail::conjunction<
std::is_convertible< Traversal, single_pass_traversal_tag >,
// check for readability
std::is_convertible< Reference, ValueParam >
>;
//
// Convert an iterator_facade's traversal category, Value parameter,
// and ::reference type to an appropriate old-style category.
//
// Due to changeset 21683, this now never results in a category convertible
// to output_iterator_tag.
//
// Change at: https://svn.boost.org/trac/boost/changeset/21683
template< typename Traversal, typename ValueParam, typename Reference >
struct iterator_facade_default_category
{
using type = typename std::conditional<
detail::is_traversal_of_input_iterator< Traversal, ValueParam, Reference >::value,
std::input_iterator_tag,
Traversal
>::type;
};
// Specialization for the (typical) case when the reference type is an actual reference
template< typename Traversal, typename ValueParam, typename Referenced >
struct iterator_facade_default_category< Traversal, ValueParam, Referenced& >
{
using type = mp11::mp_cond<
std::is_convertible< Traversal, random_access_traversal_tag >, std::random_access_iterator_tag,
std::is_convertible< Traversal, bidirectional_traversal_tag >, std::bidirectional_iterator_tag,
std::is_convertible< Traversal, forward_traversal_tag >, std::forward_iterator_tag,
detail::is_traversal_of_input_iterator< Traversal, ValueParam, Referenced& >, std::input_iterator_tag,
std::true_type, Traversal
>;
};
template< typename Traversal, typename ValueParam, typename Reference >
using iterator_facade_default_category_t = typename iterator_facade_default_category< Traversal, ValueParam, Reference >::type;
// True iff T is convertible to an old-style iterator category.
template< typename T >
struct is_iterator_category :
public detail::disjunction<
std::is_convertible< T, std::input_iterator_tag >,
std::is_convertible< T, std::output_iterator_tag >
>
{};
template< typename T >
struct is_iterator_traversal :
public std::is_convertible< T, incrementable_traversal_tag >
{};
//
// A composite iterator_category tag convertible to Category (a pure
// old-style category) and Traversal (a pure traversal tag).
// Traversal must be a strict increase of the traversal power given by
// Category.
//
template< typename Category, typename Traversal >
struct iterator_category_with_traversal :
public Category,
public Traversal
{
// Make sure this isn't used to build any categories where
// convertibility to Traversal is redundant. Should just use the
// Category element in that case.
static_assert(
!std::is_convertible< iterator_category_to_traversal_t< Category >, Traversal >::value,
"Category transformed to corresponding traversal must be convertible to Traversal."
);
static_assert(is_iterator_category< Category >::value, "Category must be an STL iterator category.");
static_assert(!is_iterator_category< Traversal >::value, "Traversal must not be an STL iterator category.");
static_assert(!is_iterator_traversal< Category >::value, "Category must not be a traversal tag.");
static_assert(is_iterator_traversal< Traversal >::value, "Traversal must be a traversal tag.");
};
// Computes an iterator_category tag whose traversal is Traversal and
// which is appropriate for an iterator
template< typename Traversal, typename ValueParam, typename Reference >
struct facade_iterator_category_impl
{
static_assert(!is_iterator_category< Traversal >::value, "Traversal must not be an STL iterator category.");
using category = iterator_facade_default_category_t< Traversal, ValueParam, Reference >;
using type = typename std::conditional<
std::is_same<
Traversal,
typename iterator_category_to_traversal< category >::type
>::value,
category,
iterator_category_with_traversal< category, Traversal >
>::type;
};
template< typename Traversal, typename ValueParam, typename Reference >
using facade_iterator_category_impl_t = typename facade_iterator_category_impl< Traversal, ValueParam, Reference >::type;
//
// Compute an iterator_category for iterator_facade
//
template< typename CategoryOrTraversal, typename ValueParam, typename Reference >
struct facade_iterator_category
{
using type = mp11::mp_eval_if<
is_iterator_category< CategoryOrTraversal >,
CategoryOrTraversal, // old-style categories are fine as-is
facade_iterator_category_impl_t, CategoryOrTraversal, ValueParam, Reference
>;
};
}}} // namespace boost::iterators::detail
#include <boost/iterator/detail/config_undef.hpp>
#endif // FACADE_ITERATOR_CATEGORY_DWA20031118_HPP

View File

@@ -0,0 +1,41 @@
/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2025 Andrey Semashev
*/
#ifndef BOOST_ITERATOR_DETAIL_IF_DEFAULT_HPP_INCLUDED_
#define BOOST_ITERATOR_DETAIL_IF_DEFAULT_HPP_INCLUDED_
#include <boost/core/use_default.hpp>
namespace boost {
namespace iterators {
namespace detail {
// If T is use_default, return Default, otherwise - Nondefault.
// By default, Nondefault is T, which means
// the metafunction can be called with just two parameters
// and in that case will return either T or Default.
template< typename T, typename Default, typename Nondefault = T >
struct if_default
{
using type = Nondefault;
};
template< typename Default, typename Nondefault >
struct if_default< use_default, Default, Nondefault >
{
using type = Default;
};
template< typename T, typename Default, typename Nondefault = T >
using if_default_t = typename if_default< T, Default, Nondefault >::type;
} // namespace detail
} // namespace iterators
} // namespace boost
#endif // BOOST_ITERATOR_DETAIL_IF_DEFAULT_HPP_INCLUDED_

View File

@@ -0,0 +1,53 @@
/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2024 Georgiy Guminov
*/
/*!
* \file iterator/detail/type_traits/conjunction.hpp
*
* This header contains definition of \c conjunction type trait.
*/
#ifndef BOOST_ITERATOR_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_
#define BOOST_ITERATOR_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_
#include <type_traits>
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#if (defined(__cpp_lib_logical_traits) && (__cpp_lib_logical_traits >= 201510l)) || \
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190023918) && (BOOST_CXX_VERSION >= 201703l))
namespace boost {
namespace iterators {
namespace detail {
using std::conjunction;
} // namespace detail
} // namespace iterator
} // namespace boost
#else
#include <boost/type_traits/conjunction.hpp>
namespace boost {
namespace iterators {
namespace detail {
using boost::conjunction;
} // namespace detail
} // namespace iterator
} // namespace boost
#endif
#endif // BOOST_ITERATOR_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_

View File

@@ -0,0 +1,53 @@
/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2024 Georgiy Guminov
*/
/*!
* \file iterator/detail/type_traits/disjunction.hpp
*
* This header contains definition of \c disjunction type trait.
*/
#ifndef BOOST_ITERATOR_DETAIL_TYPE_TRAITS_DISJUNCTION_HPP_INCLUDED_
#define BOOST_ITERATOR_DETAIL_TYPE_TRAITS_DISJUNCTION_HPP_INCLUDED_
#include <type_traits>
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#if (defined(__cpp_lib_logical_traits) && (__cpp_lib_logical_traits >= 201510l)) || \
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190023918) && (BOOST_CXX_VERSION >= 201703l))
namespace boost {
namespace iterators {
namespace detail {
using std::disjunction;
} // namespace detail
} // namespace iterator
} // namespace boost
#else
#include <boost/type_traits/disjunction.hpp>
namespace boost {
namespace iterators {
namespace detail {
using boost::disjunction;
} // namespace detail
} // namespace iterator
} // namespace boost
#endif
#endif // BOOST_ITERATOR_DETAIL_TYPE_TRAITS_DISJUNCTION_HPP_INCLUDED_

View File

@@ -0,0 +1,53 @@
/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2024 Georgiy Guminov
*/
/*!
* \file iterator/detail/type_traits/negation.hpp
*
* This header contains definition of \c negation type trait.
*/
#ifndef BOOST_ITERATOR_DETAIL_TYPE_TRAITS_NEGATION_HPP_INCLUDED_
#define BOOST_ITERATOR_DETAIL_TYPE_TRAITS_NEGATION_HPP_INCLUDED_
#include <type_traits>
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#if (defined(__cpp_lib_logical_traits) && (__cpp_lib_logical_traits >= 201510l)) || \
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190023918) && (BOOST_CXX_VERSION >= 201703l))
namespace boost {
namespace iterators {
namespace detail {
using std::negation;
} // namespace detail
} // namespace iterator
} // namespace boost
#else
#include <boost/type_traits/negation.hpp>
namespace boost {
namespace iterators {
namespace detail {
using boost::negation;
} // namespace detail
} // namespace iterator
} // namespace boost
#endif
#endif // BOOST_ITERATOR_DETAIL_TYPE_TRAITS_NEGATION_HPP_INCLUDED_

View File

@@ -0,0 +1,54 @@
/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2025 Andrey Semashev
*/
/*!
* \file iterator/detail/type_traits/type_identity.hpp
*
* This header contains definition of \c negation type trait.
*/
#ifndef BOOST_ITERATOR_DETAIL_TYPE_TRAITS_TYPE_IDENTITY_HPP_INCLUDED_
#define BOOST_ITERATOR_DETAIL_TYPE_TRAITS_TYPE_IDENTITY_HPP_INCLUDED_
#include <type_traits>
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#if (defined(__cpp_lib_type_identity) && (__cpp_lib_type_identity >= 201806l)) || \
/* Note: MSVC 19.21 does not define _MSVC_LANG to 202002 in c++latest (C++20) mode but to a value larger than 201703 */ \
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 142) && (_MSC_VER >= 1921) && (BOOST_CXX_VERSION > 201703l))
namespace boost {
namespace iterators {
namespace detail {
using std::type_identity;
} // namespace detail
} // namespace iterator
} // namespace boost
#else
#include <boost/type_traits/type_identity.hpp>
namespace boost {
namespace iterators {
namespace detail {
using boost::type_identity;
} // namespace detail
} // namespace iterator
} // namespace boost
#endif
#endif // BOOST_ITERATOR_DETAIL_TYPE_TRAITS_TYPE_IDENTITY_HPP_INCLUDED_