mirror of
https://github.com/boostorg/function.git
synced 2025-12-16 10:28:37 +01:00
Compare commits
10 Commits
boost-1.82
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d56678401d | ||
|
|
b3905c7394 | ||
|
|
1f3f971d1f | ||
|
|
6eddcae095 | ||
|
|
a6605b5d0b | ||
|
|
8b126c8950 | ||
|
|
7ca2310b15 | ||
|
|
4ecf3e8ad5 | ||
|
|
4d3b477d71 | ||
|
|
a8ae69798d |
26
.github/workflows/ci.yml
vendored
26
.github/workflows/ci.yml
vendored
@@ -65,6 +65,12 @@ jobs:
|
|||||||
os: ubuntu-22.04
|
os: ubuntu-22.04
|
||||||
install: g++-12-multilib
|
install: g++-12-multilib
|
||||||
address-model: 32,64
|
address-model: 32,64
|
||||||
|
- toolset: gcc-13
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:23.04
|
||||||
|
install: g++-13-multilib
|
||||||
|
address-model: 32,64
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-3.9
|
compiler: clang++-3.9
|
||||||
cxxstd: "03,11,14"
|
cxxstd: "03,11,14"
|
||||||
@@ -130,12 +136,21 @@ jobs:
|
|||||||
cxxstd: "03,11,14,17,20,2b"
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
os: ubuntu-22.04
|
os: ubuntu-22.04
|
||||||
install: clang-15
|
install: clang-15
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-16
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:23.04
|
||||||
|
install: clang-16
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
cxxstd: "03,11,14,17,2a"
|
cxxstd: "03,11,14,17,2a"
|
||||||
os: macos-11
|
os: macos-11
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
cxxstd: "03,11,14,17,20,2b"
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
os: macos-12
|
os: macos-12
|
||||||
|
- toolset: clang
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
os: macos-13
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
container: ${{matrix.container}}
|
container: ${{matrix.container}}
|
||||||
@@ -151,11 +166,13 @@ jobs:
|
|||||||
if: matrix.container
|
if: matrix.container
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get -y install sudo python git g++
|
apt-get -y install sudo python3 git g++
|
||||||
|
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
if: matrix.install
|
if: matrix.install
|
||||||
run: sudo apt-get -y install ${{matrix.install}}
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get -y install ${{matrix.install}}
|
||||||
|
|
||||||
- name: Setup Boost
|
- name: Setup Boost
|
||||||
run: |
|
run: |
|
||||||
@@ -175,7 +192,7 @@ jobs:
|
|||||||
cd boost-root
|
cd boost-root
|
||||||
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
git submodule update --init tools/boostdep
|
git submodule update --init tools/boostdep
|
||||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
|
python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
|
||||||
./bootstrap.sh
|
./bootstrap.sh
|
||||||
./b2 -d0 headers
|
./b2 -d0 headers
|
||||||
|
|
||||||
@@ -258,6 +275,7 @@ jobs:
|
|||||||
- os: ubuntu-22.04
|
- os: ubuntu-22.04
|
||||||
- os: macos-11
|
- os: macos-11
|
||||||
- os: macos-12
|
- os: macos-12
|
||||||
|
- os: macos-13
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
@@ -305,6 +323,7 @@ jobs:
|
|||||||
- os: ubuntu-22.04
|
- os: ubuntu-22.04
|
||||||
- os: macos-11
|
- os: macos-11
|
||||||
- os: macos-12
|
- os: macos-12
|
||||||
|
- os: macos-13
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
@@ -362,6 +381,7 @@ jobs:
|
|||||||
- os: ubuntu-22.04
|
- os: ubuntu-22.04
|
||||||
- os: macos-11
|
- os: macos-11
|
||||||
- os: macos-12
|
- os: macos-12
|
||||||
|
- os: macos-13
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ target_link_libraries(boost_function
|
|||||||
Boost::preprocessor
|
Boost::preprocessor
|
||||||
Boost::throw_exception
|
Boost::throw_exception
|
||||||
Boost::type_traits
|
Boost::type_traits
|
||||||
Boost::typeof
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
|
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ branches:
|
|||||||
environment:
|
environment:
|
||||||
matrix:
|
matrix:
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0
|
TOOLSET: msvc-10.0,msvc-11.0
|
||||||
ADDRMD: 32
|
ADDRMD: 32
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
TOOLSET: msvc-12.0,msvc-14.0
|
TOOLSET: msvc-12.0,msvc-14.0
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
defined(BOOST_NO_CXX11_NOEXCEPT) || \
|
defined(BOOST_NO_CXX11_NOEXCEPT) || \
|
||||||
defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
|
defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
|
||||||
|
|
||||||
BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.Function 1.82 and will be removed in Boost.Function 1.84.")
|
BOOST_PRAGMA_MESSAGE("C++03 support was deprecated in Boost.Function 1.82 and will be removed in Boost.Function 1.85.")
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <boost/type_traits/alignment_of.hpp>
|
#include <boost/type_traits/alignment_of.hpp>
|
||||||
#include <boost/type_traits/enable_if.hpp>
|
#include <boost/type_traits/enable_if.hpp>
|
||||||
#include <boost/type_traits/integral_constant.hpp>
|
#include <boost/type_traits/integral_constant.hpp>
|
||||||
|
#include <boost/type_traits/is_function.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/config/workaround.hpp>
|
#include <boost/config/workaround.hpp>
|
||||||
@@ -652,7 +653,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
bool contains(const F& f) const
|
typename boost::enable_if_< !boost::is_function<F>::value, bool >::type
|
||||||
|
contains(const F& f) const
|
||||||
{
|
{
|
||||||
if (const F* fp = this->template target<F>())
|
if (const F* fp = this->template target<F>())
|
||||||
{
|
{
|
||||||
@@ -662,6 +664,19 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Fn>
|
||||||
|
typename boost::enable_if_< boost::is_function<Fn>::value, bool >::type
|
||||||
|
contains(Fn& f) const
|
||||||
|
{
|
||||||
|
typedef Fn* F;
|
||||||
|
if (const F* fp = this->template target<F>())
|
||||||
|
{
|
||||||
|
return function_equal(*fp, &f);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3
|
#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3
|
||||||
// GCC 3.3 and newer cannot copy with the global operator==, due to
|
// GCC 3.3 and newer cannot copy with the global operator==, due to
|
||||||
// problems with instantiation of function return types before it
|
// problems with instantiation of function return types before it
|
||||||
|
|||||||
@@ -9,37 +9,7 @@
|
|||||||
#ifndef BOOST_FUNCTION_TYPEOF_HPP
|
#ifndef BOOST_FUNCTION_TYPEOF_HPP
|
||||||
#define BOOST_FUNCTION_TYPEOF_HPP
|
#define BOOST_FUNCTION_TYPEOF_HPP
|
||||||
#include <boost/function/function_fwd.hpp>
|
#include <boost/function/function_fwd.hpp>
|
||||||
#include <boost/typeof/typeof.hpp>
|
|
||||||
|
|
||||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
// This header is no longer necessary and is only retained for compatibility
|
||||||
|
|
||||||
BOOST_TYPEOF_REGISTER_TYPE(boost::bad_function_call)
|
|
||||||
|
|
||||||
#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX)
|
|
||||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function, (typename))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function0, (typename))
|
|
||||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function1, (typename)(typename))
|
|
||||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function2, (typename)(typename)(typename))
|
|
||||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function3,
|
|
||||||
(typename)(typename)(typename)(typename))
|
|
||||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function4,
|
|
||||||
(typename)(typename)(typename)(typename)(typename))
|
|
||||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function5,
|
|
||||||
(typename)(typename)(typename)(typename)(typename)(typename))
|
|
||||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function6,
|
|
||||||
(typename)(typename)(typename)(typename)(typename)(typename)(typename))
|
|
||||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function7,
|
|
||||||
(typename)(typename)(typename)(typename)(typename)(typename)(typename)
|
|
||||||
(typename))
|
|
||||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function8,
|
|
||||||
(typename)(typename)(typename)(typename)(typename)(typename)(typename)
|
|
||||||
(typename)(typename))
|
|
||||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function9,
|
|
||||||
(typename)(typename)(typename)(typename)(typename)(typename)(typename)
|
|
||||||
(typename)(typename)(typename))
|
|
||||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function10,
|
|
||||||
(typename)(typename)(typename)(typename)(typename)(typename)(typename)
|
|
||||||
(typename)(typename)(typename)(typename))
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ run contains_test.cpp ;
|
|||||||
run contains2_test.cpp ;
|
run contains2_test.cpp ;
|
||||||
run nothrow_swap.cpp ;
|
run nothrow_swap.cpp ;
|
||||||
run rvalues_test.cpp ;
|
run rvalues_test.cpp ;
|
||||||
compile function_typeof_test.cpp ;
|
compile function_typeof_test.cpp
|
||||||
|
: <cxxstd>03:<build>no <cxxstd>98:<build>no <cxxstd>0x:<build>no ;
|
||||||
run result_arg_types_test.cpp ;
|
run result_arg_types_test.cpp ;
|
||||||
|
|
||||||
lib throw_bad_function_call : throw_bad_function_call.cpp : <link>shared:<define>THROW_BAD_FUNCTION_CALL_DYN_LINK=1 ;
|
lib throw_bad_function_call : throw_bad_function_call.cpp : <link>shared:<define>THROW_BAD_FUNCTION_CALL_DYN_LINK=1 ;
|
||||||
@@ -90,3 +91,6 @@ run fn_eq_bind_test.cpp ;
|
|||||||
# /usr/include/c++/4.4/bits/shared_ptr.h:146: error: cannot use typeid with -fno-rtti
|
# /usr/include/c++/4.4/bits/shared_ptr.h:146: error: cannot use typeid with -fno-rtti
|
||||||
run contains_test.cpp : : : <rtti>off <toolset>gcc-4.4,<cxxstd>0x:<build>no : contains_test_no_rtti ;
|
run contains_test.cpp : : : <rtti>off <toolset>gcc-4.4,<cxxstd>0x:<build>no : contains_test_no_rtti ;
|
||||||
run contains2_test.cpp : : : <rtti>off <toolset>gcc-4.4,<cxxstd>0x:<build>no : contains2_test_no_rtti ;
|
run contains2_test.cpp : : : <rtti>off <toolset>gcc-4.4,<cxxstd>0x:<build>no : contains2_test_no_rtti ;
|
||||||
|
|
||||||
|
run contains3_test.cpp ;
|
||||||
|
run contains3_test.cpp : : : <rtti>off <toolset>gcc-4.4,<cxxstd>0x:<build>no : contains3_test_no_rtti ;
|
||||||
|
|||||||
33
test/contains3_test.cpp
Normal file
33
test/contains3_test.cpp
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
static int f()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int g()
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
boost::function<int()> fn;
|
||||||
|
BOOST_TEST( !fn.contains( f ) );
|
||||||
|
BOOST_TEST( !fn.contains( g ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
boost::function<int()> fn( f );
|
||||||
|
BOOST_TEST( fn.contains( f ) );
|
||||||
|
BOOST_TEST( !fn.contains( g ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user