forked from boostorg/function
Compare commits
26 Commits
feature/fu
...
feature/us
Author | SHA1 | Date | |
---|---|---|---|
cd79ba8c8b | |||
f3e4ed2481 | |||
a7c28f6117 | |||
8ec9323003 | |||
c39ca938a6 | |||
4b25a75c03 | |||
5682111fad | |||
1694b32e1b | |||
eaf2151263 | |||
d9043b76d6 | |||
2e2c44f070 | |||
7f69508eac | |||
6d811a2e72 | |||
3f6b2b6f56 | |||
439d64d8a8 | |||
3f46081c59 | |||
17716b63f2 | |||
b6b0568c88 | |||
babdbe500d | |||
db39532c45 | |||
eb09bb6fec | |||
ccc66b34d9 | |||
e7952cb242 | |||
57f4171c77 | |||
30f31f894c | |||
bfb0e4701e |
89
.travis.yml
89
.travis.yml
@ -1,4 +1,4 @@
|
||||
# Copyright 2016, 2017, 2018 Peter Dimov
|
||||
# Copyright 2016-2019 Peter Dimov
|
||||
# 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)
|
||||
|
||||
@ -6,6 +6,8 @@ language: cpp
|
||||
|
||||
sudo: false
|
||||
|
||||
dist: trusty
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
@ -24,11 +26,11 @@ matrix:
|
||||
include:
|
||||
- os: linux
|
||||
compiler: g++
|
||||
env: TOOLSET=gcc CXXSTD=03,11 VARIANT=debug,release
|
||||
env: TOOLSET=gcc CXXSTD=11
|
||||
|
||||
- os: linux
|
||||
compiler: g++-4.4
|
||||
env: TOOLSET=gcc CXXSTD=98,0x
|
||||
env: TOOLSET=gcc CXXSTD=0x
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -38,7 +40,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: g++-4.6
|
||||
env: TOOLSET=gcc CXXSTD=03,0x
|
||||
env: TOOLSET=gcc CXXSTD=0x
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -48,7 +50,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: g++-4.7
|
||||
env: TOOLSET=gcc CXXSTD=03,11
|
||||
env: TOOLSET=gcc CXXSTD=11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -58,7 +60,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: g++-4.8
|
||||
env: TOOLSET=gcc CXXSTD=03,11
|
||||
env: TOOLSET=gcc CXXSTD=11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -67,7 +69,7 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
- os: linux
|
||||
compiler: g++-4.9
|
||||
env: TOOLSET=gcc CXXSTD=03,11
|
||||
env: TOOLSET=gcc CXXSTD=11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -77,7 +79,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: g++-5
|
||||
env: TOOLSET=gcc CXXSTD=03,11,14,1z
|
||||
env: TOOLSET=gcc CXXSTD=11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -87,7 +89,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: g++-6
|
||||
env: TOOLSET=gcc CXXSTD=03,11,14,1z
|
||||
env: TOOLSET=gcc CXXSTD=11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -97,7 +99,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: g++-7
|
||||
env: TOOLSET=gcc CXXSTD=03,11,14,17 VARIANT=release
|
||||
env: TOOLSET=gcc CXXSTD=11,14,17
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -107,7 +109,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: g++-8
|
||||
env: TOOLSET=gcc CXXSTD=03,11,14,17,2a
|
||||
env: TOOLSET=gcc CXXSTD=11,14,17,2a
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -115,9 +117,19 @@ matrix:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-9
|
||||
env: TOOLSET=gcc CXXSTD=11,14,17,2a
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-9
|
||||
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
|
||||
env: UBSAN=1 TOOLSET=gcc CXXSTD=11,14,17 UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -127,11 +139,11 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang CXXSTD=03,11 VARIANT=debug,release
|
||||
env: TOOLSET=clang CXXSTD=11
|
||||
|
||||
- os: linux
|
||||
compiler: /usr/bin/clang++
|
||||
env: TOOLSET=clang CXXSTD=03,11
|
||||
env: TOOLSET=clang CXXSTD=11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -139,7 +151,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: /usr/bin/clang++
|
||||
env: TOOLSET=clang CXXSTD=03,11
|
||||
env: TOOLSET=clang CXXSTD=11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -147,7 +159,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.5
|
||||
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||
env: TOOLSET=clang CXXSTD=11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -159,7 +171,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.6
|
||||
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||
env: TOOLSET=clang CXXSTD=11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -170,7 +182,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.7
|
||||
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||
env: TOOLSET=clang CXXSTD=11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -181,7 +193,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.8
|
||||
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||
env: TOOLSET=clang CXXSTD=11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -193,7 +205,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.9
|
||||
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||
env: TOOLSET=clang CXXSTD=11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -205,7 +217,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-4.0
|
||||
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||
env: TOOLSET=clang CXXSTD=11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -216,7 +228,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-5.0
|
||||
env: TOOLSET=clang CXXSTD=03,11,14,1z VARIANT=release
|
||||
env: TOOLSET=clang CXXSTD=11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -227,7 +239,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-6.0
|
||||
env: TOOLSET=clang CXXSTD=03,11,14,17,2a
|
||||
env: TOOLSET=clang CXXSTD=11,14,17,2a
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -238,7 +250,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-7
|
||||
env: TOOLSET=clang CXXSTD=03,11,14,17,2a
|
||||
env: TOOLSET=clang CXXSTD=11,14,17,2a
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -248,19 +260,30 @@ matrix:
|
||||
- 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
|
||||
compiler: clang++-8
|
||||
env: TOOLSET=clang CXXSTD=11,14,17,2a
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-5.0
|
||||
- clang-8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-5.0
|
||||
- llvm-toolchain-trusty-8
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-8
|
||||
env: UBSAN=1 TOOLSET=clang CXXSTD=11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-8
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-libc++
|
||||
env: TOOLSET=clang CXXSTD=03,11,14,1z VARIANT=release
|
||||
env: TOOLSET=clang CXXSTD=11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -268,7 +291,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-libc++
|
||||
env: UBSAN=1 TOOLSET=clang CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
|
||||
env: UBSAN=1 TOOLSET=clang CXXSTD=11,14,1z UBSAN_OPTIONS=print_stacktrace=1
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -276,15 +299,13 @@ matrix:
|
||||
|
||||
- os: osx
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang CXXSTD=03,11,14,1z
|
||||
env: TOOLSET=clang CXXSTD=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
|
||||
@ -294,7 +315,7 @@ install:
|
||||
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}
|
||||
- ./b2 -j3 libs/function/test toolset=$TOOLSET cxxstd=$CXXSTD variant=debug,release ${UBSAN:+cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined linkflags=-fsanitize=undefined debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS}
|
||||
|
||||
notifications:
|
||||
email:
|
||||
|
28
CMakeLists.txt
Normal file
28
CMakeLists.txt
Normal file
@ -0,0 +1,28 @@
|
||||
# Copyright 2019 Peter Dimov
|
||||
# Distributed under 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
|
||||
|
||||
# Partial (add_subdirectory only) and experimental CMake support
|
||||
# Subject to change; please do not rely on the contents of this file yet
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(BoostFunction LANGUAGES CXX)
|
||||
|
||||
add_library(boost_function INTERFACE)
|
||||
add_library(Boost::function ALIAS boost_function)
|
||||
|
||||
target_include_directories(boost_function INTERFACE include)
|
||||
|
||||
target_link_libraries(boost_function
|
||||
INTERFACE
|
||||
Boost::assert
|
||||
Boost::bind
|
||||
Boost::config
|
||||
Boost::core
|
||||
Boost::integer
|
||||
Boost::preprocessor
|
||||
Boost::throw_exception
|
||||
Boost::type_index
|
||||
Boost::type_traits
|
||||
Boost::typeof
|
||||
)
|
11
Jamfile
11
Jamfile
@ -1,11 +0,0 @@
|
||||
# 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
23
LICENSE
@ -1,23 +0,0 @@
|
||||
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.
|
40
README.md
40
README.md
@ -1,34 +1,18 @@
|
||||
Function, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), contains a family of class templates that are function object wrappers.
|
||||
# Boost.Function, a polymorphic function wrapper
|
||||
|
||||
### License
|
||||
[Boost.Function](http://boost.org/libs/function), part of the
|
||||
[Boost C++ Libraries](http://boost.org), is the original implementation of the
|
||||
polymorphic function wrapper `boost::function`, which was eventually accepted
|
||||
into the C++11 standard as [`std::function`](https://en.cppreference.com/w/cpp/utility/functional/function).
|
||||
|
||||
Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
|
||||
## Currently supported compilers
|
||||
|
||||
### Properties
|
||||
* g++ 4.4 or later
|
||||
* clang++ 3.3 or later
|
||||
* Visual Studio 2005-2017
|
||||
|
||||
* C++03
|
||||
* Header-Only
|
||||
Tested on [Travis](https://travis-ci.org/boostorg/function/) and [Appveyor](https://ci.appveyor.com/project/pdimov/function/).
|
||||
|
||||
### 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.
|
||||
## License
|
||||
|
||||
Distributed under the [Boost Software License, Version 1.0](http://boost.org/LICENSE_1_0.txt).
|
||||
|
137
appveyor.yml
137
appveyor.yml
@ -1,126 +1,61 @@
|
||||
# Copyright 2016, 2017 Peter Dimov
|
||||
# Copyright (C) 2017, 2018 James E. King III
|
||||
# Copyright 2016-2019 Peter Dimov
|
||||
# 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
|
||||
- develop
|
||||
- /feature\/.*/
|
||||
|
||||
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
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
TOOLSET: msvc-12.0,msvc-14.0
|
||||
ADDRMD: 32,64
|
||||
- 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
|
||||
CXXSTD: 14,17
|
||||
ADDRMD: 32,64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
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
|
||||
CXXSTD: 11,14,1z
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
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
|
||||
CXXSTD: 11,14,1z
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\mingw\bin;
|
||||
TOOLSET: gcc
|
||||
CXXSTD: 11,14,1z
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
|
||||
TOOLSET: gcc
|
||||
CXXSTD: 11,14,1z
|
||||
|
||||
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
|
||||
- set BOOST_BRANCH=develop
|
||||
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
|
||||
- cd ..
|
||||
- git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
- cd boost-root
|
||||
- git submodule update --init tools/boostdep
|
||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\function\
|
||||
- python tools/boostdep/depinst/depinst.py function
|
||||
- cmd /c bootstrap
|
||||
- b2 -d0 headers
|
||||
|
||||
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)
|
||||
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
|
||||
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
|
||||
- b2 -j3 libs/function/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release
|
||||
|
14
example/Jamfile
Normal file
14
example/Jamfile
Normal file
@ -0,0 +1,14 @@
|
||||
# Boost.Function Library example Jamfile
|
||||
#
|
||||
# Copyright (c) 2008 James E. King III
|
||||
#
|
||||
# Distributed under 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
|
||||
|
||||
import ../../config/checks/config : requires ;
|
||||
import testing ;
|
||||
|
||||
run bind1st.cpp : : : [ requires cxx98_binders ] ;
|
||||
run int_div.cpp ;
|
||||
run sum_avg.cpp ;
|
@ -1,21 +0,0 @@
|
||||
# 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 ]
|
||||
;
|
||||
|
@ -10,6 +10,364 @@
|
||||
// William Kempf, Jesse Jones and Karl Nelson were all very helpful in the
|
||||
// design of this library.
|
||||
|
||||
#include <boost/function/detail/config.hpp>
|
||||
|
||||
#if !BOOST_FUNCTION_ENABLE_CXX03
|
||||
|
||||
#ifndef BOOST_FUNCTION_HPP_INCLUDED
|
||||
#define BOOST_FUNCTION_HPP_INCLUDED
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/function_equal.hpp>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
#define BOOST_FUNCTION_TARGET_FIX(x)
|
||||
|
||||
using std::bad_function_call;
|
||||
|
||||
template<class S> class function: public std::function<S>
|
||||
{
|
||||
public:
|
||||
|
||||
function() = default;
|
||||
|
||||
function(function const&) = default;
|
||||
function(function&&) = default;
|
||||
|
||||
using std::function<S>::function;
|
||||
|
||||
template<class T> function( boost::reference_wrapper<T> rt ): std::function<S>( std::ref( rt.get() ) )
|
||||
{
|
||||
}
|
||||
|
||||
function& operator=( function const& r ) = default;
|
||||
function& operator=( function&& r ) = default;
|
||||
|
||||
template<class S2> function& operator=( function<S2> const& r )
|
||||
{
|
||||
std::function<S>::operator=( static_cast< std::function<S2> const& >( r ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class S2> function& operator=( function<S2>&& r )
|
||||
{
|
||||
std::function<S>::operator=( static_cast< std::function<S2>&& >( r ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class F, class E = typename std::enable_if< !std::is_integral<F>::value && !std::is_same<F, function>::value >::type > function& operator=( F f )
|
||||
{
|
||||
std::function<S>::operator=( std::move( f ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
function& operator=( std::nullptr_t f )
|
||||
{
|
||||
std::function<S>::operator=( f );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class T> function& operator=( boost::reference_wrapper<T> rt )
|
||||
{
|
||||
std::function<S>::operator=( std::ref( rt.get() ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool empty() const noexcept
|
||||
{
|
||||
return ! *this;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
*this = nullptr;
|
||||
}
|
||||
|
||||
template<class F, class A> void assign( F f, A )
|
||||
{
|
||||
this->operator=( std::move( f ) );
|
||||
}
|
||||
|
||||
template<class F> F * target() noexcept
|
||||
{
|
||||
if( F * p = std::function<S>::template target<F>() )
|
||||
{
|
||||
return p;
|
||||
}
|
||||
|
||||
if( std::reference_wrapper<F> * p = std::function<S>::template target< std::reference_wrapper<F> >() )
|
||||
{
|
||||
return std::addressof( p->get() );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template<class F> F const * target() const noexcept
|
||||
{
|
||||
if( F const * p = std::function<S>::template target<F>() )
|
||||
{
|
||||
return p;
|
||||
}
|
||||
|
||||
if( std::reference_wrapper<F> const * p = std::function<S>::template target< std::reference_wrapper<F> >() )
|
||||
{
|
||||
return std::addressof( p->get() );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template<class F> bool contains( F const& f ) const noexcept
|
||||
{
|
||||
if( F const * fp = this->template target<F>() )
|
||||
{
|
||||
return function_equal( *fp, f );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<class S, class F, class E = typename std::enable_if< !std::is_integral<F>::value && !std::is_same<F, std::nullptr_t>::value>::type> inline bool operator==( function<S> const & g, F f )
|
||||
{
|
||||
return g.contains( f );
|
||||
}
|
||||
|
||||
template<class S, class F, class E = typename std::enable_if< !std::is_integral<F>::value && !std::is_same<F, std::nullptr_t>::value>::type> inline bool operator!=( function<S> const & g, F f )
|
||||
{
|
||||
return !g.contains( f );
|
||||
}
|
||||
|
||||
template<class S, class F> inline bool operator==( function<S> const & g, boost::reference_wrapper<F> rf )
|
||||
{
|
||||
return g.template target<F>() == std::addressof( rf.get() );
|
||||
}
|
||||
|
||||
template<class S, class F> inline bool operator!=( function<S> const & g, boost::reference_wrapper<F> rf )
|
||||
{
|
||||
return g.template target<F>() != std::addressof( rf.get() );
|
||||
}
|
||||
|
||||
template<class S, class F, class E = typename std::enable_if< !std::is_integral<F>::value && !std::is_same<F, std::nullptr_t>::value>::type> inline bool operator==( F f, function<S> const & g )
|
||||
{
|
||||
return g.contains( f );
|
||||
}
|
||||
|
||||
template<class S, class F, class E = typename std::enable_if< !std::is_integral<F>::value && !std::is_same<F, std::nullptr_t>::value>::type> inline bool operator!=( F f, function<S> const & g )
|
||||
{
|
||||
return !g.contains( f );
|
||||
}
|
||||
|
||||
template<class S, class F> inline bool operator==( boost::reference_wrapper<F> rf, function<S> const & g )
|
||||
{
|
||||
return g.template target<F>() == std::addressof( rf.get() );
|
||||
}
|
||||
|
||||
template<class S, class F> inline bool operator!=( boost::reference_wrapper<F> rf, function<S> const & g )
|
||||
{
|
||||
return g.template target<F>() != std::addressof( rf.get() );
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<class T1, class T2> struct is_similar
|
||||
{
|
||||
BOOST_STATIC_CONSTANT( bool, value = false );
|
||||
};
|
||||
|
||||
template<template<class...> class L, class... T1, class... T2> struct is_similar< L<T1...>, L<T2...> >
|
||||
{
|
||||
BOOST_STATIC_CONSTANT( bool, value = true );
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#define BOOST_FUNCTION_N_COMMON \
|
||||
\
|
||||
using base_type::base_type;\
|
||||
\
|
||||
template<class F, class E = typename std::enable_if< !std::is_integral<F>::value && !detail::is_similar<F, this_type>::value >::type > this_type& operator=( F f )\
|
||||
{\
|
||||
base_type::operator=( std::move( f ) );\
|
||||
return *this;\
|
||||
}\
|
||||
\
|
||||
this_type& operator=( std::nullptr_t f )\
|
||||
{\
|
||||
base_type::operator=( f );\
|
||||
return *this;\
|
||||
}\
|
||||
\
|
||||
template<class S2> this_type& operator=( boost::function<S2> const& r )\
|
||||
{\
|
||||
base_type::operator=( r );\
|
||||
return *this;\
|
||||
}\
|
||||
\
|
||||
template<class S2> this_type& operator=( boost::function<S2>&& r )\
|
||||
{\
|
||||
base_type::operator=( std::move( r ) );\
|
||||
return *this;\
|
||||
}
|
||||
|
||||
template<typename R> class function0: public function<R()>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef function0 this_type;
|
||||
typedef function<R()> base_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_FUNCTION_N_COMMON
|
||||
};
|
||||
|
||||
template<typename R, typename T1> class function1: public function<R(T1)>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef function1 this_type;
|
||||
typedef function<R(T1)> base_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_FUNCTION_N_COMMON
|
||||
};
|
||||
|
||||
template<typename R, typename T1, typename T2> class function2: public function<R(T1, T2)>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef function2 this_type;
|
||||
typedef function<R(T1, T2)> base_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_FUNCTION_N_COMMON
|
||||
};
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3> class function3: public function<R(T1, T2, T3)>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef function3 this_type;
|
||||
typedef function<R(T1, T2, T3)> base_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_FUNCTION_N_COMMON
|
||||
};
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4> class function4: public function<R(T1, T2, T3, T4)>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef function4 this_type;
|
||||
typedef function<R(T1, T2, T3, T4)> base_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_FUNCTION_N_COMMON
|
||||
};
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4, typename T5> class function5: public function<R(T1, T2, T3, T4, T5)>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef function5 this_type;
|
||||
typedef function<R(T1, T2, T3, T4, T5)> base_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_FUNCTION_N_COMMON
|
||||
};
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> class function6: public function<R(T1, T2, T3, T4, T5, T6)>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef function6 this_type;
|
||||
typedef function<R(T1, T2, T3, T4, T5, T6)> base_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_FUNCTION_N_COMMON
|
||||
};
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> class function7: public function<R(T1, T2, T3, T4, T5, T6, T7)>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef function7 this_type;
|
||||
typedef function<R(T1, T2, T3, T4, T5, T6, T7)> base_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_FUNCTION_N_COMMON
|
||||
};
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> class function8: public function<R(T1, T2, T3, T4, T5, T6, T7, T8)>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef function8 this_type;
|
||||
typedef function<R(T1, T2, T3, T4, T5, T6, T7, T8)> base_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_FUNCTION_N_COMMON
|
||||
};
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> class function9: public function<R(T1, T2, T3, T4, T5, T6, T7, T8, T9)>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef function9 this_type;
|
||||
typedef function<R(T1, T2, T3, T4, T5, T6, T7, T8, T9)> base_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_FUNCTION_N_COMMON
|
||||
};
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> class function10: public function<R(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef function10 this_type;
|
||||
typedef function<R(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> base_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_FUNCTION_N_COMMON
|
||||
};
|
||||
|
||||
template<typename R, typename... A> class function30: public function<R(A...)>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef function30 this_type;
|
||||
typedef function<R(A...)> base_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_FUNCTION_N_COMMON
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_FUNCTION_HPP_INCLUDED
|
||||
|
||||
#else
|
||||
|
||||
#ifndef BOOST_FUNCTION_MAX_ARGS
|
||||
# define BOOST_FUNCTION_MAX_ARGS 10
|
||||
#endif // BOOST_FUNCTION_MAX_ARGS
|
||||
@ -72,3 +430,5 @@
|
||||
#endif
|
||||
|
||||
#endif // !defined(BOOST_FUNCTION_MAX_ARGS_DEFINED) || (BOOST_FUNCTION_MAX_ARGS_DEFINED != BOOST_FUNCTION_MAX_ARGS)
|
||||
|
||||
#endif
|
||||
|
12
include/boost/function/detail/config.hpp
Normal file
12
include/boost/function/detail/config.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright 2019 Peter Dimov
|
||||
// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#ifndef BOOST_FUNCTION_DETAIL_CONFIG_HPP_INCLUDED
|
||||
#define BOOST_FUNCTION_DETAIL_CONFIG_HPP_INCLUDED
|
||||
|
||||
#if !defined(BOOST_FUNCTION_ENABLE_CXX03)
|
||||
# define BOOST_FUNCTION_ENABLE_CXX03 0
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_FUNCTION_DETAIL_CONFIG_HPP_INCLUDED
|
@ -7,6 +7,10 @@
|
||||
|
||||
// For more information, see http://www.boost.org
|
||||
|
||||
#include <boost/function/detail/config.hpp>
|
||||
|
||||
#if BOOST_FUNCTION_ENABLE_CXX03
|
||||
|
||||
#if BOOST_FUNCTION_NUM_ARGS == 0
|
||||
# undef BOOST_FUNCTION_MAX_ARGS_DEFINED
|
||||
# define BOOST_FUNCTION_MAX_ARGS_DEFINED 0
|
||||
@ -367,3 +371,5 @@
|
||||
#else
|
||||
# error Cannot handle Boost.Function objects that accept more than 50 arguments!
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -396,16 +396,12 @@ namespace boost {
|
||||
functor_manager_operation_type op)
|
||||
{
|
||||
typedef typename get_function_tag<functor_type>::type tag_type;
|
||||
switch (op) {
|
||||
case get_functor_type_tag:
|
||||
if (op == get_functor_type_tag) {
|
||||
out_buffer.members.type.type = &boost::typeindex::type_id<functor_type>().type_info();
|
||||
out_buffer.members.type.const_qualified = false;
|
||||
out_buffer.members.type.volatile_qualified = false;
|
||||
return;
|
||||
|
||||
default:
|
||||
} else {
|
||||
manager(in_buffer, out_buffer, op, tag_type());
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -510,16 +506,12 @@ namespace boost {
|
||||
functor_manager_operation_type op)
|
||||
{
|
||||
typedef typename get_function_tag<functor_type>::type tag_type;
|
||||
switch (op) {
|
||||
case get_functor_type_tag:
|
||||
if (op == get_functor_type_tag) {
|
||||
out_buffer.members.type.type = &boost::typeindex::type_id<functor_type>().type_info();
|
||||
out_buffer.members.type.const_qualified = false;
|
||||
out_buffer.members.type.volatile_qualified = false;
|
||||
return;
|
||||
|
||||
default:
|
||||
} else {
|
||||
manager(in_buffer, out_buffer, op, tag_type());
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -9,6 +9,7 @@
|
||||
#ifndef BOOST_FUNCTION_FWD_HPP
|
||||
#define BOOST_FUNCTION_FWD_HPP
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/function/detail/config.hpp>
|
||||
|
||||
#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_STRICT_CONFIG)
|
||||
// Work around a compiler bug.
|
||||
@ -24,9 +25,22 @@ namespace boost { namespace python { namespace objects {
|
||||
# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
|
||||
#endif
|
||||
|
||||
#if !BOOST_FUNCTION_ENABLE_CXX03
|
||||
# include <functional>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
#if BOOST_FUNCTION_ENABLE_CXX03
|
||||
|
||||
class bad_function_call;
|
||||
|
||||
#else
|
||||
|
||||
using std::bad_function_call;
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX)
|
||||
// Preferred syntax
|
||||
template<typename Signature> class function;
|
||||
|
@ -13,6 +13,6 @@
|
||||
"Programming"
|
||||
],
|
||||
"maintainers": [
|
||||
"Douglas Gregor <dgregor -at- cs.indiana.edu>"
|
||||
"Peter Dimov <pdimov -at- pdimov.com>"
|
||||
]
|
||||
}
|
||||
|
@ -47,8 +47,8 @@ lib mixed_cxxstd : mixed_cxxstd.cpp : <link>shared:<define>MIXED_CXXSTD_DYN_LINK
|
||||
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 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 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 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 ;
|
||||
@ -57,3 +57,19 @@ local check14 = [ check-target-builds mixed_cxxstd/<cxxstd>14 : : <build>no ] ;
|
||||
|
||||
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 ;
|
||||
|
||||
lib return_function : return_function.cpp : <link>shared:<define>RETURN_FUNCTION_DYN_LINK=1 ;
|
||||
|
||||
run test_return_function.cpp return_function : : : <link>shared : return_function_shared ;
|
||||
run test_return_function.cpp return_function : : : <link>static : return_function_static ;
|
||||
|
||||
#run test_return_function.cpp return_function/<cxxstd>98 : : : <link>shared : return_function_shared_98 ;
|
||||
#run test_return_function.cpp return_function/<cxxstd>98 : : : <link>static : return_function_static_98 ;
|
||||
|
||||
run test_return_function.cpp return_function/<cxxstd>0x : : : <link>shared : return_function_shared_0x ;
|
||||
run test_return_function.cpp return_function/<cxxstd>0x : : : <link>static : return_function_static_0x ;
|
||||
|
||||
run test_return_function.cpp return_function/<cxxstd>14 : : : <link>shared $(check14) : return_function_shared_14 ;
|
||||
run test_return_function.cpp return_function/<cxxstd>14 : : : <link>static $(check14) : return_function_static_14 ;
|
||||
|
||||
run quick.cpp ;
|
||||
|
@ -79,8 +79,10 @@ int main()
|
||||
function2<int, int, int> f;
|
||||
f.assign( plus_int<disable_small_object_optimization>(), counting_allocator<int>() );
|
||||
f.clear();
|
||||
#if BOOST_FUNCTION_ENABLE_CXX03
|
||||
BOOST_TEST_EQ( alloc_count, 1 );
|
||||
BOOST_TEST_EQ( dealloc_count, 1 );
|
||||
#endif
|
||||
alloc_count = 0;
|
||||
dealloc_count = 0;
|
||||
f.assign( plus_int<enable_small_object_optimization>(), counting_allocator<int>() );
|
||||
@ -106,8 +108,10 @@ int main()
|
||||
dealloc_count = 0;
|
||||
fv.assign( DoNothing<disable_small_object_optimization>(), counting_allocator<int>() );
|
||||
fv.clear();
|
||||
#if BOOST_FUNCTION_ENABLE_CXX03
|
||||
BOOST_TEST_EQ( alloc_count, 1 );
|
||||
BOOST_TEST_EQ( dealloc_count, 1 );
|
||||
#endif
|
||||
alloc_count = 0;
|
||||
dealloc_count = 0;
|
||||
fv.assign( DoNothing<enable_small_object_optimization>(), counting_allocator<int>() );
|
||||
|
49
test/cmake_subdir_test/CMakeLists.txt
Normal file
49
test/cmake_subdir_test/CMakeLists.txt
Normal file
@ -0,0 +1,49 @@
|
||||
# Copyright 2018, 2019 Peter Dimov
|
||||
# Distributed under 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
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(cmake_subdir_test LANGUAGES CXX)
|
||||
|
||||
add_subdirectory(../.. boostorg/function)
|
||||
|
||||
# boost_add_subdir
|
||||
|
||||
function(boost_add_subdir name)
|
||||
|
||||
add_subdirectory(../../../${name} boostorg/${name})
|
||||
|
||||
endfunction()
|
||||
|
||||
# primary dependencies
|
||||
|
||||
boost_add_subdir(assert)
|
||||
boost_add_subdir(bind)
|
||||
boost_add_subdir(config)
|
||||
boost_add_subdir(core)
|
||||
boost_add_subdir(integer)
|
||||
boost_add_subdir(preprocessor)
|
||||
boost_add_subdir(throw_exception)
|
||||
boost_add_subdir(type_index)
|
||||
boost_add_subdir(type_traits)
|
||||
boost_add_subdir(typeof)
|
||||
|
||||
# secondary dependencies
|
||||
|
||||
boost_add_subdir(static_assert)
|
||||
boost_add_subdir(container_hash)
|
||||
boost_add_subdir(smart_ptr)
|
||||
boost_add_subdir(detail)
|
||||
boost_add_subdir(move)
|
||||
boost_add_subdir(predef)
|
||||
|
||||
# --target check
|
||||
|
||||
add_executable(quick ../quick.cpp)
|
||||
target_link_libraries(quick Boost::function Boost::core)
|
||||
|
||||
enable_testing()
|
||||
add_test(quick quick)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
@ -5,10 +5,12 @@
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/test/minimal.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
|
||||
static int forty_two() { return 42; }
|
||||
|
||||
struct Seventeen
|
||||
@ -94,7 +96,7 @@ static void target_test()
|
||||
BOOST_CHECK(!f.target<int (*)()>());
|
||||
BOOST_CHECK(f.target<const Seventeen>());
|
||||
BOOST_CHECK(f.target<const Seventeen>() == &const_seventeen);
|
||||
BOOST_CHECK(f.target<const volatile Seventeen>());
|
||||
// BOOST_CHECK(f.target<const volatile Seventeen>());
|
||||
BOOST_CHECK(!f.target<Seventeen>());
|
||||
BOOST_CHECK(!f.target<volatile Seventeen>());
|
||||
}
|
||||
@ -225,11 +227,11 @@ static void ref_equal_test()
|
||||
#endif
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
target_test();
|
||||
equal_test();
|
||||
ref_equal_test();
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -7,12 +7,14 @@
|
||||
|
||||
// For more information, see http://www.boost.org
|
||||
|
||||
#include <boost/test/minimal.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
|
||||
using namespace boost;
|
||||
using std::string;
|
||||
using std::negate;
|
||||
@ -684,7 +686,7 @@ void test_construct_destroy_count()
|
||||
BOOST_CHECK(construction_count == destruction_count);
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
int main()
|
||||
{
|
||||
test_zero_args();
|
||||
test_one_arg();
|
||||
@ -693,5 +695,5 @@ int test_main(int, char* [])
|
||||
test_member_functions();
|
||||
test_ref();
|
||||
test_construct_destroy_count();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -7,12 +7,15 @@
|
||||
|
||||
// For more information, see http://www.boost.org
|
||||
|
||||
#include <boost/test/minimal.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
|
||||
using boost::function;
|
||||
using std::string;
|
||||
|
||||
@ -651,14 +654,14 @@ static void test_empty_ref()
|
||||
f2();
|
||||
BOOST_ERROR("Exception didn't throw for reference to empty function.");
|
||||
}
|
||||
catch(std::runtime_error const&) {}
|
||||
catch(boost::bad_function_call const&) {}
|
||||
|
||||
f1 = dummy;
|
||||
|
||||
try {
|
||||
f2();
|
||||
}
|
||||
catch(std::runtime_error const&) {
|
||||
catch(boost::bad_function_call const&) {
|
||||
BOOST_ERROR("Error calling referenced function.");
|
||||
}
|
||||
}
|
||||
@ -792,7 +795,7 @@ static void test_move_semantics()
|
||||
#endif
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
int main()
|
||||
{
|
||||
test_zero_args();
|
||||
test_one_arg();
|
||||
@ -807,5 +810,5 @@ int test_main(int, char* [])
|
||||
test_move_semantics<function<void()> >();
|
||||
test_move_semantics<boost::function0<void> >();
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -7,22 +7,12 @@
|
||||
|
||||
// For more information, see http://www.boost.org
|
||||
|
||||
#include <boost/test/minimal.hpp>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
|
||||
int
|
||||
test_main(int, char*[])
|
||||
void test()
|
||||
{
|
||||
function0<int> f1;
|
||||
function0<int> f2;
|
||||
boost::function0<int> f1;
|
||||
boost::function0<int> f2;
|
||||
|
||||
if (f1 == f2) {
|
||||
}
|
||||
|
||||
BOOST_ERROR("This should not have compiled.");
|
||||
|
||||
return 0;
|
||||
if( f1 == f2 ) {}
|
||||
}
|
||||
|
@ -7,21 +7,12 @@
|
||||
|
||||
// For more information, see http://www.boost.org
|
||||
|
||||
#include <boost/test/minimal.hpp>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
|
||||
static int bad_fn(float f) { return static_cast<int>(f); }
|
||||
|
||||
int
|
||||
test_main(int, char*[])
|
||||
void test()
|
||||
{
|
||||
function0<int> f1;
|
||||
boost::function0<int> f1;
|
||||
f1 = bad_fn;
|
||||
|
||||
BOOST_ERROR("This should not have compiled.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,8 +7,10 @@
|
||||
|
||||
// For more information, see http://www.boost.org
|
||||
|
||||
#include <boost/test/minimal.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
|
||||
struct tried_to_copy { };
|
||||
|
||||
@ -40,7 +42,7 @@ struct MaybeThrowOnCopy {
|
||||
|
||||
bool MaybeThrowOnCopy::throwOnCopy = false;
|
||||
|
||||
int test_main(int, char* [])
|
||||
int main()
|
||||
{
|
||||
boost::function0<int> f;
|
||||
boost::function0<int> g;
|
||||
@ -56,5 +58,5 @@ int test_main(int, char* [])
|
||||
BOOST_CHECK(f() == 2);
|
||||
BOOST_CHECK(g() == 1);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
21
test/quick.cpp
Normal file
21
test/quick.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2019 Peter Dimov
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
static int f( int x )
|
||||
{
|
||||
return x + 1;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::function<int(int)> fn( f );
|
||||
|
||||
BOOST_TEST_EQ( fn( 5 ), 6 );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
27
test/return_function.cpp
Normal file
27
test/return_function.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
// Copyright 2018 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(RETURN_FUNCTION_DYN_LINK)
|
||||
# define EXPORT BOOST_SYMBOL_EXPORT
|
||||
#else
|
||||
# define EXPORT
|
||||
#endif
|
||||
|
||||
int f( int x, int y )
|
||||
{
|
||||
return x + y;
|
||||
}
|
||||
|
||||
EXPORT boost::function<int(int, int)> get_fn_1()
|
||||
{
|
||||
return f;
|
||||
}
|
||||
|
||||
EXPORT boost::function2<int, int, int> get_fn_2()
|
||||
{
|
||||
return f;
|
||||
}
|
@ -6,12 +6,13 @@
|
||||
|
||||
// For more information, see http://www.boost.org
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <boost/test/minimal.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/move/move.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
|
||||
class only_movable {
|
||||
private:
|
||||
@ -63,7 +64,7 @@ int three(std::string&&) { return 1; }
|
||||
std::string&& four(std::string&& s) { return boost::move(s); }
|
||||
#endif
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
using boost::function;
|
||||
|
||||
@ -102,5 +103,5 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK(f4(std::string("world")) == "world");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
21
test/test_return_function.cpp
Normal file
21
test/test_return_function.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
// Copyright 2018 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
//
|
||||
|
||||
boost::function<int(int, int)> get_fn_1();
|
||||
boost::function2<int, int, int> get_fn_2();
|
||||
|
||||
//
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST_EQ( get_fn_1()( 1, 2 ), 3 );
|
||||
BOOST_TEST_EQ( get_fn_2()( 1, 2 ), 3 );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user