mirror of
https://github.com/boostorg/function.git
synced 2025-06-26 04:21:38 +02:00
Compare commits
39 Commits
boost-1.67
...
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 | |||
feea19660b | |||
51145b9d2c | |||
251701850a | |||
151ce9492c | |||
7b4f5520e6 | |||
e91b39f94f | |||
4a83ca8a57 | |||
2afccba173 | |||
52fae95412 | |||
9d0acd5195 | |||
0482db3a79 | |||
0ee8e59d0a |
148
.travis.yml
148
.travis.yml
@ -1,4 +1,4 @@
|
|||||||
# Copyright 2016, 2017 Peter Dimov
|
# Copyright 2016, 2017, 2018 Peter Dimov
|
||||||
# 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)
|
||||||
|
|
||||||
@ -6,8 +6,6 @@ language: cpp
|
|||||||
|
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
python: "2.7"
|
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
@ -26,11 +24,31 @@ matrix:
|
|||||||
include:
|
include:
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: g++
|
compiler: g++
|
||||||
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
|
env: TOOLSET=gcc CXXSTD=03,11 VARIANT=debug,release
|
||||||
|
|
||||||
|
- 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
|
- os: linux
|
||||||
compiler: g++-4.7
|
compiler: g++-4.7
|
||||||
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11
|
env: TOOLSET=gcc CXXSTD=03,11
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -40,7 +58,7 @@ matrix:
|
|||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: g++-4.8
|
compiler: g++-4.8
|
||||||
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11
|
env: TOOLSET=gcc CXXSTD=03,11
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -49,7 +67,7 @@ matrix:
|
|||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: g++-4.9
|
compiler: g++-4.9
|
||||||
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11
|
env: TOOLSET=gcc CXXSTD=03,11
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -59,7 +77,7 @@ matrix:
|
|||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: g++-5
|
compiler: g++-5
|
||||||
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z
|
env: TOOLSET=gcc CXXSTD=03,11,14,1z
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -69,7 +87,7 @@ matrix:
|
|||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: g++-6
|
compiler: g++-6
|
||||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
|
env: TOOLSET=gcc CXXSTD=03,11,14,1z
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -78,9 +96,28 @@ matrix:
|
|||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
dist: trusty
|
|
||||||
compiler: g++-7
|
compiler: g++-7
|
||||||
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
|
env: TOOLSET=gcc CXXSTD=03,11,14,17 VARIANT=release
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-8
|
||||||
|
env: TOOLSET=gcc CXXSTD=03,11,14,17,2a
|
||||||
|
addons:
|
||||||
|
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:
|
||||||
@ -90,11 +127,27 @@ matrix:
|
|||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang++
|
compiler: clang++
|
||||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
|
env: TOOLSET=clang CXXSTD=03,11 VARIANT=debug,release
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: /usr/bin/clang++
|
||||||
|
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
|
- os: linux
|
||||||
compiler: clang++-3.5
|
compiler: clang++-3.5
|
||||||
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -106,7 +159,7 @@ matrix:
|
|||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang++-3.6
|
compiler: clang++-3.6
|
||||||
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -117,7 +170,7 @@ matrix:
|
|||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang++-3.7
|
compiler: clang++-3.7
|
||||||
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -128,7 +181,7 @@ matrix:
|
|||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang++-3.8
|
compiler: clang++-3.8
|
||||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -140,7 +193,7 @@ matrix:
|
|||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang++-3.9
|
compiler: clang++-3.9
|
||||||
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -152,7 +205,7 @@ matrix:
|
|||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang++-4.0
|
compiler: clang++-4.0
|
||||||
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -163,7 +216,7 @@ matrix:
|
|||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang++-5.0
|
compiler: clang++-5.0
|
||||||
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
|
env: TOOLSET=clang CXXSTD=03,11,14,1z VARIANT=release
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -172,14 +225,63 @@ matrix:
|
|||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
- llvm-toolchain-trusty-5.0
|
- llvm-toolchain-trusty-5.0
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-6.0
|
||||||
|
env: TOOLSET=clang CXXSTD=03,11,14,17,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-6.0
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-6.0
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-7
|
||||||
|
env: TOOLSET=clang CXXSTD=03,11,14,17,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-7
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-5.0
|
||||||
|
env: UBSAN=1 TOOLSET=clang CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-5.0
|
||||||
|
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
|
- os: osx
|
||||||
compiler: clang++
|
compiler: clang++
|
||||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
|
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
||||||
- cd ..
|
- cd ..
|
||||||
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
- git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
|
||||||
- cd boost-root
|
- cd boost-root
|
||||||
- git submodule update --init tools/build
|
- git submodule update --init tools/build
|
||||||
- git submodule update --init libs/config
|
- git submodule update --init libs/config
|
||||||
@ -191,8 +293,8 @@ install:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
- |-
|
- |-
|
||||||
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
|
echo "using $TOOLSET : : $TRAVIS_COMPILER ;" > ~/user-config.jam
|
||||||
- ./b2 -j 3 libs/function/test toolset=$TOOLSET cxxstd=$CXXSTD
|
- ./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:
|
||||||
|
11
Jamfile
Normal file
11
Jamfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Boost.Function Library Jamfile
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 James E. King III
|
||||||
|
#
|
||||||
|
# Use, modification, and distribution are subject to the
|
||||||
|
# Boost Software License, Version 1.0. (See accompanying file
|
||||||
|
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
# please order by name to ease maintenance
|
||||||
|
build-project example ;
|
||||||
|
build-project test ;
|
23
LICENSE
Normal file
23
LICENSE
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
do so, all subject to the following:
|
||||||
|
|
||||||
|
The copyright notices in the Software and this entire statement, including
|
||||||
|
the above license grant, this restriction and the following disclaimer,
|
||||||
|
must be included in all copies of the Software, in whole or in part, and
|
||||||
|
all derivative works of the Software, unless such copies or derivative
|
||||||
|
works are solely in the form of machine-executable object code generated by
|
||||||
|
a source language processor.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
34
README.md
Normal file
34
README.md
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
Function, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), contains a family of class templates that are function object wrappers.
|
||||||
|
|
||||||
|
### License
|
||||||
|
|
||||||
|
Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
|
||||||
|
* C++03
|
||||||
|
* Header-Only
|
||||||
|
|
||||||
|
### Build Status
|
||||||
|
|
||||||
|
Branch | Travis | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests |
|
||||||
|
:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- |
|
||||||
|
[`master`](https://github.com/boostorg/function/tree/master) | [](https://travis-ci.org/boostorg/function) | [](https://ci.appveyor.com/project/jeking3/function-d036y/branch/master) | [](https://scan.coverity.com/projects/boostorg-function) | [](https://codecov.io/gh/boostorg/function/branch/master)| [](https://pdimov.github.io/boostdep-report/master/function.html) | [](http://www.boost.org/doc/libs/master/doc/html/function.html) | [](http://www.boost.org/development/tests/master/developer/function.html)
|
||||||
|
[`develop`](https://github.com/boostorg/function/tree/develop) | [](https://travis-ci.org/boostorg/function) | [](https://ci.appveyor.com/project/jeking3/function-d036y/branch/develop) | [](https://scan.coverity.com/projects/boostorg-function) | [](https://codecov.io/gh/boostorg/function/branch/develop) | [](https://pdimov.github.io/boostdep-report/develop/function.html) | [](http://www.boost.org/doc/libs/develop/doc/html/function.html) | [](http://www.boost.org/development/tests/develop/developer/function.html)
|
||||||
|
|
||||||
|
### Directories
|
||||||
|
|
||||||
|
| Name | Purpose |
|
||||||
|
| ----------- | ------------------------------ |
|
||||||
|
| `doc` | documentation |
|
||||||
|
| `example` | examples |
|
||||||
|
| `include` | headers |
|
||||||
|
| `test` | unit tests |
|
||||||
|
|
||||||
|
### More information
|
||||||
|
|
||||||
|
* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-function)
|
||||||
|
* [Report bugs](https://github.com/boostorg/function/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well.
|
||||||
|
* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
|
||||||
|
* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[function]` tag at the beginning of the subject line.
|
||||||
|
|
126
appveyor.yml
Normal file
126
appveyor.yml
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
# Copyright 2016, 2017 Peter Dimov
|
||||||
|
# Copyright (C) 2017, 2018 James E. King III
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
#
|
||||||
|
# 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}
|
||||||
|
|
||||||
|
shallow_clone: true
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- develop
|
||||||
|
- master
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
# Adding MAYFAIL to any matrix job allows it to fail but the build stays green:
|
||||||
|
allow_failures:
|
||||||
|
- MAYFAIL: true
|
||||||
|
|
||||||
|
environment:
|
||||||
|
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:
|
||||||
|
# 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_LINK: link=shared,static
|
||||||
|
# B2_THREADING: threading=multi,single
|
||||||
|
B2_VARIANT: variant=release,debug
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
- 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
|
||||||
|
TOOLSET: msvc-14.1
|
||||||
|
B2_ADDRESS_MODEL: address-model=64,32
|
||||||
|
|
||||||
|
- FLAVOR: Visual Studio 2015 C++14 (Default)
|
||||||
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
|
TOOLSET: msvc-14.0
|
||||||
|
B2_ADDRESS_MODEL: address-model=64,32
|
||||||
|
|
||||||
|
- FLAVOR: Visual Studio 2010, 2012, 2013
|
||||||
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
|
TOOLSET: msvc-10.0,msvc-11.0,msvc-12.0
|
||||||
|
|
||||||
|
- FLAVOR: cygwin (32-bit)
|
||||||
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
ADDPATH: C:\cygwin\bin;
|
||||||
|
B2_ADDRESS_MODEL: address-model=32
|
||||||
|
CXXSTD: 03,11
|
||||||
|
# https://github.com/boostorg/test/issues/144
|
||||||
|
DEFINES: define=_POSIX_C_SOURCE=200112L
|
||||||
|
THREADING: threadapi=pthread
|
||||||
|
TOOLSET: gcc
|
||||||
|
|
||||||
|
- FLAVOR: cygwin (64-bit)
|
||||||
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
ADDPATH: C:\cygwin64\bin;
|
||||||
|
B2_ADDRESS_MODEL: address-model=64
|
||||||
|
CXXSTD: 11,17
|
||||||
|
# https://github.com/boostorg/test/issues/144
|
||||||
|
DEFINES: define=_POSIX_C_SOURCE=200112L define=__USE_ISOC99
|
||||||
|
THREADING: threadapi=pthread
|
||||||
|
TOOLSET: gcc
|
||||||
|
|
||||||
|
- FLAVOR: mingw32
|
||||||
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
ARCH: i686
|
||||||
|
B2_ADDRESS_MODEL: address-model=32
|
||||||
|
CXXSTD: 03,11
|
||||||
|
SCRIPT: ci\appveyor\mingw.bat
|
||||||
|
|
||||||
|
- FLAVOR: mingw64
|
||||||
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
ARCH: x86_64
|
||||||
|
B2_ADDRESS_MODEL: address-model=64
|
||||||
|
CXXSTD: 11,17
|
||||||
|
DEFINES: define=__USE_ISOC99
|
||||||
|
SCRIPT: ci\appveyor\mingw.bat
|
||||||
|
|
||||||
|
install:
|
||||||
|
- set SELF=%APPVEYOR_PROJECT_NAME:-=_%
|
||||||
|
- git clone https://github.com/jeking3/boost-ci.git C:\boost-ci
|
||||||
|
- xcopy /s /e /q /i C:\boost-ci\ci .\ci
|
||||||
|
- ci\appveyor\install.bat
|
||||||
|
|
||||||
|
build: off
|
||||||
|
|
||||||
|
test_script:
|
||||||
|
- set SELF=%APPVEYOR_PROJECT_NAME:-=_%
|
||||||
|
- PATH=%ADDPATH%%PATH%
|
||||||
|
# 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)
|
21
example/Jamfile.v2
Normal file
21
example/Jamfile.v2
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Boost.Function Library example Jamfile
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 James E. King III
|
||||||
|
#
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
import ../../config/checks/config : requires ;
|
||||||
|
import os ;
|
||||||
|
import testing ;
|
||||||
|
|
||||||
|
project
|
||||||
|
: requirements
|
||||||
|
;
|
||||||
|
|
||||||
|
test-suite "function-examples"
|
||||||
|
: [ run bind1st.cpp : : : [ requires cxx98_binders ] ]
|
||||||
|
[ run int_div.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
|
||||||
@ -904,7 +899,9 @@ namespace boost {
|
|||||||
if (!f.empty()) {
|
if (!f.empty()) {
|
||||||
this->vtable = f.vtable;
|
this->vtable = f.vtable;
|
||||||
if (this->has_trivial_copy_and_destroy())
|
if (this->has_trivial_copy_and_destroy())
|
||||||
this->functor = f.functor;
|
// Don't operate on storage directly since union type doesn't relax
|
||||||
|
// strict aliasing rules, despite of having member char type.
|
||||||
|
std::memcpy(this->functor.data, f.functor.data, sizeof(boost::detail::function::function_buffer));
|
||||||
else
|
else
|
||||||
get_vtable()->base.manager(f.functor, this->functor,
|
get_vtable()->base.manager(f.functor, this->functor,
|
||||||
boost::detail::function::clone_functor_tag);
|
boost::detail::function::clone_functor_tag);
|
||||||
@ -953,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;
|
||||||
@ -992,7 +988,9 @@ namespace boost {
|
|||||||
if (!f.empty()) {
|
if (!f.empty()) {
|
||||||
this->vtable = f.vtable;
|
this->vtable = f.vtable;
|
||||||
if (this->has_trivial_copy_and_destroy())
|
if (this->has_trivial_copy_and_destroy())
|
||||||
this->functor = f.functor;
|
// Don't operate on storage directly since union type doesn't relax
|
||||||
|
// strict aliasing rules, despite of having member char type.
|
||||||
|
std::memcpy(this->functor.data, f.functor.data, sizeof(this->functor.data));
|
||||||
else
|
else
|
||||||
get_vtable()->base.manager(f.functor, this->functor,
|
get_vtable()->base.manager(f.functor, this->functor,
|
||||||
boost::detail::function::move_functor_tag);
|
boost::detail::function::move_functor_tag);
|
||||||
@ -1042,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
|
||||||
@ -1057,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
|
||||||
@ -1073,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
|
||||||
@ -1112,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