mirror of
https://github.com/boostorg/circular_buffer.git
synced 2026-02-08 10:42:23 +00:00
Compare commits
40 Commits
boost-1.72
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d8bebb761 | ||
|
|
f431f5ad94 | ||
|
|
895039f821 | ||
|
|
fcabdd5f9e | ||
|
|
7bdc2a1d70 | ||
|
|
d58d2dcde8 | ||
|
|
0cbdd5b7fe | ||
|
|
b18cb837b4 | ||
|
|
ad5dd6960a | ||
|
|
79833d3fea | ||
|
|
737acf58a2 | ||
|
|
243f4a4b54 | ||
|
|
0320ba365c | ||
|
|
c7f6164f32 | ||
|
|
36ac5b3a29 | ||
|
|
c456d21adb | ||
|
|
bbbdf89031 | ||
|
|
02ec070792 | ||
|
|
0d8027e607 | ||
|
|
d2f6eff9bd | ||
|
|
7f7d13fffb | ||
|
|
c0ed5c34b6 | ||
|
|
2959b67a60 | ||
|
|
a08a5b55ee | ||
|
|
05a83223e4 | ||
|
|
6c5ebd98a0 | ||
|
|
d99ba9ae43 | ||
|
|
d4fbf446b9 | ||
|
|
9579999506 | ||
|
|
adf0d87681 | ||
|
|
2b15dc6044 | ||
|
|
59640fa9dc | ||
|
|
50d29f7e70 | ||
|
|
eed21df804 | ||
|
|
01788c32e0 | ||
|
|
e77766b4a6 | ||
|
|
dae0d6638e | ||
|
|
466b40ab55 | ||
|
|
57a6351e25 | ||
|
|
8e23f4229f |
668
.github/workflows/ci.yml
vendored
Normal file
668
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,668 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
- feature/**
|
||||||
|
|
||||||
|
env:
|
||||||
|
UBSAN_OPTIONS: print_stacktrace=1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
posix:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- toolset: gcc-4.8
|
||||||
|
cxxstd: "03,11"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-4.8-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-4.9
|
||||||
|
cxxstd: "03,11"
|
||||||
|
container: ubuntu:16.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-4.9-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-5
|
||||||
|
cxxstd: "03,11,14,1z"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-5-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-6
|
||||||
|
cxxstd: "03,11,14,1z"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-6-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-7
|
||||||
|
cxxstd: "03,11,14,17"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-7-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-8
|
||||||
|
cxxstd: "03,11,14,17,2a"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-8-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-9
|
||||||
|
cxxstd: "03,11,14,17,2a"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-9-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-10
|
||||||
|
cxxstd: "03,11,14,17,2a"
|
||||||
|
container: ubuntu:22.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-10-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-11
|
||||||
|
cxxstd: "03,11,14,17,20"
|
||||||
|
container: ubuntu:22.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-11-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-12
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
container: ubuntu:22.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-12-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-13
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
container: ubuntu:24.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-13-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-14
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
container: ubuntu:24.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-14-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-15
|
||||||
|
cxxstd: "03,11,14,17,20,23,2c"
|
||||||
|
container: ubuntu:25.10
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-15-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-3.9
|
||||||
|
cxxstd: "03,11,14"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-3.9
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-4.0
|
||||||
|
cxxstd: "03,11,14"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-4.0
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-5.0
|
||||||
|
cxxstd: "03,11,14,1z"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-5.0
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-6.0
|
||||||
|
cxxstd: "03,11,14,17"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-6.0
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-7
|
||||||
|
cxxstd: "03,11,14,17"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-7
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-8
|
||||||
|
cxxstd: "03,11,14,17"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-8
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-9
|
||||||
|
cxxstd: "03,11,14,17,2a"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-9
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-10
|
||||||
|
cxxstd: "03,11,14,17,2a"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-10
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-11
|
||||||
|
cxxstd: "03,11,14,17,2a"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-11
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-12
|
||||||
|
cxxstd: "03,11,14,17,20"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-12
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-13
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
container: ubuntu:22.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-13
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-14
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
container: ubuntu:22.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-14
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-15
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
container: ubuntu:22.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-15
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-16
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
container: ubuntu:24.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-16
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-17
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
container: ubuntu:24.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-17
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-18
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
container: ubuntu:24.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-18
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-19
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
container: ubuntu:24.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-19
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-20
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
container: ubuntu:24.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-20
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-21
|
||||||
|
cxxstd: "03,11,14,17,20,23,2c"
|
||||||
|
container: ubuntu:25.10
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-21
|
||||||
|
- toolset: clang
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
os: macos-14
|
||||||
|
- toolset: clang
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
os: macos-15
|
||||||
|
- toolset: clang
|
||||||
|
cxxstd: "03,11,14,17,20,23,2c"
|
||||||
|
os: macos-26
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
container:
|
||||||
|
image: ${{matrix.container}}
|
||||||
|
volumes:
|
||||||
|
- /node20217:/node20217:rw,rshared
|
||||||
|
- ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }}
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Setup container environment
|
||||||
|
if: matrix.container
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get -y install sudo python3 git g++ curl xz-utils
|
||||||
|
|
||||||
|
- name: Install nodejs20glibc2.17
|
||||||
|
if: ${{ startsWith( matrix.container, 'ubuntu:1' ) }}
|
||||||
|
run: |
|
||||||
|
curl -LO https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz
|
||||||
|
tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217
|
||||||
|
ldd /__e/node20/bin/node
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install packages
|
||||||
|
if: matrix.install
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get -y install ${{matrix.install}}
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
|
||||||
|
LIBRARY=${GITHUB_REPOSITORY#*/}
|
||||||
|
echo LIBRARY: $LIBRARY
|
||||||
|
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
|
||||||
|
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
|
||||||
|
echo GITHUB_REF: $GITHUB_REF
|
||||||
|
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
||||||
|
REF=${REF#refs/heads/}
|
||||||
|
echo REF: $REF
|
||||||
|
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
|
||||||
|
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||||
|
cd ..
|
||||||
|
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python3 tools/boostdep/depinst/depinst.py -I examples $LIBRARY
|
||||||
|
./bootstrap.sh
|
||||||
|
./b2 -d0 headers
|
||||||
|
|
||||||
|
- name: Create user-config.jam
|
||||||
|
if: matrix.compiler
|
||||||
|
run: |
|
||||||
|
echo "using ${{matrix.toolset}} : : ${{matrix.compiler}} ;" > ~/user-config.jam
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
cd ../boost-root
|
||||||
|
export ADDRMD=${{matrix.address-model}}
|
||||||
|
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} ${ADDRMD:+address-model=$ADDRMD} variant=debug,release
|
||||||
|
|
||||||
|
windows:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- toolset: msvc-14.3
|
||||||
|
cxxstd: "14,17,20,latest"
|
||||||
|
addrmd: 32,64
|
||||||
|
os: windows-2022
|
||||||
|
- toolset: clang-win
|
||||||
|
cxxstd: "14,17,20,latest"
|
||||||
|
addrmd: 32,64
|
||||||
|
os: windows-2025
|
||||||
|
- toolset: gcc
|
||||||
|
cxxstd: "03,11,14,17,2a"
|
||||||
|
addrmd: 64
|
||||||
|
os: windows-2022
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
|
||||||
|
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
|
||||||
|
echo LIBRARY: %LIBRARY%
|
||||||
|
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
|
||||||
|
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
|
||||||
|
echo GITHUB_REF: %GITHUB_REF%
|
||||||
|
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
|
||||||
|
set BOOST_BRANCH=develop
|
||||||
|
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||||
|
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||||
|
cd ..
|
||||||
|
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py -I examples --git_args "--jobs 3" %LIBRARY%
|
||||||
|
cmd /c bootstrap
|
||||||
|
b2 -d0 headers
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root
|
||||||
|
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release embed-manifest-via=linker
|
||||||
|
|
||||||
|
posix-cmake-subdir:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
- os: macos-latest
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install packages
|
||||||
|
if: matrix.install
|
||||||
|
run: sudo apt-get -y install ${{matrix.install}}
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
|
||||||
|
LIBRARY=${GITHUB_REPOSITORY#*/}
|
||||||
|
echo LIBRARY: $LIBRARY
|
||||||
|
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
|
||||||
|
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
|
||||||
|
echo GITHUB_REF: $GITHUB_REF
|
||||||
|
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
||||||
|
REF=${REF#refs/heads/}
|
||||||
|
echo REF: $REF
|
||||||
|
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
|
||||||
|
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||||
|
cd ..
|
||||||
|
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
|
||||||
|
|
||||||
|
- name: Use library with add_subdirectory
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake ..
|
||||||
|
cmake --build .
|
||||||
|
ctest --output-on-failure --no-tests=error
|
||||||
|
|
||||||
|
posix-cmake-install:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
- os: macos-latest
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install packages
|
||||||
|
if: matrix.install
|
||||||
|
run: sudo apt-get -y install ${{matrix.install}}
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
|
||||||
|
LIBRARY=${GITHUB_REPOSITORY#*/}
|
||||||
|
echo LIBRARY: $LIBRARY
|
||||||
|
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
|
||||||
|
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
|
||||||
|
echo GITHUB_REF: $GITHUB_REF
|
||||||
|
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
||||||
|
REF=${REF#refs/heads/}
|
||||||
|
echo REF: $REF
|
||||||
|
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
|
||||||
|
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||||
|
cd ..
|
||||||
|
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
run: |
|
||||||
|
cd ../boost-root
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target install
|
||||||
|
|
||||||
|
- name: Use the installed library
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||||
|
cmake --build .
|
||||||
|
ctest --output-on-failure --no-tests=error
|
||||||
|
|
||||||
|
posix-cmake-test:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
- os: macos-latest
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install packages
|
||||||
|
if: matrix.install
|
||||||
|
run: sudo apt-get -y install ${{matrix.install}}
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
|
||||||
|
LIBRARY=${GITHUB_REPOSITORY#*/}
|
||||||
|
echo LIBRARY: $LIBRARY
|
||||||
|
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
|
||||||
|
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
|
||||||
|
echo GITHUB_REF: $GITHUB_REF
|
||||||
|
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
||||||
|
REF=${REF#refs/heads/}
|
||||||
|
echo REF: $REF
|
||||||
|
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
|
||||||
|
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||||
|
cd ..
|
||||||
|
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
run: |
|
||||||
|
cd ../boost-root
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON ..
|
||||||
|
|
||||||
|
- name: Build tests
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target tests
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
ctest --output-on-failure --no-tests=error
|
||||||
|
|
||||||
|
windows-cmake-subdir:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows-latest
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
|
||||||
|
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
|
||||||
|
echo LIBRARY: %LIBRARY%
|
||||||
|
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
|
||||||
|
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
|
||||||
|
echo GITHUB_REF: %GITHUB_REF%
|
||||||
|
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
|
||||||
|
set BOOST_BRANCH=develop
|
||||||
|
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||||
|
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||||
|
cd ..
|
||||||
|
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||||
|
|
||||||
|
- name: Use library with add_subdirectory (Debug)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake ..
|
||||||
|
cmake --build . --config Debug
|
||||||
|
ctest --output-on-failure --no-tests=error -C Debug
|
||||||
|
|
||||||
|
- name: Use library with add_subdirectory (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test/__build__
|
||||||
|
cmake --build . --config Release
|
||||||
|
ctest --output-on-failure --no-tests=error -C Release
|
||||||
|
|
||||||
|
windows-cmake-install:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows-latest
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
|
||||||
|
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
|
||||||
|
echo LIBRARY: %LIBRARY%
|
||||||
|
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
|
||||||
|
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
|
||||||
|
echo GITHUB_REF: %GITHUB_REF%
|
||||||
|
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
|
||||||
|
set BOOST_BRANCH=develop
|
||||||
|
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||||
|
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||||
|
cd ..
|
||||||
|
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
|
||||||
|
|
||||||
|
- name: Install (Debug)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target install --config Debug
|
||||||
|
|
||||||
|
- name: Install (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target install --config Release
|
||||||
|
|
||||||
|
- name: Use the installed library (Debug)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
|
||||||
|
cmake --build . --config Debug
|
||||||
|
ctest --output-on-failure --no-tests=error -C Debug
|
||||||
|
|
||||||
|
- name: Use the installed library (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test/__build__
|
||||||
|
cmake --build . --config Release
|
||||||
|
ctest --output-on-failure --no-tests=error -C Release
|
||||||
|
|
||||||
|
windows-cmake-test:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows-latest
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
|
||||||
|
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
|
||||||
|
echo LIBRARY: %LIBRARY%
|
||||||
|
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
|
||||||
|
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
|
||||||
|
echo GITHUB_REF: %GITHUB_REF%
|
||||||
|
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
|
||||||
|
set BOOST_BRANCH=develop
|
||||||
|
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||||
|
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||||
|
cd ..
|
||||||
|
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DBUILD_TESTING=ON ..
|
||||||
|
|
||||||
|
- name: Build tests (Debug)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target tests --config Debug
|
||||||
|
|
||||||
|
- name: Run tests (Debug)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
ctest --output-on-failure --no-tests=error -C Debug
|
||||||
|
|
||||||
|
- name: Build tests (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target tests --config Release
|
||||||
|
|
||||||
|
- name: Run tests (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
ctest --output-on-failure --no-tests=error -C Release
|
||||||
@@ -1,25 +1,30 @@
|
|||||||
# Copyright 2018 Glen Joseph Fernandes
|
# Generated by `boostdep --cmake circular_buffer`
|
||||||
# (glenjofe@gmail.com)
|
# Copyright 2020, 2021 Peter Dimov
|
||||||
#
|
|
||||||
# Distributed under the Boost Software License, Version 1.0.
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
# (http://www.boost.org/LICENSE_1_0.txt)
|
# https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.8...3.31)
|
||||||
|
|
||||||
project(BoostCircularBuffer LANGUAGES CXX)
|
project(boost_circular_buffer VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
||||||
|
|
||||||
add_library(boost_circular_buffer INTERFACE)
|
add_library(boost_circular_buffer INTERFACE)
|
||||||
|
|
||||||
add_library(Boost::circular_buffer ALIAS boost_circular_buffer)
|
add_library(Boost::circular_buffer ALIAS boost_circular_buffer)
|
||||||
|
|
||||||
target_include_directories(boost_circular_buffer INTERFACE include)
|
target_include_directories(boost_circular_buffer INTERFACE include)
|
||||||
|
|
||||||
target_link_libraries(boost_circular_buffer INTERFACE
|
target_link_libraries(boost_circular_buffer
|
||||||
|
INTERFACE
|
||||||
Boost::assert
|
Boost::assert
|
||||||
Boost::concept_check
|
Boost::concept_check
|
||||||
Boost::config
|
Boost::config
|
||||||
Boost::core
|
Boost::core
|
||||||
Boost::move
|
Boost::move
|
||||||
Boost::static_assert
|
|
||||||
Boost::throw_exception
|
Boost::throw_exception
|
||||||
Boost::type_traits)
|
Boost::type_traits
|
||||||
|
)
|
||||||
|
|
||||||
|
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
|
||||||
|
|
||||||
|
add_subdirectory(test)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|||||||
30
build.jam
Normal file
30
build.jam
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Copyright René Ferdinand Rivera Morell 2023-2024
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
require-b2 5.2 ;
|
||||||
|
|
||||||
|
constant boost_dependencies :
|
||||||
|
/boost/assert//boost_assert
|
||||||
|
/boost/concept_check//boost_concept_check
|
||||||
|
/boost/config//boost_config
|
||||||
|
/boost/core//boost_core
|
||||||
|
/boost/move//boost_move
|
||||||
|
/boost/throw_exception//boost_throw_exception
|
||||||
|
/boost/type_traits//boost_type_traits ;
|
||||||
|
|
||||||
|
project /boost/circular_buffer
|
||||||
|
: common-requirements
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
explicit
|
||||||
|
[ alias boost_circular_buffer : : :
|
||||||
|
: <include>include <library>$(boost_dependencies) ]
|
||||||
|
[ alias all : boost_circular_buffer example test ]
|
||||||
|
;
|
||||||
|
|
||||||
|
call-if : boost-library circular_buffer
|
||||||
|
;
|
||||||
|
|
||||||
@@ -26,9 +26,9 @@ using quickbook ;
|
|||||||
doxygen autodoc
|
doxygen autodoc
|
||||||
:
|
:
|
||||||
# List all the files individually (RECURSIVE=NO ).
|
# List all the files individually (RECURSIVE=NO ).
|
||||||
[ glob ../../../boost/circular_buffer.hpp ]
|
[ glob ../include/boost/circular_buffer.hpp ]
|
||||||
[ glob ../../../boost/circular_buffer/base.hpp ]
|
[ glob ../include/boost/circular_buffer/base.hpp ]
|
||||||
[ glob ../../../boost/circular_buffer/space_optimized.hpp ]
|
[ glob ../include/boost/circular_buffer/space_optimized.hpp ]
|
||||||
|
|
||||||
:
|
:
|
||||||
# Pass some setting parameters to Doxygen.
|
# Pass some setting parameters to Doxygen.
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ void fifo_test(Buffer* buffer) {
|
|||||||
|
|
||||||
// Initialize the buffer with some values before launching producer and consumer threads.
|
// Initialize the buffer with some values before launching producer and consumer threads.
|
||||||
for (unsigned long i = QUEUE_SIZE / 2L; i > 0; --i) {
|
for (unsigned long i = QUEUE_SIZE / 2L; i > 0; --i) {
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
||||||
buffer->push_front(Buffer::value_type());
|
buffer->push_front(Buffer::value_type());
|
||||||
#else
|
#else
|
||||||
buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
|
buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ void fifo_test(Buffer* buffer)
|
|||||||
// Initialize the buffer with some values before launching producer and consumer threads.
|
// Initialize the buffer with some values before launching producer and consumer threads.
|
||||||
for (unsigned long i = queue_size / 2L; i > 0; --i)
|
for (unsigned long i = queue_size / 2L; i > 0; --i)
|
||||||
{
|
{
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
||||||
buffer->push_front(Buffer::value_type());
|
buffer->push_front(Buffer::value_type());
|
||||||
#else
|
#else
|
||||||
buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
|
buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ Includes <boost/circular_buffer/base.hpp>
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
/*! INTERNAL ONLY */
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x0550) || BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x0550) || BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||||
#define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) ((void)0)
|
#define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) ((void)0)
|
||||||
#else
|
#else
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
// Copyright 2018 Glen Joseph Fernandes
|
|
||||||
// (glenjofe@gmail.com)
|
|
||||||
//
|
|
||||||
// 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)
|
|
||||||
|
|
||||||
#ifndef BOOST_CIRCULAR_BUFFER_ALLOCATORS_HPP
|
|
||||||
#define BOOST_CIRCULAR_BUFFER_ALLOCATORS_HPP
|
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
|
||||||
#if defined(BOOST_NO_CXX11_ALLOCATOR)
|
|
||||||
#define BOOST_CB_NO_CXX11_ALLOCATOR
|
|
||||||
#elif defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 40800)
|
|
||||||
#define BOOST_CB_NO_CXX11_ALLOCATOR
|
|
||||||
#endif
|
|
||||||
#if !defined(BOOST_CB_NO_CXX11_ALLOCATOR)
|
|
||||||
#include <memory>
|
|
||||||
#else
|
|
||||||
#include <new>
|
|
||||||
#endif
|
|
||||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
|
||||||
#include <utility>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace cb_details {
|
|
||||||
|
|
||||||
#if !defined(BOOST_CB_NO_CXX11_ALLOCATOR)
|
|
||||||
using std::allocator_traits;
|
|
||||||
#else
|
|
||||||
template<class A>
|
|
||||||
struct allocator_traits {
|
|
||||||
typedef typename A::value_type value_type;
|
|
||||||
typedef typename A::pointer pointer;
|
|
||||||
typedef typename A::const_pointer const_pointer;
|
|
||||||
typedef typename A::difference_type difference_type;
|
|
||||||
typedef typename A::size_type size_type;
|
|
||||||
|
|
||||||
static size_type max_size(const A& a) BOOST_NOEXCEPT {
|
|
||||||
return a.max_size();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
|
||||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
|
||||||
template<class U, class... Args>
|
|
||||||
static void construct(const A&, U* ptr, Args&&... args) {
|
|
||||||
::new((void*)ptr) U(std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
template<class U, class V>
|
|
||||||
static void construct(const A&, U* ptr, V&& value) {
|
|
||||||
::new((void*)ptr) U(std::forward<V>(value));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
template<class U, class V>
|
|
||||||
static void construct(const A&, U* ptr, const V& value) {
|
|
||||||
::new((void*)ptr) U(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class U, class V>
|
|
||||||
static void construct(const A&, U* ptr, V& value) {
|
|
||||||
::new((void*)ptr) U(value);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class U>
|
|
||||||
static void destroy(const A&, U* ptr) {
|
|
||||||
(void)ptr;
|
|
||||||
ptr->~U();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // cb_details
|
|
||||||
} // boost
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/concept_check.hpp>
|
#include <boost/concept_check.hpp>
|
||||||
#include <boost/limits.hpp>
|
#include <boost/limits.hpp>
|
||||||
#include <boost/circular_buffer/allocators.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/empty_value.hpp>
|
#include <boost/core/empty_value.hpp>
|
||||||
#include <boost/type_traits/is_stateless.hpp>
|
#include <boost/type_traits/is_stateless.hpp>
|
||||||
#include <boost/type_traits/is_integral.hpp>
|
#include <boost/type_traits/is_integral.hpp>
|
||||||
@@ -99,13 +99,13 @@ public:
|
|||||||
typedef circular_buffer<T, Alloc> this_type;
|
typedef circular_buffer<T, Alloc> this_type;
|
||||||
|
|
||||||
//! The type of elements stored in the <code>circular_buffer</code>.
|
//! The type of elements stored in the <code>circular_buffer</code>.
|
||||||
typedef typename cb_details::allocator_traits<Alloc>::value_type value_type;
|
typedef typename Alloc::value_type value_type;
|
||||||
|
|
||||||
//! A pointer to an element.
|
//! A pointer to an element.
|
||||||
typedef typename cb_details::allocator_traits<Alloc>::pointer pointer;
|
typedef typename allocator_pointer<Alloc>::type pointer;
|
||||||
|
|
||||||
//! A const pointer to the element.
|
//! A const pointer to the element.
|
||||||
typedef typename cb_details::allocator_traits<Alloc>::const_pointer const_pointer;
|
typedef typename allocator_const_pointer<Alloc>::type const_pointer;
|
||||||
|
|
||||||
//! A reference to an element.
|
//! A reference to an element.
|
||||||
typedef value_type& reference;
|
typedef value_type& reference;
|
||||||
@@ -117,13 +117,13 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
(A signed integral type used to represent the distance between two iterators.)
|
(A signed integral type used to represent the distance between two iterators.)
|
||||||
*/
|
*/
|
||||||
typedef typename cb_details::allocator_traits<Alloc>::difference_type difference_type;
|
typedef typename allocator_difference_type<Alloc>::type difference_type;
|
||||||
|
|
||||||
//! The size type.
|
//! The size type.
|
||||||
/*!
|
/*!
|
||||||
(An unsigned integral type that can represent any non-negative value of the container's distance type.)
|
(An unsigned integral type that can represent any non-negative value of the container's distance type.)
|
||||||
*/
|
*/
|
||||||
typedef typename cb_details::allocator_traits<Alloc>::size_type size_type;
|
typedef typename allocator_size_type<Alloc>::type size_type;
|
||||||
|
|
||||||
//! The type of an allocator used in the <code>circular_buffer</code>.
|
//! The type of an allocator used in the <code>circular_buffer</code>.
|
||||||
typedef Alloc allocator_type;
|
typedef Alloc allocator_type;
|
||||||
@@ -131,10 +131,10 @@ public:
|
|||||||
// Iterators
|
// Iterators
|
||||||
|
|
||||||
//! A const (random access) iterator used to iterate through the <code>circular_buffer</code>.
|
//! A const (random access) iterator used to iterate through the <code>circular_buffer</code>.
|
||||||
typedef cb_details::iterator< circular_buffer<T, Alloc>, cb_details::const_traits<cb_details::allocator_traits<Alloc> > > const_iterator;
|
typedef cb_details::iterator< circular_buffer<T, Alloc>, cb_details::const_traits<Alloc> > const_iterator;
|
||||||
|
|
||||||
//! A (random access) iterator used to iterate through the <code>circular_buffer</code>.
|
//! A (random access) iterator used to iterate through the <code>circular_buffer</code>.
|
||||||
typedef cb_details::iterator< circular_buffer<T, Alloc>, cb_details::nonconst_traits<cb_details::allocator_traits<Alloc> > > iterator;
|
typedef cb_details::iterator< circular_buffer<T, Alloc>, cb_details::nonconst_traits<Alloc> > iterator;
|
||||||
|
|
||||||
//! A const iterator used to iterate backwards through a <code>circular_buffer</code>.
|
//! A const iterator used to iterate backwards through a <code>circular_buffer</code>.
|
||||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||||
@@ -287,6 +287,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
const_iterator begin() const BOOST_NOEXCEPT { return const_iterator(this, empty() ? 0 : m_first); }
|
const_iterator begin() const BOOST_NOEXCEPT { return const_iterator(this, empty() ? 0 : m_first); }
|
||||||
|
|
||||||
|
const_iterator cbegin() const BOOST_NOEXCEPT { return begin(); }
|
||||||
//! Get the const iterator pointing to the end of the <code>circular_buffer</code>.
|
//! Get the const iterator pointing to the end of the <code>circular_buffer</code>.
|
||||||
/*!
|
/*!
|
||||||
\return A const random access iterator pointing to the element "one behind" the last element of the <code>
|
\return A const random access iterator pointing to the element "one behind" the last element of the <code>
|
||||||
@@ -303,6 +304,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
const_iterator end() const BOOST_NOEXCEPT { return const_iterator(this, 0); }
|
const_iterator end() const BOOST_NOEXCEPT { return const_iterator(this, 0); }
|
||||||
|
|
||||||
|
const_iterator cend() const BOOST_NOEXCEPT { return end(); }
|
||||||
//! Get the iterator pointing to the beginning of the "reversed" <code>circular_buffer</code>.
|
//! Get the iterator pointing to the beginning of the "reversed" <code>circular_buffer</code>.
|
||||||
/*!
|
/*!
|
||||||
\return A reverse random access iterator pointing to the last element of the <code>circular_buffer</code>.
|
\return A reverse random access iterator pointing to the last element of the <code>circular_buffer</code>.
|
||||||
@@ -666,7 +668,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (is_uninitialized(dest)) {
|
if (is_uninitialized(dest)) {
|
||||||
cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(dest), boost::move_if_noexcept(*src));
|
boost::allocator_construct(alloc(), boost::to_address(dest), boost::move_if_noexcept(*src));
|
||||||
++constructed;
|
++constructed;
|
||||||
} else {
|
} else {
|
||||||
value_type tmp = boost::move_if_noexcept(*src);
|
value_type tmp = boost::move_if_noexcept(*src);
|
||||||
@@ -787,7 +789,7 @@ public:
|
|||||||
\sa <code>size()</code>, <code>capacity()</code>, <code>reserve()</code>
|
\sa <code>size()</code>, <code>capacity()</code>, <code>reserve()</code>
|
||||||
*/
|
*/
|
||||||
size_type max_size() const BOOST_NOEXCEPT {
|
size_type max_size() const BOOST_NOEXCEPT {
|
||||||
return (std::min<size_type>)(cb_details::allocator_traits<Alloc>::max_size(alloc()), (std::numeric_limits<difference_type>::max)());
|
return (std::min<size_type>)(boost::allocator_max_size(alloc()), (std::numeric_limits<difference_type>::max)());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Is the <code>circular_buffer</code> empty?
|
//! Is the <code>circular_buffer</code> empty?
|
||||||
@@ -1424,7 +1426,7 @@ private:
|
|||||||
increment(m_last);
|
increment(m_last);
|
||||||
m_first = m_last;
|
m_first = m_last;
|
||||||
} else {
|
} else {
|
||||||
cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(m_last), static_cast<ValT>(item));
|
boost::allocator_construct(alloc(), boost::to_address(m_last), static_cast<ValT>(item));
|
||||||
increment(m_last);
|
increment(m_last);
|
||||||
++m_size;
|
++m_size;
|
||||||
}
|
}
|
||||||
@@ -1442,7 +1444,7 @@ private:
|
|||||||
m_last = m_first;
|
m_last = m_first;
|
||||||
} else {
|
} else {
|
||||||
decrement(m_first);
|
decrement(m_first);
|
||||||
cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(m_first), static_cast<ValT>(item));
|
boost::allocator_construct(alloc(), boost::to_address(m_first), static_cast<ValT>(item));
|
||||||
++m_size;
|
++m_size;
|
||||||
}
|
}
|
||||||
} BOOST_CATCH(...) {
|
} BOOST_CATCH(...) {
|
||||||
@@ -2427,7 +2429,7 @@ private:
|
|||||||
/*! INTERNAL ONLY */
|
/*! INTERNAL ONLY */
|
||||||
void construct_or_replace(bool construct, pointer pos, param_value_type item) {
|
void construct_or_replace(bool construct, pointer pos, param_value_type item) {
|
||||||
if (construct)
|
if (construct)
|
||||||
cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(pos), item);
|
boost::allocator_construct(alloc(), boost::to_address(pos), item);
|
||||||
else
|
else
|
||||||
replace(pos, item);
|
replace(pos, item);
|
||||||
}
|
}
|
||||||
@@ -2435,14 +2437,14 @@ private:
|
|||||||
/*! INTERNAL ONLY */
|
/*! INTERNAL ONLY */
|
||||||
void construct_or_replace(bool construct, pointer pos, rvalue_type item) {
|
void construct_or_replace(bool construct, pointer pos, rvalue_type item) {
|
||||||
if (construct)
|
if (construct)
|
||||||
cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(pos), boost::move(item));
|
boost::allocator_construct(alloc(), boost::to_address(pos), boost::move(item));
|
||||||
else
|
else
|
||||||
replace(pos, boost::move(item));
|
replace(pos, boost::move(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
/*! INTERNAL ONLY */
|
||||||
void destroy_item(pointer p) {
|
void destroy_item(pointer p) {
|
||||||
cb_details::allocator_traits<Alloc>::destroy(alloc(), boost::to_address(p));
|
boost::allocator_destroy(alloc(), boost::to_address(p));
|
||||||
#if BOOST_CB_ENABLE_DEBUG
|
#if BOOST_CB_ENABLE_DEBUG
|
||||||
invalidate_iterators(iterator(this, p));
|
invalidate_iterators(iterator(this, p));
|
||||||
cb_details::do_fill_uninitialized_memory(p, sizeof(value_type));
|
cb_details::do_fill_uninitialized_memory(p, sizeof(value_type));
|
||||||
@@ -2517,7 +2519,7 @@ private:
|
|||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
void initialize(Iterator first, Iterator last, const false_type&) {
|
void initialize(Iterator first, Iterator last, const false_type&) {
|
||||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
||||||
initialize(first, last, std::iterator_traits<Iterator>::iterator_category());
|
initialize(first, last, std::iterator_traits<Iterator>::iterator_category());
|
||||||
#else
|
#else
|
||||||
initialize(first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
initialize(first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
||||||
@@ -2556,7 +2558,7 @@ private:
|
|||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
void initialize(capacity_type buffer_capacity, Iterator first, Iterator last, const false_type&) {
|
void initialize(capacity_type buffer_capacity, Iterator first, Iterator last, const false_type&) {
|
||||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
||||||
initialize(buffer_capacity, first, last, std::iterator_traits<Iterator>::iterator_category());
|
initialize(buffer_capacity, first, last, std::iterator_traits<Iterator>::iterator_category());
|
||||||
#else
|
#else
|
||||||
initialize(buffer_capacity, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
initialize(buffer_capacity, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
||||||
@@ -2575,7 +2577,7 @@ private:
|
|||||||
if (buffer_capacity == 0)
|
if (buffer_capacity == 0)
|
||||||
return;
|
return;
|
||||||
while (first != last && !full()) {
|
while (first != last && !full()) {
|
||||||
cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(m_last), *first++);
|
boost::allocator_construct(alloc(), boost::to_address(m_last), *first++);
|
||||||
increment(m_last);
|
increment(m_last);
|
||||||
++m_size;
|
++m_size;
|
||||||
}
|
}
|
||||||
@@ -2650,7 +2652,7 @@ private:
|
|||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
void assign(Iterator first, Iterator last, const false_type&) {
|
void assign(Iterator first, Iterator last, const false_type&) {
|
||||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
||||||
assign(first, last, std::iterator_traits<Iterator>::iterator_category());
|
assign(first, last, std::iterator_traits<Iterator>::iterator_category());
|
||||||
#else
|
#else
|
||||||
assign(first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
assign(first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
||||||
@@ -2687,7 +2689,7 @@ private:
|
|||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
void assign(capacity_type new_capacity, Iterator first, Iterator last, const false_type&) {
|
void assign(capacity_type new_capacity, Iterator first, Iterator last, const false_type&) {
|
||||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
||||||
assign(new_capacity, first, last, std::iterator_traits<Iterator>::iterator_category());
|
assign(new_capacity, first, last, std::iterator_traits<Iterator>::iterator_category());
|
||||||
#else
|
#else
|
||||||
assign(new_capacity, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
assign(new_capacity, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
||||||
@@ -2796,7 +2798,7 @@ private:
|
|||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
void insert(const iterator& pos, Iterator first, Iterator last, const false_type&) {
|
void insert(const iterator& pos, Iterator first, Iterator last, const false_type&) {
|
||||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
||||||
insert(pos, first, last, std::iterator_traits<Iterator>::iterator_category());
|
insert(pos, first, last, std::iterator_traits<Iterator>::iterator_category());
|
||||||
#else
|
#else
|
||||||
insert(pos, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
insert(pos, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
||||||
@@ -2840,7 +2842,7 @@ private:
|
|||||||
pointer p = m_last;
|
pointer p = m_last;
|
||||||
BOOST_TRY {
|
BOOST_TRY {
|
||||||
for (; ii < construct; ++ii, increment(p))
|
for (; ii < construct; ++ii, increment(p))
|
||||||
cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(p), *wrapper());
|
boost::allocator_construct(alloc(), boost::to_address(p), *wrapper());
|
||||||
for (;ii < n; ++ii, increment(p))
|
for (;ii < n; ++ii, increment(p))
|
||||||
replace(p, *wrapper());
|
replace(p, *wrapper());
|
||||||
} BOOST_CATCH(...) {
|
} BOOST_CATCH(...) {
|
||||||
@@ -2887,7 +2889,7 @@ private:
|
|||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
void rinsert(const iterator& pos, Iterator first, Iterator last, const false_type&) {
|
void rinsert(const iterator& pos, Iterator first, Iterator last, const false_type&) {
|
||||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
||||||
rinsert(pos, first, last, std::iterator_traits<Iterator>::iterator_category());
|
rinsert(pos, first, last, std::iterator_traits<Iterator>::iterator_category());
|
||||||
#else
|
#else
|
||||||
rinsert(pos, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
rinsert(pos, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
||||||
@@ -2934,7 +2936,7 @@ private:
|
|||||||
for (;ii > construct; --ii, increment(p))
|
for (;ii > construct; --ii, increment(p))
|
||||||
replace(p, *wrapper());
|
replace(p, *wrapper());
|
||||||
for (; ii > 0; --ii, increment(p))
|
for (; ii > 0; --ii, increment(p))
|
||||||
cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(p), *wrapper());
|
boost::allocator_construct(alloc(), boost::to_address(p), *wrapper());
|
||||||
} BOOST_CATCH(...) {
|
} BOOST_CATCH(...) {
|
||||||
size_type constructed = ii < construct ? construct - ii : 0;
|
size_type constructed = ii < construct ? construct - ii : 0;
|
||||||
m_last = add(m_last, constructed);
|
m_last = add(m_last, constructed);
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ const int UNINITIALIZED = 0xcc;
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void do_fill_uninitialized_memory(T* data, std::size_t size_in_bytes) BOOST_NOEXCEPT {
|
inline void do_fill_uninitialized_memory(T* data, std::size_t size_in_bytes) BOOST_NOEXCEPT {
|
||||||
|
#if defined(__GNUC__) && __GNUC__ < 5
|
||||||
|
// Avoid warning for calling memset with a constant size of zero
|
||||||
|
if( size_in_bytes )
|
||||||
|
#endif
|
||||||
std::memset(static_cast<void*>(data), UNINITIALIZED, size_in_bytes);
|
std::memset(static_cast<void*>(data), UNINITIALIZED, size_in_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/throw_exception.hpp>
|
#include <boost/throw_exception.hpp>
|
||||||
#include <boost/circular_buffer/allocators.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/pointer_traits.hpp>
|
#include <boost/core/pointer_traits.hpp>
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/move.hpp>
|
||||||
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
|
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
|
||||||
@@ -36,7 +36,7 @@ namespace boost {
|
|||||||
|
|
||||||
namespace cb_details {
|
namespace cb_details {
|
||||||
|
|
||||||
template <class Traits> struct nonconst_traits;
|
template <class Alloc> struct nonconst_traits;
|
||||||
|
|
||||||
template<class ForwardIterator, class Diff, class T, class Alloc>
|
template<class ForwardIterator, class Diff, class T, class Alloc>
|
||||||
void uninitialized_fill_n_with_alloc(
|
void uninitialized_fill_n_with_alloc(
|
||||||
@@ -52,34 +52,34 @@ ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterato
|
|||||||
\struct const_traits
|
\struct const_traits
|
||||||
\brief Defines the data types for a const iterator.
|
\brief Defines the data types for a const iterator.
|
||||||
*/
|
*/
|
||||||
template <class Traits>
|
template <class Alloc>
|
||||||
struct const_traits {
|
struct const_traits {
|
||||||
// Basic types
|
// Basic types
|
||||||
typedef typename Traits::value_type value_type;
|
typedef typename Alloc::value_type value_type;
|
||||||
typedef typename Traits::const_pointer pointer;
|
typedef typename boost::allocator_const_pointer<Alloc>::type pointer;
|
||||||
typedef const value_type& reference;
|
typedef const value_type& reference;
|
||||||
typedef typename Traits::size_type size_type;
|
typedef typename boost::allocator_size_type<Alloc>::type size_type;
|
||||||
typedef typename Traits::difference_type difference_type;
|
typedef typename boost::allocator_difference_type<Alloc>::type difference_type;
|
||||||
|
|
||||||
// Non-const traits
|
// Non-const traits
|
||||||
typedef nonconst_traits<Traits> nonconst_self;
|
typedef nonconst_traits<Alloc> nonconst_self;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\struct nonconst_traits
|
\struct nonconst_traits
|
||||||
\brief Defines the data types for a non-const iterator.
|
\brief Defines the data types for a non-const iterator.
|
||||||
*/
|
*/
|
||||||
template <class Traits>
|
template <class Alloc>
|
||||||
struct nonconst_traits {
|
struct nonconst_traits {
|
||||||
// Basic types
|
// Basic types
|
||||||
typedef typename Traits::value_type value_type;
|
typedef typename Alloc::value_type value_type;
|
||||||
typedef typename Traits::pointer pointer;
|
typedef typename boost::allocator_pointer<Alloc>::type pointer;
|
||||||
typedef value_type& reference;
|
typedef value_type& reference;
|
||||||
typedef typename Traits::size_type size_type;
|
typedef typename boost::allocator_size_type<Alloc>::type size_type;
|
||||||
typedef typename Traits::difference_type difference_type;
|
typedef typename boost::allocator_difference_type<Alloc>::type difference_type;
|
||||||
|
|
||||||
// Non-const traits
|
// Non-const traits
|
||||||
typedef nonconst_traits<Traits> nonconst_self;
|
typedef nonconst_traits<Alloc> nonconst_self;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -114,7 +114,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
template <class Value, class Alloc>
|
template <class Value, class Alloc>
|
||||||
struct assign_n {
|
struct assign_n {
|
||||||
typedef typename allocator_traits<Alloc>::size_type size_type;
|
typedef typename boost::allocator_size_type<Alloc>::type size_type;
|
||||||
size_type m_n;
|
size_type m_n;
|
||||||
Value m_item;
|
Value m_item;
|
||||||
Alloc& m_alloc;
|
Alloc& m_alloc;
|
||||||
@@ -259,7 +259,10 @@ struct iterator
|
|||||||
#endif // #if BOOST_CB_ENABLE_DEBUG
|
#endif // #if BOOST_CB_ENABLE_DEBUG
|
||||||
|
|
||||||
//! Assign operator.
|
//! Assign operator.
|
||||||
iterator& operator = (const iterator& it) {
|
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
|
||||||
|
iterator& operator=(const iterator&) = default;
|
||||||
|
#else
|
||||||
|
iterator& operator=(const iterator& it) {
|
||||||
if (this == &it)
|
if (this == &it)
|
||||||
return *this;
|
return *this;
|
||||||
#if BOOST_CB_ENABLE_DEBUG
|
#if BOOST_CB_ENABLE_DEBUG
|
||||||
@@ -269,6 +272,7 @@ struct iterator
|
|||||||
m_it = it.m_it;
|
m_it = it.m_it;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Random access iterator methods
|
// Random access iterator methods
|
||||||
|
|
||||||
@@ -424,10 +428,10 @@ inline ForwardIterator uninitialized_copy(InputIterator first, InputIterator las
|
|||||||
ForwardIterator next = dest;
|
ForwardIterator next = dest;
|
||||||
BOOST_TRY {
|
BOOST_TRY {
|
||||||
for (; first != last; ++first, ++dest)
|
for (; first != last; ++first, ++dest)
|
||||||
allocator_traits<Alloc>::construct(a, boost::to_address(dest), *first);
|
boost::allocator_construct(a, boost::to_address(dest), *first);
|
||||||
} BOOST_CATCH(...) {
|
} BOOST_CATCH(...) {
|
||||||
for (; next != dest; ++next)
|
for (; next != dest; ++next)
|
||||||
allocator_traits<Alloc>::destroy(a, boost::to_address(next));
|
boost::allocator_destroy(a, boost::to_address(next));
|
||||||
BOOST_RETHROW
|
BOOST_RETHROW
|
||||||
}
|
}
|
||||||
BOOST_CATCH_END
|
BOOST_CATCH_END
|
||||||
@@ -438,7 +442,7 @@ template<class InputIterator, class ForwardIterator, class Alloc>
|
|||||||
ForwardIterator uninitialized_move_if_noexcept_impl(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a,
|
ForwardIterator uninitialized_move_if_noexcept_impl(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a,
|
||||||
true_type) {
|
true_type) {
|
||||||
for (; first != last; ++first, ++dest)
|
for (; first != last; ++first, ++dest)
|
||||||
allocator_traits<Alloc>::construct(a, boost::to_address(dest), boost::move(*first));
|
boost::allocator_construct(a, boost::to_address(dest), boost::move(*first));
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +458,7 @@ ForwardIterator uninitialized_move_if_noexcept_impl(InputIterator first, InputIt
|
|||||||
*/
|
*/
|
||||||
template<class InputIterator, class ForwardIterator, class Alloc>
|
template<class InputIterator, class ForwardIterator, class Alloc>
|
||||||
ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a) {
|
ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a) {
|
||||||
typedef typename boost::is_nothrow_move_constructible<typename allocator_traits<Alloc>::value_type>::type tag_t;
|
typedef typename boost::is_nothrow_move_constructible<typename Alloc::value_type>::type tag_t;
|
||||||
return uninitialized_move_if_noexcept_impl(first, last, dest, a, tag_t());
|
return uninitialized_move_if_noexcept_impl(first, last, dest, a, tag_t());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,10 +471,10 @@ inline void uninitialized_fill_n_with_alloc(ForwardIterator first, Diff n, const
|
|||||||
ForwardIterator next = first;
|
ForwardIterator next = first;
|
||||||
BOOST_TRY {
|
BOOST_TRY {
|
||||||
for (; n > 0; ++first, --n)
|
for (; n > 0; ++first, --n)
|
||||||
allocator_traits<Alloc>::construct(alloc, boost::to_address(first), item);
|
boost::allocator_construct(alloc, boost::to_address(first), item);
|
||||||
} BOOST_CATCH(...) {
|
} BOOST_CATCH(...) {
|
||||||
for (; next != first; ++next)
|
for (; next != first; ++next)
|
||||||
allocator_traits<Alloc>::destroy(alloc, boost::to_address(next));
|
boost::allocator_destroy(alloc, boost::to_address(next));
|
||||||
BOOST_RETHROW
|
BOOST_RETHROW
|
||||||
}
|
}
|
||||||
BOOST_CATCH_END
|
BOOST_CATCH_END
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public:<br>
|
|||||||
using circular_buffer<T, Alloc>::max_size;
|
using circular_buffer<T, Alloc>::max_size;
|
||||||
using circular_buffer<T, Alloc>::empty;
|
using circular_buffer<T, Alloc>::empty;
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||||
reference operator [] (size_type n) { return circular_buffer<T, Alloc>::operator[](n); }
|
reference operator [] (size_type n) { return circular_buffer<T, Alloc>::operator[](n); }
|
||||||
const_reference operator [] (size_type n) const { return circular_buffer<T, Alloc>::operator[](n); }
|
const_reference operator [] (size_type n) const { return circular_buffer<T, Alloc>::operator[](n); }
|
||||||
#else
|
#else
|
||||||
@@ -1598,7 +1598,7 @@ private:
|
|||||||
static size_type init_capacity(const capacity_type& capacity_ctrl, Iterator first, Iterator last,
|
static size_type init_capacity(const capacity_type& capacity_ctrl, Iterator first, Iterator last,
|
||||||
const false_type&) {
|
const false_type&) {
|
||||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
||||||
return init_capacity(capacity_ctrl, first, last, std::iterator_traits<Iterator>::iterator_category());
|
return init_capacity(capacity_ctrl, first, last, std::iterator_traits<Iterator>::iterator_category());
|
||||||
#else
|
#else
|
||||||
return init_capacity(
|
return init_capacity(
|
||||||
|
|||||||
@@ -10,5 +10,6 @@
|
|||||||
],
|
],
|
||||||
"maintainers": [
|
"maintainers": [
|
||||||
"Jan Gaspar <jano_gaspar -at- yahoo.com>"
|
"Jan Gaspar <jano_gaspar -at- yahoo.com>"
|
||||||
]
|
],
|
||||||
|
"cxxstd": "03"
|
||||||
}
|
}
|
||||||
|
|||||||
11
test/CMakeLists.txt
Normal file
11
test/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
|
||||||
|
|
||||||
|
if(HAVE_BOOST_TEST)
|
||||||
|
|
||||||
|
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::circular_buffer Boost::core)
|
||||||
|
|
||||||
|
endif()
|
||||||
@@ -13,20 +13,18 @@ import testing ;
|
|||||||
|
|
||||||
project
|
project
|
||||||
: requirements
|
: requirements
|
||||||
|
<library>/boost/circular_buffer//boost_circular_buffer
|
||||||
<toolset>msvc:<warnings>all
|
<toolset>msvc:<warnings>all
|
||||||
<toolset>msvc:<asynch-exceptions>on
|
|
||||||
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
|
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
|
||||||
<toolset>msvc:<cxxflags>/wd4996 # 'function': was declared deprecated
|
<toolset>msvc:<cxxflags>/wd4996 # 'function': was declared deprecated
|
||||||
<toolset>msvc:<cxxflags>/wd4244 # conversion from 'int' to 'unsigned short', possible loss of data
|
<toolset>msvc:<cxxflags>/wd4244 # conversion from 'int' to 'unsigned short', possible loss of data
|
||||||
# in date-time
|
# in date-time
|
||||||
;
|
;
|
||||||
|
|
||||||
test-suite "circular_buffer"
|
run base_test.cpp ;
|
||||||
: [ run base_test.cpp : : : <threading>single : ]
|
run space_optimized_test.cpp ;
|
||||||
[ run space_optimized_test.cpp : : : <threading>single : ]
|
run base_test.cpp : : : <define>"BOOST_CB_ENABLE_DEBUG=1" : base_test_dbg ;
|
||||||
[ run base_test.cpp : : : <threading>single <define>"BOOST_CB_ENABLE_DEBUG=1" : base_test_dbg ]
|
run space_optimized_test.cpp : : : <define>"BOOST_CB_ENABLE_DEBUG=1" : space_optimized_test_dbg ;
|
||||||
[ run space_optimized_test.cpp : : : <threading>single <define>"BOOST_CB_ENABLE_DEBUG=1" : space_optimized_test_dbg ]
|
run soft_iterator_invalidation.cpp ;
|
||||||
[ run soft_iterator_invalidation.cpp : : : <threading>single : ]
|
run constant_erase_test.cpp ;
|
||||||
[ run constant_erase_test.cpp : : : <threading>single : ]
|
compile bounded_buffer_comparison.cpp : <threading>multi <library>/boost/thread//boost_thread <library>/boost/timer//boost_timer ;
|
||||||
[ compile bounded_buffer_comparison.cpp : <threading>multi : ]
|
|
||||||
;
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ void iterator_constructor_and_assign_test() {
|
|||||||
|
|
||||||
circular_buffer<MyInteger> cb(4, 3);
|
circular_buffer<MyInteger> cb(4, 3);
|
||||||
circular_buffer<MyInteger>::iterator it = cb.begin();
|
circular_buffer<MyInteger>::iterator it = cb.begin();
|
||||||
|
circular_buffer<MyInteger>::const_iterator cit2 = cb.cbegin();
|
||||||
circular_buffer<MyInteger>::iterator itCopy;
|
circular_buffer<MyInteger>::iterator itCopy;
|
||||||
itCopy = it;
|
itCopy = it;
|
||||||
it = it;
|
it = it;
|
||||||
@@ -24,12 +25,15 @@ void iterator_constructor_and_assign_test() {
|
|||||||
cit = it;
|
cit = it;
|
||||||
circular_buffer<MyInteger>::const_iterator end1 = cb.end();
|
circular_buffer<MyInteger>::const_iterator end1 = cb.end();
|
||||||
circular_buffer<MyInteger>::const_iterator end2 = end1;
|
circular_buffer<MyInteger>::const_iterator end2 = end1;
|
||||||
|
circular_buffer<MyInteger>::const_iterator end3 = cb.cend();
|
||||||
|
|
||||||
BOOST_TEST(itCopy == it);
|
BOOST_TEST(itCopy == it);
|
||||||
BOOST_TEST(cit == it);
|
BOOST_TEST(cit == it);
|
||||||
BOOST_TEST(end1 == end2);
|
BOOST_TEST(end1 == end2);
|
||||||
BOOST_TEST(it != end1);
|
BOOST_TEST(it != end1);
|
||||||
BOOST_TEST(cit != end2);
|
BOOST_TEST(cit != end2);
|
||||||
|
BOOST_TEST(cit2 == it);
|
||||||
|
BOOST_TEST(end3 == end1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void iterator_reference_test() {
|
void iterator_reference_test() {
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ void fifo_test(Buffer* buffer) {
|
|||||||
|
|
||||||
// Initialize the buffer with some values before launching producer and consumer threads.
|
// Initialize the buffer with some values before launching producer and consumer threads.
|
||||||
for (unsigned long i = QUEUE_SIZE / 2L; i > 0; --i) {
|
for (unsigned long i = QUEUE_SIZE / 2L; i > 0; --i) {
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
||||||
buffer->push_front(Buffer::value_type());
|
buffer->push_front(Buffer::value_type());
|
||||||
#else
|
#else
|
||||||
buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
|
buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
|
||||||
|
|||||||
17
test/cmake_install_test/CMakeLists.txt
Normal file
17
test/cmake_install_test/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Copyright 2018, 2019, 2026 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...3.31)
|
||||||
|
|
||||||
|
project(cmake_install_test LANGUAGES CXX)
|
||||||
|
|
||||||
|
find_package(boost_circular_buffer REQUIRED)
|
||||||
|
|
||||||
|
add_executable(main main.cpp)
|
||||||
|
target_link_libraries(main Boost::circular_buffer)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
add_test(main main)
|
||||||
|
|
||||||
|
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||||
11
test/cmake_install_test/main.cpp
Normal file
11
test/cmake_install_test/main.cpp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// Copyright 2026 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/circular_buffer.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
boost::circular_buffer<int> cb;
|
||||||
|
return cb.empty()? 0: 1;
|
||||||
|
}
|
||||||
43
test/cmake_subdir_test/CMakeLists.txt
Normal file
43
test/cmake_subdir_test/CMakeLists.txt
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Copyright 2018, 2019, 2026 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...3.31)
|
||||||
|
|
||||||
|
project(cmake_subdir_test LANGUAGES CXX)
|
||||||
|
|
||||||
|
add_subdirectory(../.. boostorg/circular_buffer)
|
||||||
|
|
||||||
|
# boostdep --brief circular_buffer
|
||||||
|
|
||||||
|
set(deps
|
||||||
|
|
||||||
|
# Primary dependencies
|
||||||
|
|
||||||
|
assert
|
||||||
|
concept_check
|
||||||
|
config
|
||||||
|
core
|
||||||
|
move
|
||||||
|
throw_exception
|
||||||
|
type_traits
|
||||||
|
|
||||||
|
# Secondary dependencies
|
||||||
|
|
||||||
|
preprocessor
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach(dep IN LISTS deps)
|
||||||
|
|
||||||
|
add_subdirectory(../../../${dep} boostorg/${dep})
|
||||||
|
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
add_executable(main main.cpp)
|
||||||
|
target_link_libraries(main Boost::circular_buffer)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
add_test(main main)
|
||||||
|
|
||||||
|
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||||
11
test/cmake_subdir_test/main.cpp
Normal file
11
test/cmake_subdir_test/main.cpp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// Copyright 2026 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/circular_buffer.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
boost::circular_buffer<int> cb;
|
||||||
|
return cb.empty()? 0: 1;
|
||||||
|
}
|
||||||
@@ -246,9 +246,9 @@ void allocator_test() {
|
|||||||
CB_CONTAINER<MyInteger> cb1(10, 0);
|
CB_CONTAINER<MyInteger> cb1(10, 0);
|
||||||
const CB_CONTAINER<MyInteger> cb2(10, 0);
|
const CB_CONTAINER<MyInteger> cb2(10, 0);
|
||||||
CB_CONTAINER<MyInteger>::allocator_type& alloc_ref = cb1.get_allocator();
|
CB_CONTAINER<MyInteger>::allocator_type& alloc_ref = cb1.get_allocator();
|
||||||
|
(void)alloc_ref;
|
||||||
CB_CONTAINER<MyInteger>::allocator_type alloc = cb2.get_allocator();
|
CB_CONTAINER<MyInteger>::allocator_type alloc = cb2.get_allocator();
|
||||||
alloc_ref.max_size();
|
(void)alloc;
|
||||||
alloc.max_size();
|
|
||||||
|
|
||||||
generic_test(cb1);
|
generic_test(cb1);
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ void allocator_test() {
|
|||||||
generic_test(cb_a);
|
generic_test(cb_a);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(BOOST_CB_NO_CXX11_ALLOCATOR)
|
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
template<class T>
|
template<class T>
|
||||||
class cxx11_allocator {
|
class cxx11_allocator {
|
||||||
public:
|
public:
|
||||||
@@ -1016,8 +1016,8 @@ void assign_test() {
|
|||||||
BOOST_TEST(cb1[5] == 7);
|
BOOST_TEST(cb1[5] == 7);
|
||||||
|
|
||||||
CB_CONTAINER<float> cb2(4);
|
CB_CONTAINER<float> cb2(4);
|
||||||
cb2.assign(3, 1.1f);
|
cb2.assign(3, 1.25f);
|
||||||
BOOST_TEST(cb2[0] == 1.1f);
|
BOOST_TEST(cb2[0] == 1.25f);
|
||||||
|
|
||||||
CB_CONTAINER<MyInteger> cb3(5);
|
CB_CONTAINER<MyInteger> cb3(5);
|
||||||
cb3.push_back(1);
|
cb3.push_back(1);
|
||||||
@@ -2490,7 +2490,7 @@ void run_common_tests()
|
|||||||
move_container_on_cpp11();
|
move_container_on_cpp11();
|
||||||
move_container_values_noexcept();
|
move_container_values_noexcept();
|
||||||
check_containers_exception_specifications();
|
check_containers_exception_specifications();
|
||||||
#if !defined(BOOST_CB_NO_CXX11_ALLOCATOR)
|
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
cxx11_allocator_test();
|
cxx11_allocator_test();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,11 @@ class InstanceCounter {
|
|||||||
public:
|
public:
|
||||||
InstanceCounter() { increment(); }
|
InstanceCounter() { increment(); }
|
||||||
InstanceCounter(const InstanceCounter& y) { y.increment(); }
|
InstanceCounter(const InstanceCounter& y) { y.increment(); }
|
||||||
|
InstanceCounter& operator=(const InstanceCounter& y) {
|
||||||
|
decrement();
|
||||||
|
y.increment();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
~InstanceCounter() { decrement(); }
|
~InstanceCounter() { decrement(); }
|
||||||
static int count() { return ms_count; }
|
static int count() { return ms_count; }
|
||||||
private:
|
private:
|
||||||
@@ -106,12 +111,9 @@ struct MyInputIterator {
|
|||||||
typedef size_t size_type;
|
typedef size_t size_type;
|
||||||
typedef ptrdiff_t difference_type;
|
typedef ptrdiff_t difference_type;
|
||||||
explicit MyInputIterator(const vector_iterator& it) : m_it(it) {}
|
explicit MyInputIterator(const vector_iterator& it) : m_it(it) {}
|
||||||
MyInputIterator& operator = (const MyInputIterator& it) {
|
|
||||||
if (this == &it)
|
// Default assignment operator
|
||||||
return *this;
|
|
||||||
m_it = it.m_it;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
reference operator * () const { return *m_it; }
|
reference operator * () const { return *m_it; }
|
||||||
pointer operator -> () const { return &(operator*()); }
|
pointer operator -> () const { return &(operator*()); }
|
||||||
MyInputIterator& operator ++ () {
|
MyInputIterator& operator ++ () {
|
||||||
|
|||||||
Reference in New Issue
Block a user