mirror of
https://github.com/boostorg/function.git
synced 2025-06-26 12:31:33 +02:00
Compare commits
27 Commits
boost-1.68
...
feature/fu
Author | SHA1 | Date | |
---|---|---|---|
7b11b52e62 | |||
0a1a33a443 | |||
79045752e0 | |||
b149dba678 | |||
cd91278477 | |||
c18d123137 | |||
3bc2478a95 | |||
af15ab966e | |||
161f7557e7 | |||
f22fa49e07 | |||
5f93559650 | |||
5b2acbc175 | |||
755d3c2001 | |||
b07621f2ee | |||
df1f33eb00 | |||
86f05aa602 | |||
4230fb2388 | |||
453860ff9c | |||
0ee9299e5e | |||
d1a771b6ea | |||
27808e2bd5 | |||
528afe6b41 | |||
df80a7b29c | |||
c0d41a880a | |||
87c978d36e | |||
d1ad1141f3 | |||
b1fa00f3b1 |
361
.travis.yml
361
.travis.yml
@ -1,162 +1,301 @@
|
|||||||
# Copyright 2016 Peter Dimov
|
# Copyright 2016, 2017, 2018 Peter Dimov
|
||||||
# Copyright 2017, 2018 James E. King III
|
|
||||||
# Distributed under the Boost Software License, Version 1.0.
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#
|
|
||||||
# Generic Travis CI build script for boostorg repositories
|
|
||||||
#
|
|
||||||
# Instructions for customizing this script for your library:
|
|
||||||
#
|
|
||||||
# 1. Customize the compilers and language levels you want.
|
|
||||||
# 2. If you have move than include/, src/, test/, example/, examples/, or
|
|
||||||
# tools/ directories, modify your Travis CI project and add the environment
|
|
||||||
# variable DEPINST. For example if your build uses code in "bench/" and
|
|
||||||
# "fog/" directories, then set DEPINST to the following:
|
|
||||||
# --include bench --include fog
|
|
||||||
# 3. If you want to enable Coverity Scan, you need to provide the environment
|
|
||||||
# variables COVERITY_SCAN_TOKEN and COVERITY_SCAN_NOTIFICATION_EMAIL in
|
|
||||||
# your github settings.
|
|
||||||
# 4. Enable pull request builds in your boostorg/<library> account.
|
|
||||||
# 5. Change the default C++ version in ci/travis/*.sh (search for CXXSTD) if needed.
|
|
||||||
#
|
|
||||||
# That's it - the scripts will do everything else for you.
|
|
||||||
|
|
||||||
sudo: false
|
|
||||||
dist: trusty
|
|
||||||
language: cpp
|
language: cpp
|
||||||
|
|
||||||
env:
|
sudo: false
|
||||||
global:
|
|
||||||
# see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties
|
|
||||||
# to use the default for a given environment, comment it out; recommend you build debug and release however..
|
|
||||||
# - B2_ADDRESS_MODEL=address-model=64,32
|
|
||||||
# - B2_LINK=link=shared,static
|
|
||||||
# - B2_THREADING=threading=multi,single
|
|
||||||
- B2_VARIANT=variant=release,debug
|
|
||||||
|
|
||||||
install:
|
|
||||||
- git clone https://github.com/jeking3/boost-ci.git boost-ci
|
|
||||||
- cp -pr boost-ci/ci boost-ci/.codecov.yml .
|
|
||||||
- source ci/travis/install.sh
|
|
||||||
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- binutils-gold
|
|
||||||
- gdb
|
|
||||||
- libc6-dbg
|
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- develop
|
|
||||||
- master
|
- master
|
||||||
|
- develop
|
||||||
script:
|
- /feature\/.*/
|
||||||
- cd $BOOST_ROOT/libs/$SELF
|
|
||||||
- ci/travis/build.sh
|
env:
|
||||||
|
matrix:
|
||||||
|
- BOGUS_JOB=true
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
|
||||||
|
exclude:
|
||||||
|
- env: BOGUS_JOB=true
|
||||||
|
|
||||||
jobs:
|
|
||||||
include:
|
include:
|
||||||
#################### Jobs to run on every pull request ####################
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env:
|
compiler: g++
|
||||||
- COMMENT="C++03"
|
env: TOOLSET=gcc CXXSTD=03,11 VARIANT=debug,release
|
||||||
- TOOLSET=gcc,gcc-7,clang
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-4.4
|
||||||
|
env: TOOLSET=gcc CXXSTD=98,0x
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-4.4
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-4.6
|
||||||
|
env: TOOLSET=gcc CXXSTD=03,0x
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-4.6
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-4.7
|
||||||
|
env: TOOLSET=gcc CXXSTD=03,11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-4.7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-4.8
|
||||||
|
env: TOOLSET=gcc CXXSTD=03,11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-4.8
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-4.9
|
||||||
|
env: TOOLSET=gcc CXXSTD=03,11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-4.9
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-5
|
||||||
|
env: TOOLSET=gcc CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-5
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-6
|
||||||
|
env: TOOLSET=gcc CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-6
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-7
|
||||||
|
env: TOOLSET=gcc CXXSTD=03,11,14,17 VARIANT=release
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- g++-7
|
- g++-7
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env:
|
compiler: g++-8
|
||||||
- COMMENT="C++11"
|
env: TOOLSET=gcc CXXSTD=03,11,14,17,2a
|
||||||
- TOOLSET=gcc,gcc-7,clang
|
addons:
|
||||||
- CXXSTD=11
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-8
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-7
|
||||||
|
env: UBSAN=1 TOOLSET=gcc CXXSTD=03,11,14,17 UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- g++-7
|
- g++-7
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env:
|
compiler: clang++
|
||||||
- COMMENT=valgrind
|
env: TOOLSET=clang CXXSTD=03,11 VARIANT=debug,release
|
||||||
- TOOLSET=clang
|
|
||||||
- B2_VARIANT=variant=debug
|
- os: linux
|
||||||
- TESTFLAGS=testing.launcher=valgrind
|
compiler: /usr/bin/clang++
|
||||||
- VALGRIND_OPTS=--error-exitcode=1
|
env: TOOLSET=clang CXXSTD=03,11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.3
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: /usr/bin/clang++
|
||||||
|
env: TOOLSET=clang CXXSTD=03,11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.4
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.5
|
||||||
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.5
|
||||||
|
- libstdc++-4.9-dev
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.5
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.6
|
||||||
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.6
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.6
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.7
|
||||||
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.7
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.8
|
||||||
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.8
|
||||||
|
- libstdc++-4.9-dev
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.8
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.9
|
||||||
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.9
|
||||||
|
- libstdc++-4.9-dev
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.9
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-4.0
|
||||||
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-4.0
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-4.0
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-5.0
|
||||||
|
env: TOOLSET=clang CXXSTD=03,11,14,1z VARIANT=release
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- clang-5.0
|
- clang-5.0
|
||||||
- libstdc++-7-dev
|
|
||||||
- valgrind
|
|
||||||
sources:
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
- llvm-toolchain-trusty-5.0
|
- llvm-toolchain-trusty-5.0
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env:
|
compiler: clang++-6.0
|
||||||
- COMMENT=cppcheck
|
env: TOOLSET=clang CXXSTD=03,11,14,17,2a
|
||||||
script:
|
|
||||||
- cd $BOOST_ROOT/libs/$SELF
|
|
||||||
- ci/travis/cppcheck.sh
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
env:
|
|
||||||
- COMMENT=UBSAN
|
|
||||||
- B2_VARIANT=variant=debug
|
|
||||||
- TOOLSET=gcc-7
|
|
||||||
- CXXFLAGS="cxxflags=-fno-omit-frame-pointer cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined"
|
|
||||||
- LINKFLAGS="linkflags=-fsanitize=undefined linkflags=-fno-sanitize-recover=undefined linkflags=-fuse-ld=gold"
|
|
||||||
- UBSAN_OPTIONS=print_stacktrace=1
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- g++-7
|
- clang-6.0
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-6.0
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env:
|
compiler: clang++-7
|
||||||
- COMMENT=CodeCov
|
env: TOOLSET=clang CXXSTD=03,11,14,17,2a
|
||||||
- TOOLSET=gcc-7
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- gcc-7
|
- clang-7
|
||||||
- g++-7
|
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
script:
|
- llvm-toolchain-trusty-7
|
||||||
- pushd /tmp && git clone https://github.com/linux-test-project/lcov.git && export PATH=/tmp/lcov/bin:$PATH && which lcov && lcov --version && popd
|
|
||||||
- cd $BOOST_ROOT/libs/$SELF
|
|
||||||
- ci/travis/codecov.sh
|
|
||||||
|
|
||||||
# does not work with sources install shell yet: see
|
|
||||||
# https://travis-ci.org/jeking3/tokenizer/jobs/384903189
|
|
||||||
# for a typical failure
|
|
||||||
# - os: osx
|
|
||||||
# osx_image: xcode9
|
|
||||||
# env:
|
|
||||||
# - TOOLSET=clang
|
|
||||||
# - CXXSTD=03,11
|
|
||||||
|
|
||||||
#################### Jobs to run on pushes to master, develop ###################
|
|
||||||
|
|
||||||
# Coverity Scan
|
|
||||||
- os: linux
|
- os: linux
|
||||||
if: (env(COVERITY_SCAN_NOTIFICATION_EMAIL) IS present) AND (branch IN (develop, master)) AND (type IN (cron, push))
|
compiler: clang++-5.0
|
||||||
env:
|
env: UBSAN=1 TOOLSET=clang CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
|
||||||
- COMMENT="Coverity Scan"
|
addons:
|
||||||
- TOOLSET=gcc
|
apt:
|
||||||
script:
|
packages:
|
||||||
- cd $BOOST_ROOT/libs/$SELF
|
- clang-5.0
|
||||||
- ci/travis/coverity.sh
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-5.0
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-libc++
|
||||||
|
env: TOOLSET=clang CXXSTD=03,11,14,1z VARIANT=release
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- libc++-dev
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-libc++
|
||||||
|
env: UBSAN=1 TOOLSET=clang CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- libc++-dev
|
||||||
|
|
||||||
|
- os: osx
|
||||||
|
compiler: clang++
|
||||||
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
|
|
||||||
|
install:
|
||||||
|
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
||||||
|
- cd ..
|
||||||
|
- git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
|
||||||
|
- cd boost-root
|
||||||
|
- git submodule update --init tools/build
|
||||||
|
- git submodule update --init libs/config
|
||||||
|
- git submodule update --init tools/boostdep
|
||||||
|
- cp -r $TRAVIS_BUILD_DIR/* libs/function
|
||||||
|
- python tools/boostdep/depinst/depinst.py function
|
||||||
|
- ./bootstrap.sh
|
||||||
|
- ./b2 headers
|
||||||
|
|
||||||
|
script:
|
||||||
|
- |-
|
||||||
|
echo "using $TOOLSET : : $TRAVIS_COMPILER ;" > ~/user-config.jam
|
||||||
|
- ./b2 -j3 libs/function/test toolset=$TOOLSET cxxstd=$CXXSTD ${VARIANT:+variant=$VARIANT} ${UBSAN:+cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined linkflags=-fsanitize=undefined debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS}
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
false
|
on_success: always
|
||||||
|
|
||||||
|
73
appveyor.yml
73
appveyor.yml
@ -3,6 +3,22 @@
|
|||||||
# Distributed under the Boost Software License, Version 1.0.
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Generic Appveyor build script for boostorg repositories
|
||||||
|
# See: https://github.com/jeking3/boost-ci/
|
||||||
|
#
|
||||||
|
# Instructions for customizing this script for your library:
|
||||||
|
#
|
||||||
|
# 1. Customize the compilers and language levels you want.
|
||||||
|
# 2. If you have move than include/, src/, test/, example/, examples/,
|
||||||
|
# benchmark/ or tools/ directories, set the environment variable DEPINST.
|
||||||
|
# For example if your build uses code in "bench/" and "fog/" directories:
|
||||||
|
# - DEPINST: --include bench --include fog
|
||||||
|
# 3. Enable pull request builds in your boostorg/<library> account.
|
||||||
|
#
|
||||||
|
# That's it - the script will do everything else for you.
|
||||||
|
#
|
||||||
|
|
||||||
version: 1.0.{build}-{branch}
|
version: 1.0.{build}-{branch}
|
||||||
|
|
||||||
shallow_clone: true
|
shallow_clone: true
|
||||||
@ -13,58 +29,83 @@ branches:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
|
# Adding MAYFAIL to any matrix job allows it to fail but the build stays green:
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- MAYFAIL: true
|
- MAYFAIL: true
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
global:
|
global:
|
||||||
# see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties
|
# see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties
|
||||||
# to use the default for a given environment, comment it out; recommend you build debug and release however..
|
# to use the default for a given environment, comment it out; recommend you build debug and release however:
|
||||||
# on Windows it is important to exercise all the possibilities, especially shared vs static
|
# on Windows it is important to exercise all the possibilities, especially shared vs static, however most
|
||||||
|
# libraries that care about this exercise it in their Jamfiles...
|
||||||
# B2_ADDRESS_MODEL: address-model=64,32
|
# B2_ADDRESS_MODEL: address-model=64,32
|
||||||
# B2_LINK: link=shared,static
|
# B2_LINK: link=shared,static
|
||||||
# B2_THREADING: threading=multi,single
|
# B2_THREADING: threading=multi,single
|
||||||
B2_VARIANT: variant=release,debug
|
B2_VARIANT: variant=release,debug
|
||||||
CXXSTD: 03
|
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
- FLAVOR: Visual Studio 2017
|
- FLAVOR: Visual Studio 2017 C++2a Strict
|
||||||
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
TOOLSET: msvc-14.1
|
||||||
|
B2_ADDRESS_MODEL: address-model=64
|
||||||
|
CXXFLAGS: cxxflags=-permissive-
|
||||||
|
CXXSTD: latest # 2a
|
||||||
|
|
||||||
|
- FLAVOR: Visual Studio 2017 C++17
|
||||||
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
TOOLSET: msvc-14.1
|
||||||
|
B2_ADDRESS_MODEL: address-model=64
|
||||||
|
CXXSTD: 17
|
||||||
|
|
||||||
|
- FLAVOR: Visual Studio 2017 C++14 (Default)
|
||||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
TOOLSET: msvc-14.1
|
TOOLSET: msvc-14.1
|
||||||
B2_ADDRESS_MODEL: address-model=64,32
|
B2_ADDRESS_MODEL: address-model=64,32
|
||||||
- FLAVOR: Visual Studio 2015
|
|
||||||
|
- FLAVOR: Visual Studio 2015 C++14 (Default)
|
||||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
TOOLSET: msvc-14.0
|
TOOLSET: msvc-14.0
|
||||||
B2_ADDRESS_MODEL: address-model=64,32
|
B2_ADDRESS_MODEL: address-model=64,32
|
||||||
|
|
||||||
- FLAVOR: Visual Studio 2010, 2012, 2013
|
- FLAVOR: Visual Studio 2010, 2012, 2013
|
||||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
TOOLSET: msvc-10.0,msvc-11.0,msvc-12.0
|
TOOLSET: msvc-10.0,msvc-11.0,msvc-12.0
|
||||||
|
|
||||||
- FLAVOR: cygwin (32-bit)
|
- FLAVOR: cygwin (32-bit)
|
||||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
ADDPATH: C:\cygwin\bin;
|
ADDPATH: C:\cygwin\bin;
|
||||||
B2_ADDRESS_MODEL: address-model=32
|
B2_ADDRESS_MODEL: address-model=32
|
||||||
|
CXXSTD: 03,11
|
||||||
# https://github.com/boostorg/test/issues/144
|
# https://github.com/boostorg/test/issues/144
|
||||||
DEFINES: define=_POSIX_C_SOURCE=200112L
|
DEFINES: define=_POSIX_C_SOURCE=200112L
|
||||||
THREADING: threadapi=pthread
|
THREADING: threadapi=pthread
|
||||||
TOOLSET: gcc
|
TOOLSET: gcc
|
||||||
|
|
||||||
- FLAVOR: cygwin (64-bit)
|
- FLAVOR: cygwin (64-bit)
|
||||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
ADDPATH: C:\cygwin64\bin;
|
ADDPATH: C:\cygwin64\bin;
|
||||||
B2_ADDRESS_MODEL: address-model=64
|
B2_ADDRESS_MODEL: address-model=64
|
||||||
|
CXXSTD: 11,17
|
||||||
# https://github.com/boostorg/test/issues/144
|
# https://github.com/boostorg/test/issues/144
|
||||||
DEFINES: define=_POSIX_C_SOURCE=200112L
|
DEFINES: define=_POSIX_C_SOURCE=200112L define=__USE_ISOC99
|
||||||
THREADING: threadapi=pthread
|
THREADING: threadapi=pthread
|
||||||
TOOLSET: gcc
|
TOOLSET: gcc
|
||||||
- FLAVOR: mingw32
|
|
||||||
|
- FLAVOR: mingw32
|
||||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
ARCH: i686
|
ARCH: i686
|
||||||
B2_ADDRESS_MODEL: address-model=32
|
B2_ADDRESS_MODEL: address-model=32
|
||||||
SCRIPT: ci\appveyor\mingw.bat
|
CXXSTD: 03,11
|
||||||
- FLAVOR: mingw64
|
SCRIPT: ci\appveyor\mingw.bat
|
||||||
|
|
||||||
|
- FLAVOR: mingw64
|
||||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
ARCH: x86_64
|
ARCH: x86_64
|
||||||
B2_ADDRESS_MODEL: address-model=64
|
B2_ADDRESS_MODEL: address-model=64
|
||||||
SCRIPT: ci\appveyor\mingw.bat
|
CXXSTD: 11,17
|
||||||
|
DEFINES: define=__USE_ISOC99
|
||||||
|
SCRIPT: ci\appveyor\mingw.bat
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- set SELF=%APPVEYOR_PROJECT_NAME:-=_%
|
- set SELF=%APPVEYOR_PROJECT_NAME:-=_%
|
||||||
@ -77,5 +118,9 @@ build: off
|
|||||||
test_script:
|
test_script:
|
||||||
- set SELF=%APPVEYOR_PROJECT_NAME:-=_%
|
- set SELF=%APPVEYOR_PROJECT_NAME:-=_%
|
||||||
- PATH=%ADDPATH%%PATH%
|
- PATH=%ADDPATH%%PATH%
|
||||||
- IF DEFINED SCRIPT (call libs\%SELF%\%SCRIPT%) ELSE (b2 libs/%SELF% toolset=%TOOLSET% cxxstd=%CXXSTD% %CXXFLAGS% %DEFINES% %THREADING% %B2_ADDRESS_MODEL% %B2_LINK% %B2_THREADING% %B2_VARIANT% -j3)
|
# The definition of TOOLCXX omits CXXSTD= if it was not defined above
|
||||||
|
- IF NOT DEFINED CXXSTD (SET TOOLCXX=toolset=%TOOLSET%) ELSE (SET TOOLCXX=toolset=%TOOLSET% cxxstd=%CXXSTD%)
|
||||||
|
# Echo the complete build command to the build log
|
||||||
|
- IF NOT DEFINED SCRIPT (ECHO b2 libs/%SELF:\=/% %TOOLCXX% %CXXFLAGS% %DEFINES% %THREADING% %B2_ADDRESS_MODEL% %B2_LINK% %B2_THREADING% %B2_VARIANT% -j3)
|
||||||
|
# Now go build...
|
||||||
|
- IF DEFINED SCRIPT (call libs\%SELF%\%SCRIPT%) ELSE (b2 libs/%SELF:\=/% %TOOLCXX% %CXXFLAGS% %DEFINES% %THREADING% %B2_ADDRESS_MODEL% %B2_LINK% %B2_THREADING% %B2_VARIANT% -j3)
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
# Distributed under the Boost Software License, Version 1.0. (See accompany-
|
# Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||||
# ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
# ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
import ../../config/checks/config : requires ;
|
||||||
import os ;
|
import os ;
|
||||||
import testing ;
|
import testing ;
|
||||||
|
|
||||||
@ -13,7 +14,7 @@ project
|
|||||||
;
|
;
|
||||||
|
|
||||||
test-suite "function-examples"
|
test-suite "function-examples"
|
||||||
: [ run bind1st.cpp ]
|
: [ run bind1st.cpp : : : [ requires cxx98_binders ] ]
|
||||||
[ run int_div.cpp ]
|
[ run int_div.cpp ]
|
||||||
[ run sum_avg.cpp ]
|
[ run sum_avg.cpp ]
|
||||||
;
|
;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <functional> // unary_function, binary_function
|
#include <functional> // unary_function, binary_function
|
||||||
|
|
||||||
#include <boost/preprocessor/iterate.hpp>
|
#include <boost/preprocessor/iterate.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/config/workaround.hpp>
|
||||||
|
|
||||||
// Include the prologue here so that the use of file-level iteration
|
// Include the prologue here so that the use of file-level iteration
|
||||||
// in anything that may be included by function_template.hpp doesn't break
|
// in anything that may be included by function_template.hpp doesn't break
|
||||||
|
@ -26,13 +26,13 @@
|
|||||||
#include <boost/type_traits/is_volatile.hpp>
|
#include <boost/type_traits/is_volatile.hpp>
|
||||||
#include <boost/type_traits/composite_traits.hpp>
|
#include <boost/type_traits/composite_traits.hpp>
|
||||||
#include <boost/ref.hpp>
|
#include <boost/ref.hpp>
|
||||||
#include <boost/mpl/if.hpp>
|
#include <boost/type_traits/conditional.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/config/workaround.hpp>
|
||||||
#include <boost/type_traits/alignment_of.hpp>
|
#include <boost/type_traits/alignment_of.hpp>
|
||||||
#ifndef BOOST_NO_SFINAE
|
#ifndef BOOST_NO_SFINAE
|
||||||
# include "boost/utility/enable_if.hpp"
|
#include <boost/type_traits/enable_if.hpp>
|
||||||
#else
|
#else
|
||||||
# include "boost/mpl/bool.hpp"
|
#include <boost/type_traits/integral_constant.hpp>
|
||||||
#endif
|
#endif
|
||||||
#include <boost/function_equal.hpp>
|
#include <boost/function_equal.hpp>
|
||||||
#include <boost/function/function_fwd.hpp>
|
#include <boost/function/function_fwd.hpp>
|
||||||
@ -50,7 +50,7 @@
|
|||||||
#endif // __ICL etc
|
#endif // __ICL etc
|
||||||
|
|
||||||
# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \
|
# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \
|
||||||
typename ::boost::enable_if_c< \
|
typename ::boost::enable_if_< \
|
||||||
!(::boost::is_integral<Functor>::value), \
|
!(::boost::is_integral<Functor>::value), \
|
||||||
Type>::type
|
Type>::type
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ namespace boost {
|
|||||||
} obj_ref;
|
} obj_ref;
|
||||||
};
|
};
|
||||||
|
|
||||||
union function_buffer
|
union BOOST_SYMBOL_VISIBLE function_buffer
|
||||||
{
|
{
|
||||||
// Type-specific union members
|
// Type-specific union members
|
||||||
mutable function_buffer_members members;
|
mutable function_buffer_members members;
|
||||||
@ -152,15 +152,15 @@ namespace boost {
|
|||||||
template<typename F>
|
template<typename F>
|
||||||
class get_function_tag
|
class get_function_tag
|
||||||
{
|
{
|
||||||
typedef typename mpl::if_c<(is_pointer<F>::value),
|
typedef typename conditional<(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 mpl::if_c<(is_member_pointer<F>::value),
|
typedef typename conditional<(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 mpl::if_c<(is_reference_wrapper<F>::value),
|
typedef typename 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;
|
||||||
|
|
||||||
@ -328,7 +328,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, mpl::true_)
|
functor_manager_operation_type op, true_type)
|
||||||
{
|
{
|
||||||
functor_manager_common<Functor>::manage_small(in_buffer,out_buffer,op);
|
functor_manager_common<Functor>::manage_small(in_buffer,out_buffer,op);
|
||||||
}
|
}
|
||||||
@ -336,7 +336,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, mpl::false_)
|
functor_manager_operation_type op, false_type)
|
||||||
{
|
{
|
||||||
if (op == clone_functor_tag) {
|
if (op == clone_functor_tag) {
|
||||||
// Clone the functor
|
// Clone the functor
|
||||||
@ -377,7 +377,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,
|
||||||
mpl::bool_<(function_allows_small_object_optimization<functor_type>::value)>());
|
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.
|
||||||
@ -385,7 +385,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, mpl::true_());
|
manager(in_buffer, out_buffer, op, true_type());
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -427,7 +427,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, mpl::true_)
|
functor_manager_operation_type op, true_type)
|
||||||
{
|
{
|
||||||
functor_manager_common<Functor>::manage_small(in_buffer,out_buffer,op);
|
functor_manager_common<Functor>::manage_small(in_buffer,out_buffer,op);
|
||||||
}
|
}
|
||||||
@ -435,7 +435,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, mpl::false_)
|
functor_manager_operation_type op, false_type)
|
||||||
{
|
{
|
||||||
typedef functor_wrapper<Functor,Allocator> functor_wrapper_type;
|
typedef functor_wrapper<Functor,Allocator> functor_wrapper_type;
|
||||||
#if defined(BOOST_NO_CXX11_ALLOCATOR)
|
#if defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
@ -499,7 +499,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,
|
||||||
mpl::bool_<(function_allows_small_object_optimization<functor_type>::value)>());
|
integral_constant<bool, (function_allows_small_object_optimization<functor_type>::value)>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -530,24 +530,24 @@ namespace boost {
|
|||||||
#ifdef BOOST_NO_SFINAE
|
#ifdef BOOST_NO_SFINAE
|
||||||
// These routines perform comparisons between a Boost.Function
|
// These routines perform comparisons between a Boost.Function
|
||||||
// object and an arbitrary function object (when the last
|
// object and an arbitrary function object (when the last
|
||||||
// parameter is mpl::bool_<false>) or against zero (when the
|
// parameter is false_type) or against zero (when the
|
||||||
// last parameter is mpl::bool_<true>). They are only necessary
|
// last parameter is true_type). They are only necessary
|
||||||
// for compilers that don't support SFINAE.
|
// for compilers that don't support SFINAE.
|
||||||
template<typename Function, typename Functor>
|
template<typename Function, typename Functor>
|
||||||
bool
|
bool
|
||||||
compare_equal(const Function& f, const Functor&, int, mpl::bool_<true>)
|
compare_equal(const Function& f, const Functor&, int, true_type)
|
||||||
{ return f.empty(); }
|
{ return f.empty(); }
|
||||||
|
|
||||||
template<typename Function, typename Functor>
|
template<typename Function, typename Functor>
|
||||||
bool
|
bool
|
||||||
compare_not_equal(const Function& f, const Functor&, int,
|
compare_not_equal(const Function& f, const Functor&, int,
|
||||||
mpl::bool_<true>)
|
true_type)
|
||||||
{ return !f.empty(); }
|
{ return !f.empty(); }
|
||||||
|
|
||||||
template<typename Function, typename Functor>
|
template<typename Function, typename Functor>
|
||||||
bool
|
bool
|
||||||
compare_equal(const Function& f, const Functor& g, long,
|
compare_equal(const Function& f, const Functor& g, long,
|
||||||
mpl::bool_<false>)
|
false_type)
|
||||||
{
|
{
|
||||||
if (const Functor* fp = f.template target<Functor>())
|
if (const Functor* fp = f.template target<Functor>())
|
||||||
return function_equal(*fp, g);
|
return function_equal(*fp, g);
|
||||||
@ -557,7 +557,7 @@ namespace boost {
|
|||||||
template<typename Function, typename Functor>
|
template<typename Function, typename Functor>
|
||||||
bool
|
bool
|
||||||
compare_equal(const Function& f, const reference_wrapper<Functor>& g,
|
compare_equal(const Function& f, const reference_wrapper<Functor>& g,
|
||||||
int, mpl::bool_<false>)
|
int, false_type)
|
||||||
{
|
{
|
||||||
if (const Functor* fp = f.template target<Functor>())
|
if (const Functor* fp = f.template target<Functor>())
|
||||||
return fp == g.get_pointer();
|
return fp == g.get_pointer();
|
||||||
@ -567,7 +567,7 @@ namespace boost {
|
|||||||
template<typename Function, typename Functor>
|
template<typename Function, typename Functor>
|
||||||
bool
|
bool
|
||||||
compare_not_equal(const Function& f, const Functor& g, long,
|
compare_not_equal(const Function& f, const Functor& g, long,
|
||||||
mpl::bool_<false>)
|
false_type)
|
||||||
{
|
{
|
||||||
if (const Functor* fp = f.template target<Functor>())
|
if (const Functor* fp = f.template target<Functor>())
|
||||||
return !function_equal(*fp, g);
|
return !function_equal(*fp, g);
|
||||||
@ -578,7 +578,7 @@ namespace boost {
|
|||||||
bool
|
bool
|
||||||
compare_not_equal(const Function& f,
|
compare_not_equal(const Function& f,
|
||||||
const reference_wrapper<Functor>& g, int,
|
const reference_wrapper<Functor>& g, int,
|
||||||
mpl::bool_<false>)
|
false_type)
|
||||||
{
|
{
|
||||||
if (const Functor* fp = f.template target<Functor>())
|
if (const Functor* fp = f.template target<Functor>())
|
||||||
return fp != g.get_pointer();
|
return fp != g.get_pointer();
|
||||||
@ -710,7 +710,7 @@ public: // should be protected, but GCC 2.95.3 will fail to allow access
|
|||||||
* The bad_function_call exception class is thrown when a boost::function
|
* The bad_function_call exception class is thrown when a boost::function
|
||||||
* object is invoked
|
* object is invoked
|
||||||
*/
|
*/
|
||||||
class bad_function_call : public std::runtime_error
|
class BOOST_SYMBOL_VISIBLE bad_function_call : public std::runtime_error
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bad_function_call() : std::runtime_error("call to empty boost::function") {}
|
bad_function_call() : std::runtime_error("call to empty boost::function") {}
|
||||||
@ -750,28 +750,28 @@ inline bool operator!=(detail::function::useless_clear_type*,
|
|||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
inline bool operator==(const function_base& f, Functor g)
|
inline bool operator==(const function_base& f, Functor g)
|
||||||
{
|
{
|
||||||
typedef mpl::bool_<(is_integral<Functor>::value)> integral;
|
typedef integral_constant<bool, (is_integral<Functor>::value)> integral;
|
||||||
return detail::function::compare_equal(f, g, 0, integral());
|
return detail::function::compare_equal(f, g, 0, integral());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
inline bool operator==(Functor g, const function_base& f)
|
inline bool operator==(Functor g, const function_base& f)
|
||||||
{
|
{
|
||||||
typedef mpl::bool_<(is_integral<Functor>::value)> integral;
|
typedef integral_constant<bool, (is_integral<Functor>::value)> integral;
|
||||||
return detail::function::compare_equal(f, g, 0, integral());
|
return detail::function::compare_equal(f, g, 0, integral());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
inline bool operator!=(const function_base& f, Functor g)
|
inline bool operator!=(const function_base& f, Functor g)
|
||||||
{
|
{
|
||||||
typedef mpl::bool_<(is_integral<Functor>::value)> integral;
|
typedef integral_constant<bool, (is_integral<Functor>::value)> integral;
|
||||||
return detail::function::compare_not_equal(f, g, 0, integral());
|
return detail::function::compare_not_equal(f, g, 0, integral());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
inline bool operator!=(Functor g, const function_base& f)
|
inline bool operator!=(Functor g, const function_base& f)
|
||||||
{
|
{
|
||||||
typedef mpl::bool_<(is_integral<Functor>::value)> integral;
|
typedef integral_constant<bool, (is_integral<Functor>::value)> integral;
|
||||||
return detail::function::compare_not_equal(f, g, 0, integral());
|
return detail::function::compare_not_equal(f, g, 0, integral());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
// Note: this header is a header template and must NOT have multiple-inclusion
|
// Note: this header is a header template and must NOT have multiple-inclusion
|
||||||
// protection.
|
// protection.
|
||||||
#include <boost/function/detail/prologue.hpp>
|
#include <boost/function/detail/prologue.hpp>
|
||||||
#include <boost/detail/no_exceptions_support.hpp>
|
#include <boost/core/no_exceptions_support.hpp>
|
||||||
|
|
||||||
#if defined(BOOST_MSVC)
|
#if defined(BOOST_MSVC)
|
||||||
# pragma warning( push )
|
# pragma warning( push )
|
||||||
@ -29,8 +29,7 @@
|
|||||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||||
# define BOOST_FUNCTION_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, a)
|
# define BOOST_FUNCTION_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, a)
|
||||||
#else
|
#else
|
||||||
# include <boost/move/utility_core.hpp>
|
# define BOOST_FUNCTION_ARG(J,I,D) static_cast<BOOST_PP_CAT(T,I)&&>(BOOST_PP_CAT(a,I))
|
||||||
# define BOOST_FUNCTION_ARG(J,I,D) ::boost::forward< BOOST_PP_CAT(T,I) >(BOOST_PP_CAT(a,I))
|
|
||||||
# define BOOST_FUNCTION_ARGS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG,BOOST_PP_EMPTY)
|
# define BOOST_FUNCTION_ARGS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG,BOOST_PP_EMPTY)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -240,7 +239,7 @@ namespace boost {
|
|||||||
>
|
>
|
||||||
struct BOOST_FUNCTION_GET_FUNCTION_INVOKER
|
struct BOOST_FUNCTION_GET_FUNCTION_INVOKER
|
||||||
{
|
{
|
||||||
typedef typename mpl::if_c<(is_void<R>::value),
|
typedef typename conditional<(is_void<R>::value),
|
||||||
BOOST_FUNCTION_VOID_FUNCTION_INVOKER<
|
BOOST_FUNCTION_VOID_FUNCTION_INVOKER<
|
||||||
FunctionPtr,
|
FunctionPtr,
|
||||||
R BOOST_FUNCTION_COMMA
|
R BOOST_FUNCTION_COMMA
|
||||||
@ -261,7 +260,7 @@ namespace boost {
|
|||||||
>
|
>
|
||||||
struct BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER
|
struct BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER
|
||||||
{
|
{
|
||||||
typedef typename mpl::if_c<(is_void<R>::value),
|
typedef typename conditional<(is_void<R>::value),
|
||||||
BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER<
|
BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER<
|
||||||
FunctionObj,
|
FunctionObj,
|
||||||
R BOOST_FUNCTION_COMMA
|
R BOOST_FUNCTION_COMMA
|
||||||
@ -282,7 +281,7 @@ namespace boost {
|
|||||||
>
|
>
|
||||||
struct BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER
|
struct BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER
|
||||||
{
|
{
|
||||||
typedef typename mpl::if_c<(is_void<R>::value),
|
typedef typename conditional<(is_void<R>::value),
|
||||||
BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER<
|
BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER<
|
||||||
FunctionObj,
|
FunctionObj,
|
||||||
R BOOST_FUNCTION_COMMA
|
R BOOST_FUNCTION_COMMA
|
||||||
@ -305,7 +304,7 @@ namespace boost {
|
|||||||
>
|
>
|
||||||
struct BOOST_FUNCTION_GET_MEMBER_INVOKER
|
struct BOOST_FUNCTION_GET_MEMBER_INVOKER
|
||||||
{
|
{
|
||||||
typedef typename mpl::if_c<(is_void<R>::value),
|
typedef typename conditional<(is_void<R>::value),
|
||||||
BOOST_FUNCTION_VOID_MEMBER_INVOKER<
|
BOOST_FUNCTION_VOID_MEMBER_INVOKER<
|
||||||
MemberPtr,
|
MemberPtr,
|
||||||
R BOOST_FUNCTION_COMMA
|
R BOOST_FUNCTION_COMMA
|
||||||
@ -350,9 +349,8 @@ namespace boost {
|
|||||||
typedef functor_manager<FunctionPtr> manager_type;
|
typedef functor_manager<FunctionPtr> manager_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename FunctionPtr,
|
template<typename FunctionPtr, typename Allocator,
|
||||||
typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS,
|
typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS>
|
||||||
typename Allocator>
|
|
||||||
struct apply_a
|
struct apply_a
|
||||||
{
|
{
|
||||||
typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER<
|
typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER<
|
||||||
@ -385,9 +383,8 @@ namespace boost {
|
|||||||
typedef functor_manager<MemberPtr> manager_type;
|
typedef functor_manager<MemberPtr> manager_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename MemberPtr,
|
template<typename MemberPtr, typename Allocator,
|
||||||
typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS,
|
typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS>
|
||||||
typename Allocator>
|
|
||||||
struct apply_a
|
struct apply_a
|
||||||
{
|
{
|
||||||
typedef typename BOOST_FUNCTION_GET_MEMBER_INVOKER<
|
typedef typename BOOST_FUNCTION_GET_MEMBER_INVOKER<
|
||||||
@ -420,9 +417,8 @@ namespace boost {
|
|||||||
typedef functor_manager<FunctionObj> manager_type;
|
typedef functor_manager<FunctionObj> manager_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename FunctionObj,
|
template<typename FunctionObj, typename Allocator,
|
||||||
typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS,
|
typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS>
|
||||||
typename Allocator>
|
|
||||||
struct apply_a
|
struct apply_a
|
||||||
{
|
{
|
||||||
typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
|
typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
|
||||||
@ -454,9 +450,8 @@ namespace boost {
|
|||||||
typedef reference_manager<typename RefWrapper::type> manager_type;
|
typedef reference_manager<typename RefWrapper::type> manager_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename RefWrapper,
|
template<typename RefWrapper, typename Allocator,
|
||||||
typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS,
|
typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS>
|
||||||
typename Allocator>
|
|
||||||
struct apply_a
|
struct apply_a
|
||||||
{
|
{
|
||||||
typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER<
|
typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER<
|
||||||
@ -567,27 +562,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, mpl::true_) const
|
assign_functor(FunctionObj f, function_buffer& functor, true_type) const
|
||||||
{
|
{
|
||||||
new (reinterpret_cast<void*>(functor.data)) FunctionObj(f);
|
new (reinterpret_cast<void*>(functor.data)) FunctionObj(f);
|
||||||
}
|
}
|
||||||
template<typename FunctionObj,typename Allocator>
|
template<typename FunctionObj,typename Allocator>
|
||||||
void
|
void
|
||||||
assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, mpl::true_) const
|
assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, true_type) const
|
||||||
{
|
{
|
||||||
assign_functor(f,functor,mpl::true_());
|
assign_functor(f,functor,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, mpl::false_) const
|
assign_functor(FunctionObj f, function_buffer& functor, false_type) const
|
||||||
{
|
{
|
||||||
functor.members.obj_ptr = new FunctionObj(f);
|
functor.members.obj_ptr = new FunctionObj(f);
|
||||||
}
|
}
|
||||||
template<typename FunctionObj,typename Allocator>
|
template<typename FunctionObj,typename Allocator>
|
||||||
void
|
void
|
||||||
assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, mpl::false_) const
|
assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, false_type) const
|
||||||
{
|
{
|
||||||
typedef functor_wrapper<FunctionObj,Allocator> functor_wrapper_type;
|
typedef functor_wrapper<FunctionObj,Allocator> functor_wrapper_type;
|
||||||
#if defined(BOOST_NO_CXX11_ALLOCATOR)
|
#if defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
@ -615,7 +610,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(f, functor,
|
assign_functor(f, functor,
|
||||||
mpl::bool_<(function_allows_small_object_optimization<FunctionObj>::value)>());
|
integral_constant<bool, (function_allows_small_object_optimization<FunctionObj>::value)>());
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -627,7 +622,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(f, functor, a,
|
assign_functor_a(f, functor, a,
|
||||||
mpl::bool_<(function_allows_small_object_optimization<FunctionObj>::value)>());
|
integral_constant<bool, (function_allows_small_object_optimization<FunctionObj>::value)>());
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -708,14 +703,14 @@ namespace boost {
|
|||||||
|
|
||||||
typedef BOOST_FUNCTION_FUNCTION self_type;
|
typedef BOOST_FUNCTION_FUNCTION self_type;
|
||||||
|
|
||||||
BOOST_FUNCTION_FUNCTION() : function_base() { }
|
BOOST_DEFAULTED_FUNCTION(BOOST_FUNCTION_FUNCTION(), : function_base() {})
|
||||||
|
|
||||||
// MSVC chokes if the following two constructors are collapsed into
|
// MSVC chokes if the following two constructors are collapsed into
|
||||||
// one with a default parameter.
|
// one with a default parameter.
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f
|
BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f
|
||||||
#ifndef BOOST_NO_SFINAE
|
#ifndef BOOST_NO_SFINAE
|
||||||
,typename boost::enable_if_c<
|
,typename boost::enable_if_<
|
||||||
!(is_integral<Functor>::value),
|
!(is_integral<Functor>::value),
|
||||||
int>::type = 0
|
int>::type = 0
|
||||||
#endif // BOOST_NO_SFINAE
|
#endif // BOOST_NO_SFINAE
|
||||||
@ -727,7 +722,7 @@ namespace boost {
|
|||||||
template<typename Functor,typename Allocator>
|
template<typename Functor,typename Allocator>
|
||||||
BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a
|
BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a
|
||||||
#ifndef BOOST_NO_SFINAE
|
#ifndef BOOST_NO_SFINAE
|
||||||
,typename boost::enable_if_c<
|
,typename boost::enable_if_<
|
||||||
!(is_integral<Functor>::value),
|
!(is_integral<Functor>::value),
|
||||||
int>::type = 0
|
int>::type = 0
|
||||||
#endif // BOOST_NO_SFINAE
|
#endif // BOOST_NO_SFINAE
|
||||||
@ -776,7 +771,7 @@ namespace boost {
|
|||||||
// construct.
|
// construct.
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
#ifndef BOOST_NO_SFINAE
|
#ifndef BOOST_NO_SFINAE
|
||||||
typename boost::enable_if_c<
|
typename boost::enable_if_<
|
||||||
!(is_integral<Functor>::value),
|
!(is_integral<Functor>::value),
|
||||||
BOOST_FUNCTION_FUNCTION&>::type
|
BOOST_FUNCTION_FUNCTION&>::type
|
||||||
#else
|
#else
|
||||||
@ -955,9 +950,8 @@ 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::BOOST_FUNCTION_GET_INVOKER<tag> get_invoker;
|
typedef boost::detail::function::BOOST_FUNCTION_GET_INVOKER<tag> get_invoker;
|
||||||
typedef typename get_invoker::
|
typedef typename get_invoker::
|
||||||
template apply_a<Functor, R BOOST_FUNCTION_COMMA
|
template apply_a<Functor, Allocator, R BOOST_FUNCTION_COMMA
|
||||||
BOOST_FUNCTION_TEMPLATE_ARGS,
|
BOOST_FUNCTION_TEMPLATE_ARGS>
|
||||||
Allocator>
|
|
||||||
handler_type;
|
handler_type;
|
||||||
|
|
||||||
typedef typename handler_type::invoker_type invoker_type;
|
typedef typename handler_type::invoker_type invoker_type;
|
||||||
@ -1046,7 +1040,7 @@ template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS>
|
|||||||
#if BOOST_FUNCTION_NUM_ARGS == 0
|
#if BOOST_FUNCTION_NUM_ARGS == 0
|
||||||
#define BOOST_FUNCTION_PARTIAL_SPEC R (void)
|
#define BOOST_FUNCTION_PARTIAL_SPEC R (void)
|
||||||
#else
|
#else
|
||||||
#define BOOST_FUNCTION_PARTIAL_SPEC R (BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS,T))
|
#define BOOST_FUNCTION_PARTIAL_SPEC R (BOOST_FUNCTION_TEMPLATE_ARGS)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<typename R BOOST_FUNCTION_COMMA
|
template<typename R BOOST_FUNCTION_COMMA
|
||||||
@ -1061,12 +1055,12 @@ class function<BOOST_FUNCTION_PARTIAL_SPEC>
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
function() : base_type() {}
|
BOOST_DEFAULTED_FUNCTION(function(), : base_type() {})
|
||||||
|
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
function(Functor f
|
function(Functor f
|
||||||
#ifndef BOOST_NO_SFINAE
|
#ifndef BOOST_NO_SFINAE
|
||||||
,typename boost::enable_if_c<
|
,typename boost::enable_if_<
|
||||||
!(is_integral<Functor>::value),
|
!(is_integral<Functor>::value),
|
||||||
int>::type = 0
|
int>::type = 0
|
||||||
#endif
|
#endif
|
||||||
@ -1077,7 +1071,7 @@ public:
|
|||||||
template<typename Functor,typename Allocator>
|
template<typename Functor,typename Allocator>
|
||||||
function(Functor f, Allocator a
|
function(Functor f, Allocator a
|
||||||
#ifndef BOOST_NO_SFINAE
|
#ifndef BOOST_NO_SFINAE
|
||||||
,typename boost::enable_if_c<
|
,typename boost::enable_if_<
|
||||||
!(is_integral<Functor>::value),
|
!(is_integral<Functor>::value),
|
||||||
int>::type = 0
|
int>::type = 0
|
||||||
#endif
|
#endif
|
||||||
@ -1116,7 +1110,7 @@ public:
|
|||||||
|
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
#ifndef BOOST_NO_SFINAE
|
#ifndef BOOST_NO_SFINAE
|
||||||
typename boost::enable_if_c<
|
typename boost::enable_if_<
|
||||||
!(is_integral<Functor>::value),
|
!(is_integral<Functor>::value),
|
||||||
self_type&>::type
|
self_type&>::type
|
||||||
#else
|
#else
|
||||||
|
@ -7,69 +7,53 @@
|
|||||||
|
|
||||||
# For more information, see http://www.boost.org/
|
# For more information, see http://www.boost.org/
|
||||||
|
|
||||||
project
|
|
||||||
: requirements <toolset>msvc:<asynch-exceptions>on
|
|
||||||
: source-location $(BOOST_ROOT)
|
|
||||||
;
|
|
||||||
|
|
||||||
# bring in rules for testing
|
|
||||||
import testing ;
|
import testing ;
|
||||||
|
|
||||||
{
|
run function_test.cpp ;
|
||||||
|
# /usr/include/c++/4.4/bits/shared_ptr.h:146: error: cannot use typeid with -fno-rtti
|
||||||
|
run function_test.cpp : : : <rtti>off <toolset>gcc-4.4.7,<cxxstd>0x:<build>no : function_test_no_rtti ;
|
||||||
|
run function_n_test.cpp ;
|
||||||
|
run allocator_test.cpp ;
|
||||||
|
run stateless_test.cpp ;
|
||||||
|
run lambda_test.cpp ;
|
||||||
|
compile-fail function_test_fail1.cpp ;
|
||||||
|
compile-fail function_test_fail2.cpp ;
|
||||||
|
compile function_30.cpp ;
|
||||||
|
compile function_30_repeat.cpp ;
|
||||||
|
run function_arith_cxx98.cpp ;
|
||||||
|
run function_arith_portable.cpp ;
|
||||||
|
run sum_avg_cxx98.cpp ;
|
||||||
|
run sum_avg_portable.cpp ;
|
||||||
|
run mem_fun_cxx98.cpp ;
|
||||||
|
run mem_fun_portable.cpp ;
|
||||||
|
run std_bind_cxx98.cpp ;
|
||||||
|
run std_bind_portable.cpp ;
|
||||||
|
run function_ref_cxx98.cpp ;
|
||||||
|
run function_ref_portable.cpp ;
|
||||||
|
run contains_test.cpp ;
|
||||||
|
run contains2_test.cpp ;
|
||||||
|
run nothrow_swap.cpp ;
|
||||||
|
run rvalues_test.cpp ;
|
||||||
|
compile function_typeof_test.cpp ;
|
||||||
|
run result_arg_types_test.cpp ;
|
||||||
|
|
||||||
test-suite function
|
lib throw_bad_function_call : throw_bad_function_call.cpp : <link>shared:<define>THROW_BAD_FUNCTION_CALL_DYN_LINK=1 ;
|
||||||
:
|
|
||||||
[ run libs/function/test/function_test.cpp : : : : lib_function_test ]
|
|
||||||
|
|
||||||
[ run libs/function/test/function_test.cpp : : : <rtti>off : lib_function_test_no_rtti ]
|
run test_bad_function_call.cpp throw_bad_function_call : : : <link>shared : test_bad_function_call_shared ;
|
||||||
|
run test_bad_function_call.cpp throw_bad_function_call : : : <link>static : test_bad_function_call_static ;
|
||||||
|
|
||||||
[ run libs/function/test/function_n_test.cpp : : : : ]
|
lib mixed_cxxstd : mixed_cxxstd.cpp : <link>shared:<define>MIXED_CXXSTD_DYN_LINK=1 ;
|
||||||
|
|
||||||
[ run libs/function/test/allocator_test.cpp ../../../libs/test/build//boost_test_exec_monitor : : : : ]
|
run test_mixed_cxxstd.cpp mixed_cxxstd : : : <link>shared : mixed_cxxstd_shared ;
|
||||||
|
run test_mixed_cxxstd.cpp mixed_cxxstd : : : <link>static : mixed_cxxstd_static ;
|
||||||
|
|
||||||
[ run libs/function/test/stateless_test.cpp ../../../libs/test/build//boost_test_exec_monitor : : : : ]
|
run test_mixed_cxxstd.cpp mixed_cxxstd/<cxxstd>98 : : : <link>shared : mixed_cxxstd_shared_98 ;
|
||||||
|
run test_mixed_cxxstd.cpp mixed_cxxstd/<cxxstd>98 : : : <link>static : mixed_cxxstd_static_98 ;
|
||||||
|
|
||||||
[ run libs/function/test/lambda_test.cpp ../../../libs/test/build//boost_test_exec_monitor : : : : ]
|
run test_mixed_cxxstd.cpp mixed_cxxstd/<cxxstd>0x : : : <link>shared : mixed_cxxstd_shared_0x ;
|
||||||
|
run test_mixed_cxxstd.cpp mixed_cxxstd/<cxxstd>0x : : : <link>static : mixed_cxxstd_static_0x ;
|
||||||
|
|
||||||
[ compile-fail libs/function/test/function_test_fail1.cpp : : : : ]
|
local check14 = [ check-target-builds mixed_cxxstd/<cxxstd>14 : : <build>no ] ;
|
||||||
|
|
||||||
[ compile-fail libs/function/test/function_test_fail2.cpp : : : : ]
|
run test_mixed_cxxstd.cpp mixed_cxxstd/<cxxstd>14 : : : <link>shared $(check14) : mixed_cxxstd_shared_14 ;
|
||||||
|
run test_mixed_cxxstd.cpp mixed_cxxstd/<cxxstd>14 : : : <link>static $(check14) : mixed_cxxstd_static_14 ;
|
||||||
[ compile libs/function/test/function_30.cpp : : : : ]
|
|
||||||
|
|
||||||
[ compile libs/function/test/function_30_repeat.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/function_arith_cxx98.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/function_arith_portable.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/sum_avg_cxx98.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/sum_avg_portable.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/mem_fun_cxx98.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/mem_fun_portable.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/std_bind_cxx98.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/std_bind_portable.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/function_ref_cxx98.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/function_ref_portable.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/contains_test.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/contains2_test.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/nothrow_swap.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/rvalues_test.cpp : : : : ]
|
|
||||||
|
|
||||||
[ compile libs/function/test/function_typeof_test.cpp ]
|
|
||||||
|
|
||||||
[ run libs/function/test/result_arg_types_test.cpp ]
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
// For more information, see http://www.boost.org
|
// For more information, see http://www.boost.org
|
||||||
|
|
||||||
#include <boost/test/minimal.hpp>
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <boost/function.hpp>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
@ -74,20 +74,19 @@ struct DoNothing: base
|
|||||||
|
|
||||||
static void do_nothing() {}
|
static void do_nothing() {}
|
||||||
|
|
||||||
int
|
int main()
|
||||||
test_main(int, char*[])
|
|
||||||
{
|
{
|
||||||
function2<int, int, int> f;
|
function2<int, int, int> f;
|
||||||
f.assign( plus_int<disable_small_object_optimization>(), counting_allocator<int>() );
|
f.assign( plus_int<disable_small_object_optimization>(), counting_allocator<int>() );
|
||||||
f.clear();
|
f.clear();
|
||||||
BOOST_CHECK(alloc_count == 1);
|
BOOST_TEST_EQ( alloc_count, 1 );
|
||||||
BOOST_CHECK(dealloc_count == 1);
|
BOOST_TEST_EQ( dealloc_count, 1 );
|
||||||
alloc_count = 0;
|
alloc_count = 0;
|
||||||
dealloc_count = 0;
|
dealloc_count = 0;
|
||||||
f.assign( plus_int<enable_small_object_optimization>(), counting_allocator<int>() );
|
f.assign( plus_int<enable_small_object_optimization>(), counting_allocator<int>() );
|
||||||
f.clear();
|
f.clear();
|
||||||
BOOST_CHECK(alloc_count == 0);
|
BOOST_TEST_EQ( alloc_count, 0 );
|
||||||
BOOST_CHECK(dealloc_count == 0);
|
BOOST_TEST_EQ( dealloc_count, 0 );
|
||||||
f.assign( plus_int<disable_small_object_optimization>(), std::allocator<int>() );
|
f.assign( plus_int<disable_small_object_optimization>(), std::allocator<int>() );
|
||||||
f.clear();
|
f.clear();
|
||||||
f.assign( plus_int<enable_small_object_optimization>(), std::allocator<int>() );
|
f.assign( plus_int<enable_small_object_optimization>(), std::allocator<int>() );
|
||||||
@ -97,8 +96,8 @@ test_main(int, char*[])
|
|||||||
dealloc_count = 0;
|
dealloc_count = 0;
|
||||||
f.assign( &do_minus, counting_allocator<int>() );
|
f.assign( &do_minus, counting_allocator<int>() );
|
||||||
f.clear();
|
f.clear();
|
||||||
BOOST_CHECK(alloc_count == 0);
|
BOOST_TEST_EQ( alloc_count, 0 );
|
||||||
BOOST_CHECK(dealloc_count == 0);
|
BOOST_TEST_EQ( dealloc_count, 0 );
|
||||||
f.assign( &do_minus, std::allocator<int>() );
|
f.assign( &do_minus, std::allocator<int>() );
|
||||||
f.clear();
|
f.clear();
|
||||||
|
|
||||||
@ -107,14 +106,14 @@ test_main(int, char*[])
|
|||||||
dealloc_count = 0;
|
dealloc_count = 0;
|
||||||
fv.assign( DoNothing<disable_small_object_optimization>(), counting_allocator<int>() );
|
fv.assign( DoNothing<disable_small_object_optimization>(), counting_allocator<int>() );
|
||||||
fv.clear();
|
fv.clear();
|
||||||
BOOST_CHECK(alloc_count == 1);
|
BOOST_TEST_EQ( alloc_count, 1 );
|
||||||
BOOST_CHECK(dealloc_count == 1);
|
BOOST_TEST_EQ( dealloc_count, 1 );
|
||||||
alloc_count = 0;
|
alloc_count = 0;
|
||||||
dealloc_count = 0;
|
dealloc_count = 0;
|
||||||
fv.assign( DoNothing<enable_small_object_optimization>(), counting_allocator<int>() );
|
fv.assign( DoNothing<enable_small_object_optimization>(), counting_allocator<int>() );
|
||||||
fv.clear();
|
fv.clear();
|
||||||
BOOST_CHECK(alloc_count == 0);
|
BOOST_TEST_EQ( alloc_count, 0 );
|
||||||
BOOST_CHECK(dealloc_count == 0);
|
BOOST_TEST_EQ( dealloc_count, 0 );
|
||||||
fv.assign( DoNothing<disable_small_object_optimization>(), std::allocator<int>() );
|
fv.assign( DoNothing<disable_small_object_optimization>(), std::allocator<int>() );
|
||||||
fv.clear();
|
fv.clear();
|
||||||
fv.assign( DoNothing<enable_small_object_optimization>(), std::allocator<int>() );
|
fv.assign( DoNothing<enable_small_object_optimization>(), std::allocator<int>() );
|
||||||
@ -124,8 +123,8 @@ test_main(int, char*[])
|
|||||||
dealloc_count = 0;
|
dealloc_count = 0;
|
||||||
fv.assign( &do_nothing, counting_allocator<int>() );
|
fv.assign( &do_nothing, counting_allocator<int>() );
|
||||||
fv.clear();
|
fv.clear();
|
||||||
BOOST_CHECK(alloc_count == 0);
|
BOOST_TEST_EQ( alloc_count, 0 );
|
||||||
BOOST_CHECK(dealloc_count == 0);
|
BOOST_TEST_EQ( dealloc_count, 0 );
|
||||||
fv.assign( &do_nothing, std::allocator<int>() );
|
fv.assign( &do_nothing, std::allocator<int>() );
|
||||||
fv.clear();
|
fv.clear();
|
||||||
|
|
||||||
@ -133,5 +132,5 @@ test_main(int, char*[])
|
|||||||
fv.assign(&do_nothing, std::allocator<int>() );
|
fv.assign(&do_nothing, std::allocator<int>() );
|
||||||
fv2.assign(fv, std::allocator<int>() );
|
fv2.assign(fv, std::allocator<int>() );
|
||||||
|
|
||||||
return 0;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
static int forty_two()
|
static int forty_two()
|
||||||
{
|
{
|
||||||
|
@ -631,7 +631,7 @@ test_ref()
|
|||||||
boost::function2<int, int, int> f(ref(atc));
|
boost::function2<int, int, int> f(ref(atc));
|
||||||
BOOST_CHECK(f(1, 3) == 4);
|
BOOST_CHECK(f(1, 3) == 4);
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {
|
catch(std::runtime_error const&) {
|
||||||
BOOST_ERROR("Nonthrowing constructor threw an exception");
|
BOOST_ERROR("Nonthrowing constructor threw an exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -624,7 +624,7 @@ test_ref()
|
|||||||
boost::function<int (int, int)> f(boost::ref(atc));
|
boost::function<int (int, int)> f(boost::ref(atc));
|
||||||
BOOST_CHECK(f(1, 3) == 4);
|
BOOST_CHECK(f(1, 3) == 4);
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {
|
catch(std::runtime_error const&) {
|
||||||
BOOST_ERROR("Nonthrowing constructor threw an exception");
|
BOOST_ERROR("Nonthrowing constructor threw an exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -651,14 +651,14 @@ static void test_empty_ref()
|
|||||||
f2();
|
f2();
|
||||||
BOOST_ERROR("Exception didn't throw for reference to empty function.");
|
BOOST_ERROR("Exception didn't throw for reference to empty function.");
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {}
|
catch(std::runtime_error const&) {}
|
||||||
|
|
||||||
f1 = dummy;
|
f1 = dummy;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
f2();
|
f2();
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {
|
catch(std::runtime_error const&) {
|
||||||
BOOST_ERROR("Error calling referenced function.");
|
BOOST_ERROR("Error calling referenced function.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -673,7 +673,7 @@ static void test_exception()
|
|||||||
f(5, 4);
|
f(5, 4);
|
||||||
BOOST_CHECK(false);
|
BOOST_CHECK(false);
|
||||||
}
|
}
|
||||||
catch(boost::bad_function_call) {
|
catch(boost::bad_function_call const&) {
|
||||||
// okay
|
// okay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
// For more information, see http://www.boost.org
|
// For more information, see http://www.boost.org
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/lambda/lambda.hpp>
|
||||||
|
#include <boost/lambda/bind.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include <boost/test/minimal.hpp>
|
|
||||||
#include <boost/lambda/lambda.hpp>
|
|
||||||
#include <boost/lambda/bind.hpp>
|
|
||||||
#include <boost/function.hpp>
|
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
func_impl(int arg1, bool arg2, double arg3)
|
func_impl(int arg1, bool arg2, double arg3)
|
||||||
@ -22,17 +22,19 @@ func_impl(int arg1, bool arg2, double arg3)
|
|||||||
return abs (static_cast<int>((arg2 ? arg1 : 2 * arg1) * arg3));
|
return abs (static_cast<int>((arg2 ? arg1 : 2 * arg1) * arg3));
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_main(int, char*[])
|
int main()
|
||||||
{
|
{
|
||||||
using boost::function;
|
using boost::function;
|
||||||
using namespace boost::lambda;
|
using namespace boost::lambda;
|
||||||
|
|
||||||
function <unsigned(bool, double)> f1 = bind(func_impl, 15, _1, _2);
|
function <unsigned(bool, double)> f1 = bind(func_impl, 15, _1, _2);
|
||||||
|
BOOST_TEST_EQ( f1(true, 2.0), 30 );
|
||||||
|
|
||||||
function <unsigned(double)> f2 = boost::lambda::bind(f1, false, _1);
|
function <unsigned(double)> f2 = boost::lambda::bind(f1, false, _1);
|
||||||
|
BOOST_TEST_EQ( f2(2.0), 60 );
|
||||||
|
|
||||||
function <unsigned()> f3 = boost::lambda::bind(f2, 4.0);
|
function <unsigned()> f3 = boost::lambda::bind(f2, 4.0);
|
||||||
|
BOOST_TEST_EQ( f3(), 120 );
|
||||||
|
|
||||||
f3();
|
return boost::report_errors();
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/core/lightweight_test.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/core/lightweight_test.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
42
test/mixed_cxxstd.cpp
Normal file
42
test/mixed_cxxstd.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
// Copyright 2018 Peter Dimov.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(MIXED_CXXSTD_DYN_LINK)
|
||||||
|
# define EXPORT BOOST_SYMBOL_EXPORT
|
||||||
|
#else
|
||||||
|
# define EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EXPORT void call_fn_1( boost::function<void()> const & fn )
|
||||||
|
{
|
||||||
|
fn();
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT void call_fn_2( boost::function<void(int)> const & fn )
|
||||||
|
{
|
||||||
|
fn( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT void call_fn_3( boost::function<void(int, int)> const & fn )
|
||||||
|
{
|
||||||
|
fn( 1, 2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT void call_fn_4( boost::function0<void> const & fn )
|
||||||
|
{
|
||||||
|
fn();
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT void call_fn_5( boost::function1<void, int> const & fn )
|
||||||
|
{
|
||||||
|
fn( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT void call_fn_6( boost::function2<void, int, int> const & fn )
|
||||||
|
{
|
||||||
|
fn( 1, 2 );
|
||||||
|
}
|
@ -7,16 +7,18 @@
|
|||||||
|
|
||||||
// For more information, see http://www.boost.org
|
// For more information, see http://www.boost.org
|
||||||
|
|
||||||
#include <boost/test/minimal.hpp>
|
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
struct stateless_integer_add {
|
struct stateless_integer_add {
|
||||||
int operator()(int x, int y) const { return x+y; }
|
int operator()(int x, int y) const { return x+y; }
|
||||||
|
|
||||||
void* operator new(std::size_t)
|
void* operator new(std::size_t n)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Cannot allocate a stateless_integer_add");
|
BOOST_ERROR( "stateless_integer_add incorrectly allocated" );
|
||||||
|
return ::operator new( n );
|
||||||
}
|
}
|
||||||
|
|
||||||
void* operator new(std::size_t, void* p)
|
void* operator new(std::size_t, void* p)
|
||||||
@ -24,15 +26,17 @@ struct stateless_integer_add {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void*) throw()
|
void operator delete(void* p) throw()
|
||||||
{
|
{
|
||||||
|
BOOST_ERROR( "stateless_integer_add incorrectly deallocated" );
|
||||||
|
return ::operator delete( p );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int test_main(int, char*[])
|
int main()
|
||||||
{
|
{
|
||||||
boost::function2<int, int, int> f;
|
boost::function2<int, int, int> f;
|
||||||
f = stateless_integer_add();
|
f = stateless_integer_add();
|
||||||
|
|
||||||
return 0;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
14
test/test_bad_function_call.cpp
Normal file
14
test/test_bad_function_call.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
// Copyright 2018 Peter Dimov.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
void throw_bad_function_call();
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
BOOST_TEST_THROWS( throw_bad_function_call(), boost::bad_function_call );
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
48
test/test_mixed_cxxstd.cpp
Normal file
48
test/test_mixed_cxxstd.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
// Copyright 2018 Peter Dimov.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
void call_fn_1( boost::function<void()> const & fn );
|
||||||
|
void call_fn_2( boost::function<void(int)> const & fn );
|
||||||
|
void call_fn_3( boost::function<void(int, int)> const & fn );
|
||||||
|
|
||||||
|
void call_fn_4( boost::function0<void> const & fn );
|
||||||
|
void call_fn_5( boost::function1<void, int> const & fn );
|
||||||
|
void call_fn_6( boost::function2<void, int, int> const & fn );
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
static int v;
|
||||||
|
|
||||||
|
void f0()
|
||||||
|
{
|
||||||
|
v = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void f1( int x )
|
||||||
|
{
|
||||||
|
v = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
void f2( int x, int y )
|
||||||
|
{
|
||||||
|
v = x + y;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
v = 0; call_fn_1( f0 ); BOOST_TEST_EQ( v, -1 );
|
||||||
|
v = 0; call_fn_2( f1 ); BOOST_TEST_EQ( v, 1 );
|
||||||
|
v = 0; call_fn_3( f2 ); BOOST_TEST_EQ( v, 3 );
|
||||||
|
|
||||||
|
v = 0; call_fn_4( f0 ); BOOST_TEST_EQ( v, -1 );
|
||||||
|
v = 0; call_fn_5( f1 ); BOOST_TEST_EQ( v, 1 );
|
||||||
|
v = 0; call_fn_6( f2 ); BOOST_TEST_EQ( v, 3 );
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
17
test/throw_bad_function_call.cpp
Normal file
17
test/throw_bad_function_call.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
// Copyright 2018 Peter Dimov.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(THROW_BAD_FUNCTION_CALL_DYN_LINK)
|
||||||
|
# define EXPORT BOOST_SYMBOL_EXPORT
|
||||||
|
#else
|
||||||
|
# define EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EXPORT void throw_bad_function_call()
|
||||||
|
{
|
||||||
|
throw boost::bad_function_call();
|
||||||
|
}
|
Reference in New Issue
Block a user