Compare commits

...

34 Commits

Author SHA1 Message Date
Peter Dimov
f6b538dbed Update .drone.jsonnet 2024-12-14 04:39:29 +02:00
Peter Dimov
69c3b8968a Apply Node20 workaround 2024-12-14 04:37:24 +02:00
Peter Dimov
7dd7abec65 Update ci.yml 2024-12-14 04:36:32 +02:00
Peter Dimov
89dfb032f2 Rename apply to apply_ to avoid msvc-14.3 conflict. Fixes #53. 2024-10-12 21:58:15 +03:00
Peter Dimov
ac731c96bb Add test for #53. Refs #53. 2024-10-12 21:32:25 +03:00
Peter Dimov
f3a164eaeb Update test/CMakeLists.txt 2024-10-07 22:36:22 +03:00
Peter Dimov
620c01266f Remove macos-12 from ci.yml, add macos-15 and ubuntu-24.04 2024-10-07 22:32:25 +03:00
Peter Dimov
e46566bc89 Update dependency list in cmake_subdir_test 2024-08-22 14:25:59 +03:00
Peter Dimov
bd668a0d9c Add VERBATIM to add_custom_target 2024-08-22 14:25:24 +03:00
Peter Dimov
bc78cd0f3d Update build.jam, test/Jamfile 2024-08-22 14:21:16 +03:00
Peter Dimov
27bbedd3a1 Merge branch 'modular' of https://github.com/grafikrobot/boostorg.function into feature/modular-b2 2024-08-22 14:17:05 +03:00
Peter Dimov
55567d8128 Regenerate CMakeLists.txt 2024-08-22 13:41:09 +03:00
Peter Dimov
7e4d90c87d Update .drone.jsonnet 2024-08-22 13:11:58 +03:00
Peter Dimov
b4ce38b1a0 Update ci.yml 2024-08-22 13:04:04 +03:00
Rene Rivera
e198ea3bc1 Update build deps. 2024-08-03 12:06:25 -05:00
Rene Rivera
0daa9f439e Move inter-lib dependencies to a project variable and into the build targets. 2024-07-23 22:34:22 -05:00
Rene Rivera
edd5bc27ed Update copyright dates. 2024-07-20 22:52:04 -05:00
Rene Rivera
b397ad461e Change all <source> references to <library>. 2024-07-20 19:38:32 -05:00
Rene Rivera
92b9a12c67 Bump B2 require to 5.2 2024-06-14 11:33:55 -05:00
Rene Rivera
98ae625d5b Sync from upstream. 2024-06-10 21:39:55 -05:00
Peter Dimov
1204b7d200 Add missing argN_type typedefs. Fixes #51. 2024-06-05 16:48:43 +03:00
Peter Dimov
a39d5404d6 Add result_arg_n_types_test. Refs #51. 2024-06-05 16:36:38 +03:00
Rene Rivera
c7ca5cc828 Add missing test deps. 2024-05-14 07:33:12 -05:00
Rene Rivera
d9647610ff Update dependencies. 2024-05-13 21:45:46 -05:00
Rene Rivera
96e26bb93e Sync from upstream. 2024-05-12 13:26:14 -05:00
Peter Dimov
bd181fdf89 Update .drone.jsonnet 2024-05-11 22:39:29 +03:00
Peter Dimov
9788bb6cea Update ci.yml 2024-05-11 22:22:56 +03:00
Peter Dimov
694b253086 Use std::is_trivially_copyable instead of is_trivially_copy_constructible + is_trivially_destructible 2024-05-11 22:14:19 +03:00
Peter Dimov
35f0c2a681 GCC 4.x doesn't have std::is_trivially_copy_constructible 2024-05-11 21:51:45 +03:00
Peter Dimov
4f89a283fd Fix GCC 4.8 in .drone.jsonnet 2024-05-11 21:38:42 +03:00
Peter Dimov
38a2ab7646 Remove dependency on Boost.TypeTraits 2024-05-11 21:26:24 +03:00
Rene Rivera
b2fdb20690 Add requires-b2 check to top-level build file. 2024-05-05 09:00:01 -05:00
Rene Rivera
13407f5e3e Switch to library requirements instead of source. As source puts extra source in install targets. 2024-03-29 21:15:58 -05:00
Rene Rivera
7248975133 Make the library modular usable. 2024-03-11 08:38:17 -05:00
13 changed files with 488 additions and 144 deletions

View File

@@ -32,6 +32,8 @@ local linux_pipeline(name, image, environment, packages = "", sources = [], arch
commands: commands:
[ [
'set -e', 'set -e',
'uname -a',
'echo $DRONE_STAGE_MACHINE',
'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -', 'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -',
] + ] +
(if sources != [] then [ ('apt-add-repository "' + source + '"') for source in sources ] else []) + (if sources != [] then [ ('apt-add-repository "' + source + '"') for source in sources ] else []) +
@@ -106,7 +108,7 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
linux_pipeline( linux_pipeline(
"Linux 16.04 GCC 4.8 32/64", "Linux 16.04 GCC 4.8 32/64",
"cppalliance/droneubuntu1604:1", "cppalliance/droneubuntu1604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '11', ADDRMD: '32,64' }, { TOOLSET: 'gcc', COMPILER: 'g++-4.8', CXXSTD: '11', ADDRMD: '32,64' },
"g++-4.8-multilib", "g++-4.8-multilib",
), ),
@@ -150,16 +152,23 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
), ),
linux_pipeline( linux_pipeline(
"Linux 20.04 GCC 9* ARM64", "Linux 20.04 GCC 9* ARM64 UBSAN",
"cppalliance/droneubuntu2004:multiarch", "cppalliance/droneubuntu2004:multiarch",
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '11,14,17,2a' }, { TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '11,14,17,2a' } + ubsan,
arch="arm64", arch="arm64",
), ),
linux_pipeline( linux_pipeline(
"Linux 20.04 GCC 9* S390x", "Linux 20.04 GCC 9* ARM64 ASAN",
"cppalliance/droneubuntu2004:multiarch", "cppalliance/droneubuntu2004:multiarch",
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '11,14,17,2a' }, { TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '11,14,17,2a' } + asan,
arch="arm64",
),
linux_pipeline(
"Linux 20.04 GCC 9* S390x UBSAN",
"cppalliance/droneubuntu2004:multiarch",
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '11,14,17,2a' } + ubsan,
arch="s390x", arch="s390x",
), ),
@@ -184,31 +193,24 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
), ),
linux_pipeline( linux_pipeline(
"Linux 23.04 GCC 13 32 ASAN", "Linux 24.04 GCC 13 32/64",
"cppalliance/droneubuntu2304:1", "cppalliance/droneubuntu2404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '11,14,17,20,2b', ADDRMD: '32' } + asan, { TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '11,14,17,20,2b', ADDRMD: '32,64' },
"g++-13-multilib", "g++-13-multilib",
), ),
linux_pipeline( linux_pipeline(
"Linux 23.04 GCC 13 64 ASAN", "Linux 24.04 GCC 14 32/64 UBSAN",
"cppalliance/droneubuntu2304:1", "cppalliance/droneubuntu2404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '11,14,17,20,2b', ADDRMD: '64' } + asan, { TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '11,14,17,20,2b', ADDRMD: '32,64' } + ubsan,
"g++-13-multilib", "g++-14-multilib",
), ),
linux_pipeline( linux_pipeline(
"Linux 23.04 GCC 13 32 UBSAN", "Linux 24.04 GCC 14 32/64 ASAN",
"cppalliance/droneubuntu2304:1", "cppalliance/droneubuntu2404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '11,14,17,20,2b', ADDRMD: '32' } + ubsan, { TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '11,14,17,20,2b', ADDRMD: '32,64' } + asan,
"g++-13-multilib", "g++-14-multilib",
),
linux_pipeline(
"Linux 23.04 GCC 13 64 UBSAN",
"cppalliance/droneubuntu2304:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '11,14,17,20,2b', ADDRMD: '64' } + ubsan,
"g++-13-multilib",
), ),
linux_pipeline( linux_pipeline(
@@ -331,26 +333,47 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
), ),
linux_pipeline( linux_pipeline(
"Linux 23.04 Clang 16", "Linux 24.04 Clang 16",
"cppalliance/droneubuntu2304:1", "cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-16', CXXSTD: '11,14,17,20,2b' }, { TOOLSET: 'clang', COMPILER: 'clang++-16', CXXSTD: '11,14,17,20,2b' },
"clang-16", "clang-16",
), ),
linux_pipeline( linux_pipeline(
"Linux 23.10 Clang 17 UBSAN", "Linux 24.04 Clang 17 UBSAN",
"cppalliance/droneubuntu2310:1", "cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '11,14,17,20,2b' } + ubsan, { TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '11,14,17,20,2b' } + ubsan,
"clang-17", "clang-17",
), ),
linux_pipeline( linux_pipeline(
"Linux 23.10 Clang 17 ASAN", "Linux 24.04 Clang 17 ASAN",
"cppalliance/droneubuntu2310:1", "cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '11,14,17,20,2b' } + asan, { TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '11,14,17,20,2b' } + asan,
"clang-17", "clang-17",
), ),
linux_pipeline(
"Linux 24.04 Clang 18 UBSAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-18', CXXSTD: '11,14,17,20,2b' } + ubsan,
"clang-18",
),
linux_pipeline(
"Linux 24.04 Clang 18 ASAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-18', CXXSTD: '11,14,17,20,2b' } + asan,
"clang-18",
),
linux_pipeline(
"Linux 24.10 Clang 19",
"cppalliance/droneubuntu2410:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-19', CXXSTD: '11,14,17,20,2b' },
"clang-19",
),
macos_pipeline( macos_pipeline(
"MacOS 10.15 Xcode 12.2 UBSAN", "MacOS 10.15 Xcode 12.2 UBSAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '11,14,17,2a' } + ubsan, { TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '11,14,17,2a' } + ubsan,

View File

@@ -18,7 +18,7 @@ jobs:
matrix: matrix:
include: include:
- toolset: gcc-4.7 - toolset: gcc-4.7
cxxstd: "0x" cxxstd: "11"
container: ubuntu:16.04 container: ubuntu:16.04
os: ubuntu-latest os: ubuntu-latest
install: g++-4.7-multilib install: g++-4.7-multilib
@@ -79,10 +79,16 @@ jobs:
address-model: 32,64 address-model: 32,64
- toolset: gcc-13 - toolset: gcc-13
cxxstd: "11,14,17,20,2b" cxxstd: "11,14,17,20,2b"
container: ubuntu:23.04 container: ubuntu:24.04
os: ubuntu-latest os: ubuntu-latest
install: g++-13-multilib install: g++-13-multilib
address-model: 32,64 address-model: 32,64
- toolset: gcc-14
cxxstd: "11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: g++-14-multilib
address-model: 32,64
- toolset: clang - toolset: clang
compiler: clang++-3.9 compiler: clang++-3.9
cxxstd: "11,14" cxxstd: "11,14"
@@ -154,40 +160,64 @@ jobs:
- toolset: clang - toolset: clang
compiler: clang++-16 compiler: clang++-16
cxxstd: "11,14,17,20,2b" cxxstd: "11,14,17,20,2b"
container: ubuntu:23.04 container: ubuntu:24.04
os: ubuntu-latest os: ubuntu-latest
install: clang-16 install: clang-16
- toolset: clang - toolset: clang
compiler: clang++-17 compiler: clang++-17
cxxstd: "11,14,17,20,2b" cxxstd: "11,14,17,20,2b"
container: ubuntu:23.10 container: ubuntu:24.04
os: ubuntu-latest os: ubuntu-latest
install: clang-17 install: clang-17
- toolset: clang - toolset: clang
cxxstd: "11,14,17,2a" compiler: clang++-18
os: macos-11
- toolset: clang
cxxstd: "11,14,17,20,2b" cxxstd: "11,14,17,20,2b"
os: macos-12 container: ubuntu:24.04
os: ubuntu-latest
install: clang-18
- toolset: clang
compiler: clang++-19
cxxstd: "11,14,17,20,2b"
container: ubuntu:24.10
os: ubuntu-latest
install: clang-19
- toolset: clang - toolset: clang
cxxstd: "11,14,17,20,2b" cxxstd: "11,14,17,20,2b"
os: macos-13 os: macos-13
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-14
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-15
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
container: ${{matrix.container}}
container:
image: ${{matrix.container}}
volumes:
- /node20217:/node20217:rw,rshared
- ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }}
defaults: defaults:
run: run:
shell: bash shell: bash
steps: steps:
- uses: actions/checkout@v3
- name: Setup container environment - name: Setup container environment
if: matrix.container if: matrix.container
run: | run: |
apt-get update apt-get update
apt-get -y install sudo python3 git g++ apt-get -y install sudo python3 git g++ curl xz-utils
- name: Install nodejs20glibc2.17
if: ${{ startsWith( matrix.container, 'ubuntu:1' ) }}
run: |
curl -LO https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz
tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217
ldd /__e/node20/bin/node
- uses: actions/checkout@v4
- name: Install packages - name: Install packages
if: matrix.install if: matrix.install
@@ -257,7 +287,7 @@ jobs:
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Boost - name: Setup Boost
shell: cmd shell: cmd
@@ -294,14 +324,15 @@ jobs:
include: include:
- os: ubuntu-20.04 - os: ubuntu-20.04
- os: ubuntu-22.04 - os: ubuntu-22.04
- os: macos-11 - os: ubuntu-24.04
- os: macos-12
- os: macos-13 - os: macos-13
- os: macos-14
- os: macos-15
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Install packages - name: Install packages
if: matrix.install if: matrix.install
@@ -342,14 +373,15 @@ jobs:
include: include:
- os: ubuntu-20.04 - os: ubuntu-20.04
- os: ubuntu-22.04 - os: ubuntu-22.04
- os: macos-11 - os: ubuntu-24.04
- os: macos-12
- os: macos-13 - os: macos-13
- os: macos-14
- os: macos-15
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Install packages - name: Install packages
if: matrix.install if: matrix.install
@@ -400,14 +432,15 @@ jobs:
include: include:
- os: ubuntu-20.04 - os: ubuntu-20.04
- os: ubuntu-22.04 - os: ubuntu-22.04
- os: macos-11 - os: ubuntu-24.04
- os: macos-12
- os: macos-13 - os: macos-13
- os: macos-14
- os: macos-15
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Install packages - name: Install packages
if: matrix.install if: matrix.install
@@ -460,7 +493,7 @@ jobs:
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Boost - name: Setup Boost
shell: cmd shell: cmd
@@ -509,7 +542,7 @@ jobs:
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Boost - name: Setup Boost
shell: cmd shell: cmd
@@ -576,7 +609,7 @@ jobs:
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Boost - name: Setup Boost
shell: cmd shell: cmd

View File

@@ -19,7 +19,6 @@ target_link_libraries(boost_function
Boost::config Boost::config
Boost::core Boost::core
Boost::throw_exception Boost::throw_exception
Boost::type_traits
) )
target_compile_features(boost_function INTERFACE cxx_std_11) target_compile_features(boost_function INTERFACE cxx_std_11)

24
build.jam Normal file
View File

@@ -0,0 +1,24 @@
# Copyright 2023-2024 René Ferdinand Rivera Morell
# Copyright 2024 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
require-b2 5.2 ;
constant boost_dependencies :
/boost/assert//boost_assert
/boost/bind//boost_bind
/boost/config//boost_config
/boost/core//boost_core
/boost/throw_exception//boost_throw_exception
;
project /boost/function ;
explicit
[ alias boost_function : : : : <include>include <library>$(boost_dependencies) ]
[ alias all : boost_function example test ]
;
call-if : boost-library function
;

View File

@@ -6,9 +6,13 @@
# See accompanying file LICENSE_1_0.txt or copy at # See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt # http://www.boost.org/LICENSE_1_0.txt
import ../../config/checks/config : requires ; require-b2 5.0.1 ;
import-search /boost/config/checks ;
import config : requires ;
import testing ; import testing ;
project : requirements <library>/boost/function//boost_function ;
run bind1st.cpp : : : [ requires cxx98_binders ] ; run bind1st.cpp : : : [ requires cxx98_binders ] ;
run int_div.cpp ; run int_div.cpp ;
run sum_avg.cpp ; run sum_avg.cpp ;

View File

@@ -15,17 +15,6 @@
#include <boost/function_equal.hpp> #include <boost/function_equal.hpp>
#include <boost/core/typeinfo.hpp> #include <boost/core/typeinfo.hpp>
#include <boost/core/ref.hpp> #include <boost/core/ref.hpp>
#include <boost/type_traits/has_trivial_copy.hpp>
#include <boost/type_traits/has_trivial_destructor.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/composite_traits.hpp>
#include <boost/type_traits/conditional.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <boost/type_traits/enable_if.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>
@@ -33,6 +22,7 @@
#include <string> #include <string>
#include <memory> #include <memory>
#include <new> #include <new>
#include <type_traits>
#if defined(BOOST_MSVC) #if defined(BOOST_MSVC)
# pragma warning( push ) # pragma warning( push )
@@ -43,10 +33,8 @@
// retained because used in a test // retained because used in a test
#define BOOST_FUNCTION_TARGET_FIX(x) #define BOOST_FUNCTION_TARGET_FIX(x)
# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \ #define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \
typename ::boost::enable_if_< \ typename std::enable_if< !std::is_integral<Functor>::value, Type>::type
!(::boost::is_integral<Functor>::value), \
Type>::type
namespace boost { namespace boost {
namespace detail { namespace detail {
@@ -131,15 +119,15 @@ namespace boost {
template<typename F> template<typename F>
class get_function_tag class get_function_tag
{ {
typedef typename conditional<(is_pointer<F>::value), typedef typename std::conditional<std::is_pointer<F>::value,
function_ptr_tag, function_ptr_tag,
function_obj_tag>::type ptr_or_obj_tag; function_obj_tag>::type ptr_or_obj_tag;
typedef typename conditional<(is_member_pointer<F>::value), typedef typename std::conditional<std::is_member_pointer<F>::value,
member_ptr_tag, member_ptr_tag,
ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag; ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag;
typedef typename conditional<(is_reference_wrapper<F>::value), typedef typename std::conditional<is_reference_wrapper<F>::value,
function_obj_ref_tag, function_obj_ref_tag,
ptr_or_obj_or_mem_tag>::type or_ref_tag; ptr_or_obj_or_mem_tag>::type or_ref_tag;
@@ -204,8 +192,8 @@ namespace boost {
BOOST_STATIC_CONSTANT BOOST_STATIC_CONSTANT
(bool, (bool,
value = ((sizeof(F) <= sizeof(function_buffer) && value = ((sizeof(F) <= sizeof(function_buffer) &&
(alignment_of<function_buffer>::value (std::alignment_of<function_buffer>::value
% alignment_of<F>::value == 0)))); % std::alignment_of<F>::value == 0))));
}; };
template <typename F,typename A> template <typename F,typename A>
@@ -306,7 +294,7 @@ namespace boost {
// Function objects that fit in the small-object buffer. // Function objects that fit in the small-object buffer.
static inline void static inline void
manager(const function_buffer& in_buffer, function_buffer& out_buffer, manager(const function_buffer& in_buffer, function_buffer& out_buffer,
functor_manager_operation_type op, true_type) functor_manager_operation_type op, std::true_type)
{ {
functor_manager_common<Functor>::manage_small(in_buffer,out_buffer,op); functor_manager_common<Functor>::manage_small(in_buffer,out_buffer,op);
} }
@@ -314,7 +302,7 @@ namespace boost {
// Function objects that require heap allocation // Function objects that require heap allocation
static inline void static inline void
manager(const function_buffer& in_buffer, function_buffer& out_buffer, manager(const function_buffer& in_buffer, function_buffer& out_buffer,
functor_manager_operation_type op, false_type) functor_manager_operation_type op, std::false_type)
{ {
if (op == clone_functor_tag) { if (op == clone_functor_tag) {
// Clone the functor // Clone the functor
@@ -355,7 +343,7 @@ namespace boost {
functor_manager_operation_type op, function_obj_tag) functor_manager_operation_type op, function_obj_tag)
{ {
manager(in_buffer, out_buffer, op, manager(in_buffer, out_buffer, op,
integral_constant<bool, (function_allows_small_object_optimization<functor_type>::value)>()); std::integral_constant<bool, (function_allows_small_object_optimization<functor_type>::value)>());
} }
// For member pointers, we use the small-object optimization buffer. // For member pointers, we use the small-object optimization buffer.
@@ -363,7 +351,7 @@ namespace boost {
manager(const function_buffer& in_buffer, function_buffer& out_buffer, manager(const function_buffer& in_buffer, function_buffer& out_buffer,
functor_manager_operation_type op, member_ptr_tag) functor_manager_operation_type op, member_ptr_tag)
{ {
manager(in_buffer, out_buffer, op, true_type()); manager(in_buffer, out_buffer, op, std::true_type());
} }
public: public:
@@ -401,7 +389,7 @@ namespace boost {
// Function objects that fit in the small-object buffer. // Function objects that fit in the small-object buffer.
static inline void static inline void
manager(const function_buffer& in_buffer, function_buffer& out_buffer, manager(const function_buffer& in_buffer, function_buffer& out_buffer,
functor_manager_operation_type op, true_type) functor_manager_operation_type op, std::true_type)
{ {
functor_manager_common<Functor>::manage_small(in_buffer,out_buffer,op); functor_manager_common<Functor>::manage_small(in_buffer,out_buffer,op);
} }
@@ -409,7 +397,7 @@ namespace boost {
// Function objects that require heap allocation // Function objects that require heap allocation
static inline void static inline void
manager(const function_buffer& in_buffer, function_buffer& out_buffer, manager(const function_buffer& in_buffer, function_buffer& out_buffer,
functor_manager_operation_type op, false_type) functor_manager_operation_type op, std::false_type)
{ {
typedef functor_wrapper<Functor,Allocator> functor_wrapper_type; typedef functor_wrapper<Functor,Allocator> functor_wrapper_type;
@@ -460,7 +448,7 @@ namespace boost {
functor_manager_operation_type op, function_obj_tag) functor_manager_operation_type op, function_obj_tag)
{ {
manager(in_buffer, out_buffer, op, manager(in_buffer, out_buffer, op,
integral_constant<bool, (function_allows_small_object_optimization<functor_type>::value)>()); std::integral_constant<bool, (function_allows_small_object_optimization<functor_type>::value)>());
} }
public: public:
@@ -529,8 +517,8 @@ public:
detail::function::function_buffer type_result; detail::function::function_buffer type_result;
type_result.members.type.type = &BOOST_CORE_TYPEID(Functor); type_result.members.type.type = &BOOST_CORE_TYPEID(Functor);
type_result.members.type.const_qualified = is_const<Functor>::value; type_result.members.type.const_qualified = std::is_const<Functor>::value;
type_result.members.type.volatile_qualified = is_volatile<Functor>::value; type_result.members.type.volatile_qualified = std::is_volatile<Functor>::value;
get_vtable()->manager(functor, type_result, get_vtable()->manager(functor, type_result,
detail::function::check_functor_type_tag); detail::function::check_functor_type_tag);
return static_cast<Functor*>(type_result.members.obj_ptr); return static_cast<Functor*>(type_result.members.obj_ptr);
@@ -544,7 +532,7 @@ public:
detail::function::function_buffer type_result; detail::function::function_buffer type_result;
type_result.members.type.type = &BOOST_CORE_TYPEID(Functor); type_result.members.type.type = &BOOST_CORE_TYPEID(Functor);
type_result.members.type.const_qualified = true; type_result.members.type.const_qualified = true;
type_result.members.type.volatile_qualified = is_volatile<Functor>::value; type_result.members.type.volatile_qualified = std::is_volatile<Functor>::value;
get_vtable()->manager(functor, type_result, get_vtable()->manager(functor, type_result,
detail::function::check_functor_type_tag); detail::function::check_functor_type_tag);
// GCC 2.95.3 gets the CV qualifiers wrong here, so we // GCC 2.95.3 gets the CV qualifiers wrong here, so we
@@ -553,7 +541,7 @@ public:
} }
template<typename F> template<typename F>
typename boost::enable_if_< !boost::is_function<F>::value, bool >::type typename std::enable_if< !std::is_function<F>::value, bool >::type
contains(const F& f) const contains(const F& f) const
{ {
if (const F* fp = this->template target<F>()) if (const F* fp = this->template target<F>())
@@ -565,7 +553,7 @@ public:
} }
template<typename Fn> template<typename Fn>
typename boost::enable_if_< boost::is_function<Fn>::value, bool >::type typename std::enable_if< std::is_function<Fn>::value, bool >::type
contains(Fn& f) const contains(Fn& f) const
{ {
typedef Fn* F; typedef Fn* F;

View File

@@ -15,11 +15,10 @@
#include <boost/core/no_exceptions_support.hpp> #include <boost/core/no_exceptions_support.hpp>
#include <boost/mem_fn.hpp> #include <boost/mem_fn.hpp>
#include <boost/throw_exception.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 <boost/config.hpp>
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <type_traits>
#if defined(BOOST_MSVC) #if defined(BOOST_MSVC)
# pragma warning( push ) # pragma warning( push )
@@ -180,7 +179,7 @@ namespace boost {
> >
struct get_function_invoker struct get_function_invoker
{ {
typedef typename conditional<(is_void<R>::value), typedef typename std::conditional<std::is_void<R>::value,
void_function_invoker< void_function_invoker<
FunctionPtr, FunctionPtr,
R, R,
@@ -201,7 +200,7 @@ namespace boost {
> >
struct get_function_obj_invoker struct get_function_obj_invoker
{ {
typedef typename conditional<(is_void<R>::value), typedef typename std::conditional<std::is_void<R>::value,
void_function_obj_invoker< void_function_obj_invoker<
FunctionObj, FunctionObj,
R, R,
@@ -222,7 +221,7 @@ namespace boost {
> >
struct get_function_ref_invoker struct get_function_ref_invoker
{ {
typedef typename conditional<(is_void<R>::value), typedef typename std::conditional<std::is_void<R>::value,
void_function_ref_invoker< void_function_ref_invoker<
FunctionObj, FunctionObj,
R, R,
@@ -244,7 +243,7 @@ namespace boost {
> >
struct get_member_invoker struct get_member_invoker
{ {
typedef typename conditional<(is_void<R>::value), typedef typename std::conditional<std::is_void<R>::value,
void_member_invoker< void_member_invoker<
MemberPtr, MemberPtr,
R, R,
@@ -262,9 +261,9 @@ namespace boost {
actual invoker that will be used for the given function actual invoker that will be used for the given function
object. object.
Each specialization contains an "apply" nested class template Each specialization contains an "apply_" nested class template
that accepts the function object, return type, function that accepts the function object, return type, function
argument types, and allocator. The resulting "apply" class argument types, and allocator. The resulting "apply_" class
contains two typedefs, "invoker_type" and "manager_type", contains two typedefs, "invoker_type" and "manager_type",
which correspond to the invoker and manager types. */ which correspond to the invoker and manager types. */
template<typename Tag> template<typename Tag>
@@ -276,7 +275,7 @@ namespace boost {
{ {
template<typename FunctionPtr, template<typename FunctionPtr,
typename R, typename... T> typename R, typename... T>
struct apply struct apply_
{ {
typedef typename get_function_invoker< typedef typename get_function_invoker<
FunctionPtr, FunctionPtr,
@@ -309,7 +308,7 @@ namespace boost {
{ {
template<typename MemberPtr, template<typename MemberPtr,
typename R, typename... T> typename R, typename... T>
struct apply struct apply_
{ {
typedef typename get_member_invoker< typedef typename get_member_invoker<
MemberPtr, MemberPtr,
@@ -342,7 +341,7 @@ namespace boost {
{ {
template<typename FunctionObj, template<typename FunctionObj,
typename R, typename... T> typename R, typename... T>
struct apply struct apply_
{ {
typedef typename get_function_obj_invoker< typedef typename get_function_obj_invoker<
FunctionObj, FunctionObj,
@@ -375,7 +374,7 @@ namespace boost {
{ {
template<typename RefWrapper, template<typename RefWrapper,
typename R, typename... T> typename R, typename... T>
struct apply struct apply_
{ {
typedef typename get_function_ref_invoker< typedef typename get_function_ref_invoker<
typename RefWrapper::type, typename RefWrapper::type,
@@ -499,27 +498,27 @@ namespace boost {
// Assign to a function object using the small object optimization // Assign to a function object using the small object optimization
template<typename FunctionObj> template<typename FunctionObj>
void void
assign_functor(FunctionObj f, function_buffer& functor, true_type) const assign_functor(FunctionObj f, function_buffer& functor, std::true_type) const
{ {
new (reinterpret_cast<void*>(functor.data)) FunctionObj(std::move(f)); new (reinterpret_cast<void*>(functor.data)) FunctionObj(std::move(f));
} }
template<typename FunctionObj,typename Allocator> template<typename FunctionObj,typename Allocator>
void void
assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, true_type) const assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, std::true_type) const
{ {
assign_functor(std::move(f),functor,true_type()); assign_functor(std::move(f),functor,std::true_type());
} }
// Assign to a function object allocated on the heap. // Assign to a function object allocated on the heap.
template<typename FunctionObj> template<typename FunctionObj>
void void
assign_functor(FunctionObj f, function_buffer& functor, false_type) const assign_functor(FunctionObj f, function_buffer& functor, std::false_type) const
{ {
functor.members.obj_ptr = new FunctionObj(std::move(f)); functor.members.obj_ptr = new FunctionObj(std::move(f));
} }
template<typename FunctionObj,typename Allocator> template<typename FunctionObj,typename Allocator>
void void
assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, false_type) const assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, std::false_type) const
{ {
typedef functor_wrapper<FunctionObj,Allocator> functor_wrapper_type; typedef functor_wrapper<FunctionObj,Allocator> functor_wrapper_type;
@@ -540,7 +539,7 @@ namespace boost {
{ {
if (!boost::detail::function::has_empty_target(boost::addressof(f))) { if (!boost::detail::function::has_empty_target(boost::addressof(f))) {
assign_functor(std::move(f), functor, assign_functor(std::move(f), functor,
integral_constant<bool, (function_allows_small_object_optimization<FunctionObj>::value)>()); std::integral_constant<bool, (function_allows_small_object_optimization<FunctionObj>::value)>());
return true; return true;
} else { } else {
return false; return false;
@@ -552,7 +551,7 @@ namespace boost {
{ {
if (!boost::detail::function::has_empty_target(boost::addressof(f))) { if (!boost::detail::function::has_empty_target(boost::addressof(f))) {
assign_functor_a(std::move(f), functor, a, assign_functor_a(std::move(f), functor, a,
integral_constant<bool, (function_allows_small_object_optimization<FunctionObj>::value)>()); std::integral_constant<bool, (function_allows_small_object_optimization<FunctionObj>::value)>());
return true; return true;
} else { } else {
return false; return false;
@@ -566,8 +565,8 @@ namespace boost {
function_buffer& functor, function_obj_ref_tag) const function_buffer& functor, function_obj_ref_tag) const
{ {
functor.members.obj_ref.obj_ptr = (void *)(f.get_pointer()); functor.members.obj_ref.obj_ptr = (void *)(f.get_pointer());
functor.members.obj_ref.is_const_qualified = is_const<FunctionObj>::value; functor.members.obj_ref.is_const_qualified = std::is_const<FunctionObj>::value;
functor.members.obj_ref.is_volatile_qualified = is_volatile<FunctionObj>::value; functor.members.obj_ref.is_volatile_qualified = std::is_volatile<FunctionObj>::value;
return true; return true;
} }
template<typename FunctionObj,typename Allocator> template<typename FunctionObj,typename Allocator>
@@ -587,19 +586,125 @@ namespace boost {
struct variadic_function_base struct variadic_function_base
{}; {};
template <typename T> template <typename T1>
struct variadic_function_base<T> struct variadic_function_base<T1>
{ {
typedef T argument_type; typedef T1 argument_type;
typedef T1 arg1_type;
}; };
template <typename T0, typename T1> template <typename T1, typename T2>
struct variadic_function_base<T0, T1> struct variadic_function_base<T1, T2>
{ {
typedef T0 first_argument_type; typedef T1 first_argument_type;
typedef T1 second_argument_type; typedef T2 second_argument_type;
typedef T1 arg1_type;
typedef T2 arg2_type;
}; };
template <typename T1, typename T2, typename T3>
struct variadic_function_base<T1, T2, T3>
{
typedef T1 arg1_type;
typedef T2 arg2_type;
typedef T3 arg3_type;
};
template <typename T1, typename T2, typename T3, typename T4>
struct variadic_function_base<T1, T2, T3, T4>
{
typedef T1 arg1_type;
typedef T2 arg2_type;
typedef T3 arg3_type;
typedef T4 arg4_type;
};
template <typename T1, typename T2, typename T3, typename T4, typename T5>
struct variadic_function_base<T1, T2, T3, T4, T5>
{
typedef T1 arg1_type;
typedef T2 arg2_type;
typedef T3 arg3_type;
typedef T4 arg4_type;
typedef T5 arg5_type;
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
struct variadic_function_base<T1, T2, T3, T4, T5, T6>
{
typedef T1 arg1_type;
typedef T2 arg2_type;
typedef T3 arg3_type;
typedef T4 arg4_type;
typedef T5 arg5_type;
typedef T6 arg6_type;
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
struct variadic_function_base<T1, T2, T3, T4, T5, T6, T7>
{
typedef T1 arg1_type;
typedef T2 arg2_type;
typedef T3 arg3_type;
typedef T4 arg4_type;
typedef T5 arg5_type;
typedef T6 arg6_type;
typedef T7 arg7_type;
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
struct variadic_function_base<T1, T2, T3, T4, T5, T6, T7, T8>
{
typedef T1 arg1_type;
typedef T2 arg2_type;
typedef T3 arg3_type;
typedef T4 arg4_type;
typedef T5 arg5_type;
typedef T6 arg6_type;
typedef T7 arg7_type;
typedef T8 arg8_type;
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
struct variadic_function_base<T1, T2, T3, T4, T5, T6, T7, T8, T9>
{
typedef T1 arg1_type;
typedef T2 arg2_type;
typedef T3 arg3_type;
typedef T4 arg4_type;
typedef T5 arg5_type;
typedef T6 arg6_type;
typedef T7 arg7_type;
typedef T8 arg8_type;
typedef T9 arg9_type;
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
struct variadic_function_base<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
{
typedef T1 arg1_type;
typedef T2 arg2_type;
typedef T3 arg3_type;
typedef T4 arg4_type;
typedef T5 arg5_type;
typedef T6 arg6_type;
typedef T7 arg7_type;
typedef T8 arg8_type;
typedef T9 arg9_type;
typedef T10 arg10_type;
};
#if defined( BOOST_LIBSTDCXX_VERSION ) && BOOST_LIBSTDCXX_VERSION < 50000
template<class T> struct is_trivially_copyable: std::integral_constant<bool,
__has_trivial_copy(T) && __has_trivial_assign(T) && __has_trivial_destructor(T)> {};
#else
using std::is_trivially_copyable;
#endif
} // end namespace function } // end namespace function
} // end namespace detail } // end namespace detail
@@ -643,8 +748,8 @@ namespace boost {
// one with a default parameter. // one with a default parameter.
template<typename Functor> template<typename Functor>
function_n(Functor f function_n(Functor f
,typename boost::enable_if_< ,typename std::enable_if<
!(is_integral<Functor>::value), !std::is_integral<Functor>::value,
int>::type = 0 int>::type = 0
) : ) :
function_base() function_base()
@@ -653,8 +758,8 @@ namespace boost {
} }
template<typename Functor,typename Allocator> template<typename Functor,typename Allocator>
function_n(Functor f, Allocator a function_n(Functor f, Allocator a
,typename boost::enable_if_< ,typename std::enable_if<
!(is_integral<Functor>::value), !std::is_integral<Functor>::value,
int>::type = 0 int>::type = 0
) : ) :
function_base() function_base()
@@ -691,8 +796,8 @@ namespace boost {
// handle function_n as the type of the temporary to // handle function_n as the type of the temporary to
// construct. // construct.
template<typename Functor> template<typename Functor>
typename boost::enable_if_< typename std::enable_if<
!(is_integral<Functor>::value), !std::is_integral<Functor>::value,
function_n&>::type function_n&>::type
operator=(Functor f) operator=(Functor f)
{ {
@@ -818,7 +923,7 @@ namespace boost {
typedef typename boost::detail::function::get_function_tag<Functor>::type tag; typedef typename boost::detail::function::get_function_tag<Functor>::type tag;
typedef boost::detail::function::get_invoker<tag> get_invoker; typedef boost::detail::function::get_invoker<tag> get_invoker;
typedef typename get_invoker:: typedef typename get_invoker::
template apply<Functor, R, template apply_<Functor, R,
T...> T...>
handler_type; handler_type;
@@ -835,8 +940,7 @@ namespace boost {
if (stored_vtable.assign_to(std::move(f), functor)) { if (stored_vtable.assign_to(std::move(f), functor)) {
std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base); std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base);
// coverity[pointless_expression]: suppress coverity warnings on apparant if(const). // coverity[pointless_expression]: suppress coverity warnings on apparant if(const).
if (boost::has_trivial_copy_constructor<Functor>::value && if (boost::detail::function::is_trivially_copyable<Functor>::value &&
boost::has_trivial_destructor<Functor>::value &&
boost::detail::function::function_allows_small_object_optimization<Functor>::value) boost::detail::function::function_allows_small_object_optimization<Functor>::value)
value |= static_cast<std::size_t>(0x01); value |= static_cast<std::size_t>(0x01);
vtable = reinterpret_cast<boost::detail::function::vtable_base *>(value); vtable = reinterpret_cast<boost::detail::function::vtable_base *>(value);
@@ -869,8 +973,7 @@ namespace boost {
if (stored_vtable.assign_to_a(std::move(f), functor, a)) { if (stored_vtable.assign_to_a(std::move(f), functor, a)) {
std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base); std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base);
// coverity[pointless_expression]: suppress coverity warnings on apparant if(const). // coverity[pointless_expression]: suppress coverity warnings on apparant if(const).
if (boost::has_trivial_copy_constructor<Functor>::value && if (boost::detail::function::is_trivially_copyable<Functor>::value &&
boost::has_trivial_destructor<Functor>::value &&
boost::detail::function::function_allows_small_object_optimization<Functor>::value) boost::detail::function::function_allows_small_object_optimization<Functor>::value)
value |= static_cast<std::size_t>(0x01); value |= static_cast<std::size_t>(0x01);
vtable = reinterpret_cast<boost::detail::function::vtable_base *>(value); vtable = reinterpret_cast<boost::detail::function::vtable_base *>(value);
@@ -974,8 +1077,8 @@ public:
template<typename Functor> template<typename Functor>
function(Functor f function(Functor f
,typename boost::enable_if_< ,typename std::enable_if<
!(is_integral<Functor>::value), !std::is_integral<Functor>::value,
int>::type = 0 int>::type = 0
) : ) :
base_type(std::move(f)) base_type(std::move(f))
@@ -983,8 +1086,8 @@ public:
} }
template<typename Functor,typename Allocator> template<typename Functor,typename Allocator>
function(Functor f, Allocator a function(Functor f, Allocator a
,typename boost::enable_if_< ,typename std::enable_if<
!(is_integral<Functor>::value), !std::is_integral<Functor>::value,
int>::type = 0 int>::type = 0
) : ) :
base_type(std::move(f),a) base_type(std::move(f),a)
@@ -1014,8 +1117,8 @@ public:
} }
template<typename Functor> template<typename Functor>
typename boost::enable_if_< typename std::enable_if<
!(is_integral<Functor>::value), !std::is_integral<Functor>::value,
self_type&>::type self_type&>::type
operator=(Functor f) operator=(Functor f)
{ {

View File

@@ -6,6 +6,6 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(HAVE_BOOST_TEST) if(HAVE_BOOST_TEST)
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::function Boost::core Boost::lambda) boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::function Boost::core Boost::lambda Boost::move)
endif() endif()

View File

@@ -16,6 +16,8 @@ project
<toolset>msvc:<warnings-as-errors>on <toolset>msvc:<warnings-as-errors>on
<toolset>gcc:<warnings-as-errors>on <toolset>gcc:<warnings-as-errors>on
<toolset>clang:<warnings-as-errors>on <toolset>clang:<warnings-as-errors>on
<library>/boost/function//boost_function
<library>/boost/typeof//boost_typeof
; ;
run function_test.cpp ; run function_test.cpp ;
@@ -24,7 +26,8 @@ run function_test.cpp : : : <rtti>off <toolset>gcc-4.4,<cxxstd>0x:<build>no : fu
run function_n_test.cpp ; run function_n_test.cpp ;
run allocator_test.cpp ; run allocator_test.cpp ;
run stateless_test.cpp ; run stateless_test.cpp ;
run lambda_test.cpp ; run lambda_test.cpp
: : : <library>/boost/lambda//boost_lambda ;
compile-fail function_test_fail1.cpp ; compile-fail function_test_fail1.cpp ;
compile-fail function_test_fail2.cpp ; compile-fail function_test_fail2.cpp ;
compile function_30.cpp ; compile function_30.cpp ;
@@ -42,10 +45,12 @@ run function_ref_portable.cpp ;
run contains_test.cpp ; 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
: : : <library>/boost/move//boost_move ;
compile function_typeof_test.cpp compile function_typeof_test.cpp
: <cxxstd>03:<build>no <cxxstd>98:<build>no <cxxstd>0x:<build>no ; : <cxxstd>03:<build>no <cxxstd>98:<build>no <cxxstd>0x:<build>no ;
run result_arg_types_test.cpp ; run result_arg_types_test.cpp ;
run result_arg_n_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 ;
@@ -88,3 +93,5 @@ run contains2_test.cpp : : : <rtti>off <toolset>gcc-4.4,<cxxstd>0x:<build>no : c
run contains3_test.cpp ; run contains3_test.cpp ;
run contains3_test.cpp : : : <rtti>off <toolset>gcc-4.4,<cxxstd>0x:<build>no : contains3_test_no_rtti ; run contains3_test.cpp : : : <rtti>off <toolset>gcc-4.4,<cxxstd>0x:<build>no : contains3_test_no_rtti ;
compile issue_53.cpp ;

View File

@@ -14,4 +14,4 @@ target_link_libraries(main Boost::function)
enable_testing() enable_testing()
add_test(main main) add_test(main main)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>) add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@@ -16,10 +16,7 @@ assert
bind bind
config config
core core
preprocessor
throw_exception throw_exception
type_traits
typeof
# Secondary dependencies # Secondary dependencies
@@ -40,4 +37,4 @@ target_link_libraries(quick Boost::function Boost::core)
enable_testing() enable_testing()
add_test(quick quick) add_test(quick quick)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>) add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

20
test/issue_53.cpp Normal file
View File

@@ -0,0 +1,20 @@
// Copyright 2024 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
//
// https://github.com/boostorg/function/issues/53
#include <boost/bind/apply.hpp>
#include <boost/bind/bind.hpp>
#include <boost/function.hpp>
int TestArg( int, double )
{
return 0;
}
void f()
{
boost::function<int(int)> fn = boost::bind( &TestArg, boost::placeholders::_1, 1.0 );
}

View File

@@ -0,0 +1,146 @@
// Copyright 2024 Peter Dimov
// Use, modification and distribution is subject to
// the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/function.hpp>
#include <boost/core/lightweight_test_trait.hpp>
struct R {};
struct A1 {};
struct A2 {};
struct A3 {};
struct A4 {};
struct A5 {};
struct A6 {};
struct A7 {};
struct A8 {};
struct A9 {};
struct A10 {};
int main()
{
{
typedef boost::function<R()> F;
BOOST_TEST_TRAIT_SAME(F::result_type, R);
}
{
typedef boost::function<R(A1)> F;
BOOST_TEST_TRAIT_SAME(F::result_type, R);
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
}
{
typedef boost::function<R(A1, A2)> F;
BOOST_TEST_TRAIT_SAME(F::result_type, R);
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
}
{
typedef boost::function<R(A1, A2, A3)> F;
BOOST_TEST_TRAIT_SAME(F::result_type, R);
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
}
{
typedef boost::function<R(A1, A2, A3, A4)> F;
BOOST_TEST_TRAIT_SAME(F::result_type, R);
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
}
{
typedef boost::function<R(A1, A2, A3, A4, A5)> F;
BOOST_TEST_TRAIT_SAME(F::result_type, R);
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
BOOST_TEST_TRAIT_SAME(F::arg5_type, A5);
}
{
typedef boost::function<R(A1, A2, A3, A4, A5, A6)> F;
BOOST_TEST_TRAIT_SAME(F::result_type, R);
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
BOOST_TEST_TRAIT_SAME(F::arg5_type, A5);
BOOST_TEST_TRAIT_SAME(F::arg6_type, A6);
}
{
typedef boost::function<R(A1, A2, A3, A4, A5, A6, A7)> F;
BOOST_TEST_TRAIT_SAME(F::result_type, R);
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
BOOST_TEST_TRAIT_SAME(F::arg5_type, A5);
BOOST_TEST_TRAIT_SAME(F::arg6_type, A6);
BOOST_TEST_TRAIT_SAME(F::arg7_type, A7);
}
{
typedef boost::function<R(A1, A2, A3, A4, A5, A6, A7, A8)> F;
BOOST_TEST_TRAIT_SAME(F::result_type, R);
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
BOOST_TEST_TRAIT_SAME(F::arg5_type, A5);
BOOST_TEST_TRAIT_SAME(F::arg6_type, A6);
BOOST_TEST_TRAIT_SAME(F::arg7_type, A7);
BOOST_TEST_TRAIT_SAME(F::arg8_type, A8);
}
{
typedef boost::function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> F;
BOOST_TEST_TRAIT_SAME(F::result_type, R);
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
BOOST_TEST_TRAIT_SAME(F::arg5_type, A5);
BOOST_TEST_TRAIT_SAME(F::arg6_type, A6);
BOOST_TEST_TRAIT_SAME(F::arg7_type, A7);
BOOST_TEST_TRAIT_SAME(F::arg8_type, A8);
BOOST_TEST_TRAIT_SAME(F::arg9_type, A9);
}
{
typedef boost::function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> F;
BOOST_TEST_TRAIT_SAME(F::result_type, R);
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
BOOST_TEST_TRAIT_SAME(F::arg5_type, A5);
BOOST_TEST_TRAIT_SAME(F::arg6_type, A6);
BOOST_TEST_TRAIT_SAME(F::arg7_type, A7);
BOOST_TEST_TRAIT_SAME(F::arg8_type, A8);
BOOST_TEST_TRAIT_SAME(F::arg9_type, A9);
BOOST_TEST_TRAIT_SAME(F::arg10_type, A10);
}
return boost::report_errors();
}