Add include guards, move prologue/epilogue into function_template, remove unnecessary headers

This commit is contained in:
Peter Dimov
2024-01-28 05:13:54 +02:00
parent 88da3c6568
commit 6876969bfc
16 changed files with 54 additions and 122 deletions

View File

@ -1,3 +1,6 @@
#ifndef BOOST_FUNCTION_HPP_INCLUDED
#define BOOST_FUNCTION_HPP_INCLUDED
// Boost.Function library // Boost.Function library
// Copyright Douglas Gregor 2001-2003. Use, modification and // Copyright Douglas Gregor 2001-2003. Use, modification and
@ -10,18 +13,6 @@
// William Kempf, Jesse Jones and Karl Nelson were all very helpful in the // William Kempf, Jesse Jones and Karl Nelson were all very helpful in the
// design of this library. // design of this library.
#ifndef BOOST_FUNCTION_MAX_ARGS #include <boost/function/function_template.hpp>
# define BOOST_FUNCTION_MAX_ARGS 10
#endif // BOOST_FUNCTION_MAX_ARGS
#if !defined(BOOST_FUNCTION_MAX_ARGS_DEFINED) || (BOOST_FUNCTION_MAX_ARGS_DEFINED != BOOST_FUNCTION_MAX_ARGS) #endif // #ifndef BOOST_FUNCTION_HPP_INCLUDED
#if !defined(BOOST_FUNCTION_MAX_ARGS_DEFINED)
#define BOOST_FUNCTION_MAX_ARGS_DEFINED 0
#endif
#include <boost/function/detail/prologue.hpp>
#include <boost/function/detail/maybe_include.hpp>
#include <boost/function/detail/epilogue.hpp>
#endif // !defined(BOOST_FUNCTION_MAX_ARGS_DEFINED) || (BOOST_FUNCTION_MAX_ARGS_DEFINED != BOOST_FUNCTION_MAX_ARGS)

View File

@ -1,35 +0,0 @@
// Boost.Function library
#ifndef BOOST_FUNCTION_EPILOGUE_HPP
#define BOOST_FUNCTION_EPILOGUE_HPP
// Copyright 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
// Resolve C++20 issue with fn == bind(...)
// https://github.com/boostorg/function/issues/45
namespace boost
{
namespace _bi
{
template<class R, class F, class L> class bind_t;
} // namespace _bi
template<class S, class R, class F, class L> bool operator==( function<S> const& f, _bi::bind_t<R, F, L> const& b )
{
return f.contains( b );
}
template<class S, class R, class F, class L> bool operator!=( function<S> const& f, _bi::bind_t<R, F, L> const& b )
{
return !f.contains( b );
}
} // namespace boost
#endif // #ifndef BOOST_FUNCTION_EPILOGUE_HPP

View File

@ -1,17 +0,0 @@
// Boost.Function library
// Copyright Douglas Gregor 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)
// For more information, see http://www.boost.org
# undef BOOST_FUNCTION_NUM_ARGS
# define BOOST_FUNCTION_NUM_ARGS 30
# undef BOOST_FUNCTION_MAX_ARGS_DEFINED
# define BOOST_FUNCTION_MAX_ARGS_DEFINED 30
# ifndef BOOST_FUNCTION_VARIADIC_INCLUDED
# define BOOST_FUNCTION_VARIADIC_INCLUDED
# include <boost/function/function_template.hpp>
# endif

View File

@ -1,20 +0,0 @@
// Boost.Function library
// Copyright Douglas Gregor 2002-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)
// For more information, see http://www.boost.org
#ifndef BOOST_FUNCTION_PROLOGUE_HPP
#define BOOST_FUNCTION_PROLOGUE_HPP
# include <boost/function/function_base.hpp>
# include <boost/mem_fn.hpp>
# include <boost/throw_exception.hpp>
# include <boost/type_traits/is_integral.hpp>
# include <boost/type_traits/is_void.hpp>
# include <boost/config.hpp>
# include <algorithm>
# include <cassert>
#endif // BOOST_FUNCTION_PROLOGUE_HPP

View File

@ -7,6 +7,4 @@
// For more information, see http://www.boost.org // For more information, see http://www.boost.org
#define BOOST_FUNCTION_NUM_ARGS 0 #include <boost/function/function_template.hpp>
#include <boost/function/detail/maybe_include.hpp>
#undef BOOST_FUNCTION_NUM_ARGS

View File

@ -7,6 +7,4 @@
// For more information, see http://www.boost.org // For more information, see http://www.boost.org
#define BOOST_FUNCTION_NUM_ARGS 1 #include <boost/function/function_template.hpp>
#include <boost/function/detail/maybe_include.hpp>
#undef BOOST_FUNCTION_NUM_ARGS

View File

@ -7,6 +7,4 @@
// For more information, see http://www.boost.org // For more information, see http://www.boost.org
#define BOOST_FUNCTION_NUM_ARGS 10 #include <boost/function/function_template.hpp>
#include <boost/function/detail/maybe_include.hpp>
#undef BOOST_FUNCTION_NUM_ARGS

View File

@ -7,6 +7,4 @@
// For more information, see http://www.boost.org // For more information, see http://www.boost.org
#define BOOST_FUNCTION_NUM_ARGS 2 #include <boost/function/function_template.hpp>
#include <boost/function/detail/maybe_include.hpp>
#undef BOOST_FUNCTION_NUM_ARGS

View File

@ -7,6 +7,4 @@
// For more information, see http://www.boost.org // For more information, see http://www.boost.org
#define BOOST_FUNCTION_NUM_ARGS 3 #include <boost/function/function_template.hpp>
#include <boost/function/detail/maybe_include.hpp>
#undef BOOST_FUNCTION_NUM_ARGS

View File

@ -7,6 +7,4 @@
// For more information, see http://www.boost.org // For more information, see http://www.boost.org
#define BOOST_FUNCTION_NUM_ARGS 4 #include <boost/function/function_template.hpp>
#include <boost/function/detail/maybe_include.hpp>
#undef BOOST_FUNCTION_NUM_ARGS

View File

@ -7,6 +7,4 @@
// For more information, see http://www.boost.org // For more information, see http://www.boost.org
#define BOOST_FUNCTION_NUM_ARGS 5 #include <boost/function/function_template.hpp>
#include <boost/function/detail/maybe_include.hpp>
#undef BOOST_FUNCTION_NUM_ARGS

View File

@ -7,6 +7,4 @@
// For more information, see http://www.boost.org // For more information, see http://www.boost.org
#define BOOST_FUNCTION_NUM_ARGS 6 #include <boost/function/function_template.hpp>
#include <boost/function/detail/maybe_include.hpp>
#undef BOOST_FUNCTION_NUM_ARGS

View File

@ -7,6 +7,4 @@
// For more information, see http://www.boost.org // For more information, see http://www.boost.org
#define BOOST_FUNCTION_NUM_ARGS 7 #include <boost/function/function_template.hpp>
#include <boost/function/detail/maybe_include.hpp>
#undef BOOST_FUNCTION_NUM_ARGS

View File

@ -7,6 +7,4 @@
// For more information, see http://www.boost.org // For more information, see http://www.boost.org
#define BOOST_FUNCTION_NUM_ARGS 8 #include <boost/function/function_template.hpp>
#include <boost/function/detail/maybe_include.hpp>
#undef BOOST_FUNCTION_NUM_ARGS

View File

@ -7,6 +7,4 @@
// For more information, see http://www.boost.org // For more information, see http://www.boost.org
#define BOOST_FUNCTION_NUM_ARGS 9 #include <boost/function/function_template.hpp>
#include <boost/function/detail/maybe_include.hpp>
#undef BOOST_FUNCTION_NUM_ARGS

View File

@ -1,3 +1,6 @@
#ifndef BOOST_FUNCTION_FUNCTION_TEMPLATE_HPP_INCLUDED
#define BOOST_FUNCTION_FUNCTION_TEMPLATE_HPP_INCLUDED
// Boost.Function library // Boost.Function library
// Copyright Douglas Gregor 2001-2006 // Copyright Douglas Gregor 2001-2006
@ -8,10 +11,15 @@
// For more information, see http://www.boost.org // For more information, see http://www.boost.org
// Note: this header is a header template and must NOT have multiple-inclusion #include <boost/function/function_base.hpp>
// protection.
#include <boost/function/detail/prologue.hpp>
#include <boost/core/no_exceptions_support.hpp> #include <boost/core/no_exceptions_support.hpp>
#include <boost/mem_fn.hpp>
#include <boost/throw_exception.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_void.hpp>
#include <boost/config.hpp>
#include <algorithm>
#include <cassert>
#if defined(BOOST_MSVC) #if defined(BOOST_MSVC)
# pragma warning( push ) # pragma warning( push )
@ -1041,3 +1049,30 @@ public:
#if defined(BOOST_MSVC) #if defined(BOOST_MSVC)
# pragma warning( pop ) # pragma warning( pop )
#endif #endif
// Resolve C++20 issue with fn == bind(...)
// https://github.com/boostorg/function/issues/45
namespace boost
{
namespace _bi
{
template<class R, class F, class L> class bind_t;
} // namespace _bi
template<class S, class R, class F, class L> bool operator==( function<S> const& f, _bi::bind_t<R, F, L> const& b )
{
return f.contains( b );
}
template<class S, class R, class F, class L> bool operator!=( function<S> const& f, _bi::bind_t<R, F, L> const& b )
{
return !f.contains( b );
}
} // namespace boost
#endif // #ifndef BOOST_FUNCTION_FUNCTION_TEMPLATE_HPP_INCLUDED