mirror of
https://github.com/boostorg/circular_buffer.git
synced 2026-02-07 22:32:16 +00:00
Compare commits
1 Commits
develop
...
boost-1.55
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aca434d344 |
668
.github/workflows/ci.yml
vendored
668
.github/workflows/ci.yml
vendored
@@ -1,668 +0,0 @@
|
|||||||
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
|
|
||||||
286
.travis.yml
286
.travis.yml
@@ -1,286 +0,0 @@
|
|||||||
# Copyright 2018 Peter Dimov
|
|
||||||
# Distributed under the Boost Software License, Version 1.0.
|
|
||||||
|
|
||||||
language: cpp
|
|
||||||
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
dist: trusty
|
|
||||||
|
|
||||||
python: "2.7"
|
|
||||||
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
|
|
||||||
env:
|
|
||||||
matrix:
|
|
||||||
- BOGUS_JOB=true
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
|
|
||||||
exclude:
|
|
||||||
- env: BOGUS_JOB=true
|
|
||||||
|
|
||||||
include:
|
|
||||||
- os: linux
|
|
||||||
compiler: g++
|
|
||||||
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: g++-4.4
|
|
||||||
env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- g++-4.4
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: g++-4.6
|
|
||||||
env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- g++-4.6
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: g++-4.7
|
|
||||||
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- g++-4.7
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: g++-4.8
|
|
||||||
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- g++-4.8
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: g++-4.9
|
|
||||||
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- g++-4.9
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: g++-5
|
|
||||||
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- g++-5
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: g++-6
|
|
||||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- g++-6
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: g++-7
|
|
||||||
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- g++-7
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: g++-8
|
|
||||||
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- g++-8
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: g++-8
|
|
||||||
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=17,2a
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- g++-8
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang++
|
|
||||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: /usr/bin/clang++
|
|
||||||
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-3.3
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: /usr/bin/clang++
|
|
||||||
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-3.4
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang++-3.5
|
|
||||||
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-3.5
|
|
||||||
- libstdc++-4.9-dev
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.5
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang++-3.6
|
|
||||||
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-3.6
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.6
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang++-3.7
|
|
||||||
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-3.7
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.7
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang++-3.8
|
|
||||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-3.8
|
|
||||||
- libstdc++-4.9-dev
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.8
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang++-3.9
|
|
||||||
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-3.9
|
|
||||||
- libstdc++-4.9-dev
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.9
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang++-4.0
|
|
||||||
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-4.0
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-trusty-4.0
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang++-5.0
|
|
||||||
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-5.0
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-trusty-5.0
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang++-6.0
|
|
||||||
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17,2a
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-6.0
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-trusty-6.0
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang++-7
|
|
||||||
env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-7
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-trusty-7
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang++-libc++
|
|
||||||
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- libc++-dev
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
compiler: clang++
|
|
||||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
|
|
||||||
|
|
||||||
install:
|
|
||||||
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
|
||||||
- cd ..
|
|
||||||
- git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost
|
|
||||||
- cd boost
|
|
||||||
- git submodule update --init tools/build
|
|
||||||
- git submodule update --init libs/config
|
|
||||||
- git submodule update --init tools/boostdep
|
|
||||||
- mkdir -p libs/circular_buffer
|
|
||||||
- cp -r $TRAVIS_BUILD_DIR/* libs/circular_buffer
|
|
||||||
- python tools/boostdep/depinst/depinst.py circular_buffer
|
|
||||||
- ./bootstrap.sh
|
|
||||||
- ./b2 headers
|
|
||||||
|
|
||||||
script:
|
|
||||||
- |-
|
|
||||||
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
|
|
||||||
- ./b2 -j 3 libs/circular_buffer/test toolset=$TOOLSET cxxstd=$CXXSTD
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email:
|
|
||||||
on_success: always
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
# Generated by `boostdep --cmake circular_buffer`
|
|
||||||
# Copyright 2020, 2021 Peter Dimov
|
|
||||||
# Distributed under the Boost Software License, Version 1.0.
|
|
||||||
# https://www.boost.org/LICENSE_1_0.txt
|
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.8...3.31)
|
|
||||||
|
|
||||||
project(boost_circular_buffer VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
|
||||||
|
|
||||||
add_library(boost_circular_buffer INTERFACE)
|
|
||||||
add_library(Boost::circular_buffer ALIAS boost_circular_buffer)
|
|
||||||
|
|
||||||
target_include_directories(boost_circular_buffer INTERFACE include)
|
|
||||||
|
|
||||||
target_link_libraries(boost_circular_buffer
|
|
||||||
INTERFACE
|
|
||||||
Boost::assert
|
|
||||||
Boost::concept_check
|
|
||||||
Boost::config
|
|
||||||
Boost::core
|
|
||||||
Boost::move
|
|
||||||
Boost::throw_exception
|
|
||||||
Boost::type_traits
|
|
||||||
)
|
|
||||||
|
|
||||||
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
|
|
||||||
|
|
||||||
add_subdirectory(test)
|
|
||||||
|
|
||||||
endif()
|
|
||||||
48
appveyor.yml
48
appveyor.yml
@@ -1,48 +0,0 @@
|
|||||||
# Copyright 2018 Peter Dimov
|
|
||||||
# Distributed under the Boost Software License, Version 1.0.
|
|
||||||
|
|
||||||
version: 1.0.{build}-{branch}
|
|
||||||
|
|
||||||
shallow_clone: true
|
|
||||||
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
|
|
||||||
environment:
|
|
||||||
matrix:
|
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
|
||||||
TOOLSET: msvc-9.0
|
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
|
||||||
TOOLSET: msvc-10.0
|
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
|
||||||
TOOLSET: msvc-11.0
|
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
|
||||||
TOOLSET: msvc-12.0
|
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
|
||||||
TOOLSET: msvc-14.0
|
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
|
||||||
TOOLSET: msvc-14.1
|
|
||||||
CXXSTD: 14,17
|
|
||||||
|
|
||||||
install:
|
|
||||||
- set BOOST_BRANCH=develop
|
|
||||||
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
|
|
||||||
- cd ..
|
|
||||||
- git clone -b %BOOST_BRANCH% https://github.com/boostorg/boost.git boost
|
|
||||||
- cd boost
|
|
||||||
- git submodule update --init tools/build
|
|
||||||
- git submodule update --init libs/config
|
|
||||||
- git submodule update --init tools/boostdep
|
|
||||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\circular_buffer\
|
|
||||||
- python tools/boostdep/depinst/depinst.py circular_buffer
|
|
||||||
- cmd /c bootstrap
|
|
||||||
- b2 headers
|
|
||||||
|
|
||||||
build: off
|
|
||||||
|
|
||||||
test_script:
|
|
||||||
- PATH=%ADDPATH%%PATH%
|
|
||||||
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
|
|
||||||
- b2 -j 3 libs/circular_buffer/test toolset=%TOOLSET% %CXXSTD%
|
|
||||||
30
build.jam
30
build.jam
@@ -1,30 +0,0 @@
|
|||||||
# 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
|
|
||||||
;
|
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
[def __min_capacity [memberref boost::circular_buffer_space_optimized::min_capacity() min_capacity]]
|
[def __min_capacity [memberref boost::circular_buffer_space_optimized::min_capacity() min_capacity]]
|
||||||
[def __capacity_control [memberref boost::circular_buffer_space_optimized::capacity_control () capacity_control ]]
|
[def __capacity_control [memberref boost::circular_buffer_space_optimized::capacity_control () capacity_control ]]
|
||||||
|
|
||||||
[def __debug_support [link circular_buffer.implementation.debug_support debug support]]
|
[def __debug_support [link circular_buffer.implmentation.debug_support debug support]]
|
||||||
|
|
||||||
[include ../../../tools/auto_index/include/auto_index_helpers.qbk]
|
[include ../../../tools/auto_index/include/auto_index_helpers.qbk]
|
||||||
[/ Must be first included file!]
|
[/ Must be first included file!]
|
||||||
@@ -67,8 +67,8 @@ new data is written starting at the beginning of the buffer and overwriting the
|
|||||||
|
|
||||||
[classref boost::circular_buffer] is a STL compliant container.
|
[classref boost::circular_buffer] is a STL compliant container.
|
||||||
|
|
||||||
It is a kind of sequence similar to [@https://www.boost.org/sgi/stl/List.html std::list]
|
It is a kind of sequence similar to [@http://www.sgi.com/tech/stl/List.html std::list]
|
||||||
or [@https://www.boost.org/sgi/stl/Deque.html std::deque].
|
or [@http://www.sgi.com/tech/stl/Deque.html std::deque].
|
||||||
It supports random access iterators, constant time insert and erase operations
|
It supports random access iterators, constant time insert and erase operations
|
||||||
at the beginning or the end of the buffer and interoperability with std algorithms.
|
at the beginning or the end of the buffer and interoperability with std algorithms.
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ Here is a simple example to introduce the class __cb.
|
|||||||
|
|
||||||
[circular_buffer_example_1]
|
[circular_buffer_example_1]
|
||||||
|
|
||||||
This example shows construction, inserting elements, overwriting and popping.
|
This example shows contruction, inserting elements, overwriting and popping.
|
||||||
|
|
||||||
[circular_buffer_example_2]
|
[circular_buffer_example_2]
|
||||||
|
|
||||||
@@ -334,9 +334,9 @@ so for example: iterators `(begin() - 1)` and `(end() + 1)` are both invalid.
|
|||||||
[h3 Debug Support]
|
[h3 Debug Support]
|
||||||
|
|
||||||
In order to help a programmer to avoid and find common bugs,
|
In order to help a programmer to avoid and find common bugs,
|
||||||
the __cb can be enabled to provide a kind of debug support.
|
the __cb contains a kind of debug support.
|
||||||
|
|
||||||
When the debugging functionality is enabled, the __cb maintains a list of valid iterators.
|
The __cb maintains a list of valid iterators.
|
||||||
As soon as any element gets destroyed all iterators pointing to this element
|
As soon as any element gets destroyed all iterators pointing to this element
|
||||||
are removed from this list and explicitly invalidated (an invalidation flag is set).
|
are removed from this list and explicitly invalidated (an invalidation flag is set).
|
||||||
The debug support also consists of many assertions (`BOOST_ASSERT` macros)
|
The debug support also consists of many assertions (`BOOST_ASSERT` macros)
|
||||||
@@ -349,13 +349,9 @@ Moreover, the uninitialized memory allocated by __cb is filled with the value `0
|
|||||||
When debugging the code, this can help the programmer to recognize the initialized memory from the uninitialized.
|
When debugging the code, this can help the programmer to recognize the initialized memory from the uninitialized.
|
||||||
For details refer the source code [@boost:boost/circular_buffer/debug.hpp circular_buffer/debug.hpp].
|
For details refer the source code [@boost:boost/circular_buffer/debug.hpp circular_buffer/debug.hpp].
|
||||||
|
|
||||||
[caution Since the debugging code makes __cb and its iterators more interconnected, thread safety guarantees of __cb
|
The debug support is enabled only in the debug mode (when the `NDEBUG` is not defined).
|
||||||
are different when debug support is enabled. In addition to the container itself, all iterators tracked by the container
|
It can also be explicitly disabled (only for __cb)
|
||||||
(including any copies thereof) must be protected from concurrent access. In particular, this includes copying, destroying or
|
by defining macro BOOST_CB_DISABLE_DEBUG.
|
||||||
obtaining iterators from the container, even if for read-only access.]
|
|
||||||
|
|
||||||
The debug support is disabled by default. To enable it, one has to define `BOOST_CB_ENABLE_DEBUG` macro with the value of 1
|
|
||||||
while compiling the code using __cb.
|
|
||||||
|
|
||||||
[h3 Compatibility with Interprocess library]
|
[h3 Compatibility with Interprocess library]
|
||||||
|
|
||||||
@@ -363,8 +359,8 @@ The __cb is compatible with the [@boost:libs/interprocess/index.html Boost.Inte
|
|||||||
[/ This should be in @boost:libs/interprocess/doc/index.html ]
|
[/ This should be in @boost:libs/interprocess/doc/index.html ]
|
||||||
library used for interprocess communication.
|
library used for interprocess communication.
|
||||||
Considering that the circular_buffer's debug support relies on 'raw' pointers
|
Considering that the circular_buffer's debug support relies on 'raw' pointers
|
||||||
(which is not permitted by the Interprocess library)
|
(which is not permited by the Interprocess library)
|
||||||
the code has to compiled with debug support disabled (i.e. with `BOOST_CB_ENABLE_DEBUG` macro not defined or defined to 0).
|
the code has to compiled with `-DBOOST_CB_DISABLE_DEBUG` or `-DNDEBUG` (which disables the Debug Support).
|
||||||
Not doing that will cause the compilation to fail.
|
Not doing that will cause the compilation to fail.
|
||||||
|
|
||||||
[endsect] [/section:implementation Implementation ]
|
[endsect] [/section:implementation Implementation ]
|
||||||
@@ -470,9 +466,9 @@ The __cbso is defined in the file [@boost:boost/circular_buffer/space_optimized.
|
|||||||
|
|
||||||
[section:concepts Modelled Concepts]
|
[section:concepts Modelled Concepts]
|
||||||
|
|
||||||
[@https://www.boost.org/sgi/stl/RandomAccessContainer.html Random Access Container],
|
[@http://www.sgi.com/tech/stl/RandomAccessContainer.html Random Access Container],
|
||||||
[@https://www.boost.org/sgi/stl/FrontInsertionSequence.html Front Insertion Sequence], and
|
[@http://www.sgi.com/tech/stl/FrontInsertionSequence.html Front Insertion Sequence], and
|
||||||
[@https://www.boost.org/sgi/stl/BackInsertionSequence.html Back Insertion sequence]
|
[@http://www.sgi.com/tech/stl/BackInsertionSequence.html Back Insertion sequence]
|
||||||
|
|
||||||
[endsect] [/section:concepts Modelled Concepts]
|
[endsect] [/section:concepts Modelled Concepts]
|
||||||
|
|
||||||
@@ -483,10 +479,10 @@ The __cbso is defined in the file [@boost:boost/circular_buffer/space_optimized.
|
|||||||
[[T] [The type of the elements stored in the circular_buffer.
|
[[T] [The type of the elements stored in the circular_buffer.
|
||||||
The T has to be [@boost:libs/utility/Assignable.html Assignable]
|
The T has to be [@boost:libs/utility/Assignable.html Assignable]
|
||||||
and [@boost:libs/utility/CopyConstructible.html CopyConstructible].
|
and [@boost:libs/utility/CopyConstructible.html CopyConstructible].
|
||||||
Moreover T has to be [@https://www.boost.org/sgi/stl/DefaultConstructible.html DefaultConstructible]
|
Moreover T has to be [@http://www.sgi.com/tech/stl/DefaultConstructible.html DefaultConstructible]
|
||||||
if supplied as a default parameter when invoking some of the circular_buffer's methods,
|
if supplied as a default parameter when invoking some of the circular_buffer's methods,
|
||||||
e.g. `insert(iterator pos, const value_type& item = value_type())`.
|
e.g. `insert(iterator pos, const value_type& item = value_type())`.
|
||||||
And [@https://www.boost.org/sgi/stl/EqualityComparable.html EqualityComparable]
|
And [@http://www.sgi.com/tech/stl/EqualityComparable.html EqualityComparable]
|
||||||
and/or [@boost:libs/utility/LessThanComparable.html LessThanComparable]
|
and/or [@boost:libs/utility/LessThanComparable.html LessThanComparable]
|
||||||
if the circular_buffer will be compared with another container.]]
|
if the circular_buffer will be compared with another container.]]
|
||||||
[[Alloc] [The allocator type used for all internal memory management.
|
[[Alloc] [The allocator type used for all internal memory management.
|
||||||
@@ -536,10 +532,6 @@ Type: Patches
|
|||||||
|
|
||||||
[section:release Release Notes]
|
[section:release Release Notes]
|
||||||
|
|
||||||
[h4 Boost 1.56]
|
|
||||||
|
|
||||||
* C++11 allocator model support implemented by Glen Fernandes.
|
|
||||||
|
|
||||||
[h4 Boost 1.55]
|
[h4 Boost 1.55]
|
||||||
|
|
||||||
* Documentation refactored by Paul A. Bristow using Quickbook, Doxygen and Autoindexing.
|
* Documentation refactored by Paul A. Bristow using Quickbook, Doxygen and Autoindexing.
|
||||||
|
|||||||
@@ -6,17 +6,17 @@
|
|||||||
|
|
||||||
# Use, modification and distribution is subject to
|
# Use, modification and distribution is subject to
|
||||||
# the Boost Software License, Version 1.0.
|
# the Boost Software License, Version 1.0.
|
||||||
# (See accompanying file LICENSE_1_0.txt
|
# (See accompanying file LICENSE_1_0.txt
|
||||||
# or copy at http://www.boost.org/LICENSE_1_0.txt)
|
# or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
path-constant nav_images : html/images/ ; # png and svg images for home, next, note, tip...
|
path-constant nav_images : html/images/ ; # png and svg images for home, next, note, tip...
|
||||||
path-constant images_location : html/images ; # location of my SVG and PNG images referenced by Quickbook.
|
path-constant images_location : html/images ; # location of my SVG and PNG images referenced by Quickbook.
|
||||||
path-constant pdf_images_location : .. ; # location of SVG and PNG images referenced by pdf.
|
path-constant pdf_images_location : html ; # location of SVG and PNG images referenced by pdf.
|
||||||
path-constant here : . ; # location of /doc folder.
|
path-constant here : . ; # location of /doc folder.
|
||||||
|
|
||||||
# echo "nav_images = " $(nav_images) ; # "nav_images = I:\boost-trunk\libs\circular_buffer\doc\html\images
|
# echo "nav_images = " $(nav_images) ; # "nav_images = I:\boost-trunk\libs\circular_buffer\doc\html\images
|
||||||
# echo "images_location = " $(images_location) ; # images_location = I:\boost-trunk\libs\circular_buffer\doc\html\images
|
# echo "images_location = " $(images_location) ; # images_location = I:\boost-trunk\libs\circular_buffer\doc\html\images
|
||||||
# echo "pdf_images_location = " $(pdf_images_location) #
|
# echo "pdf_images_location = " $(pdf_images_location) #
|
||||||
import modules ;
|
import modules ;
|
||||||
using auto-index ;
|
using auto-index ;
|
||||||
using doxygen ; # Required if you want to use Doxygen.
|
using doxygen ; # Required if you want to use Doxygen.
|
||||||
@@ -26,10 +26,12 @@ using quickbook ;
|
|||||||
doxygen autodoc
|
doxygen autodoc
|
||||||
:
|
:
|
||||||
# List all the files individually (RECURSIVE=NO ).
|
# List all the files individually (RECURSIVE=NO ).
|
||||||
[ glob ../include/boost/circular_buffer.hpp ]
|
[ glob ../../../boost/circular_buffer.hpp ]
|
||||||
[ glob ../include/boost/circular_buffer/base.hpp ]
|
[ glob ../../../boost/circular_buffer/base.hpp ]
|
||||||
[ glob ../include/boost/circular_buffer/space_optimized.hpp ]
|
[ glob ../../../boost/circular_buffer/space_optimized.hpp ]
|
||||||
|
[ glob ../../../boost/circular_buffer/details.hpp ] # Needed for capacity_control at least.
|
||||||
|
[ glob ../../../boost/circular_buffer/debug.hpp ] # not needed?
|
||||||
|
|
||||||
:
|
:
|
||||||
# Pass some setting parameters to Doxygen.
|
# Pass some setting parameters to Doxygen.
|
||||||
<doxygen:param>WARNINGS=YES # Default NO, but useful to see warnings, especially in a logfile.
|
<doxygen:param>WARNINGS=YES # Default NO, but useful to see warnings, especially in a logfile.
|
||||||
@@ -38,14 +40,14 @@ doxygen autodoc
|
|||||||
# Much better to send message to a logfile than the default stderr.
|
# Much better to send message to a logfile than the default stderr.
|
||||||
# and make sure that there are no Doxygen errors or significant warnings in the log file.
|
# and make sure that there are no Doxygen errors or significant warnings in the log file.
|
||||||
<doxygen:param>RECURSIVE=NO # Search recursively down .hpp and .cpp subdirectories.
|
<doxygen:param>RECURSIVE=NO # Search recursively down .hpp and .cpp subdirectories.
|
||||||
<doxygen:param>EXTRACT_ALL=NO
|
<doxygen:param>EXTRACT_ALL=NO
|
||||||
<doxygen:param>EXTRACT_PRIVATE=NO # NO means do not extract info about private member functions and data.
|
<doxygen:param>EXTRACT_PRIVATE=NO # NO means do not extract info about private member functions and data.
|
||||||
<doxygen:param>HIDE_UNDOC_MEMBERS=YES # Only show members that have some documentation like \param, \return ...
|
<doxygen:param>HIDE_UNDOC_MEMBERS=YES # Only show members that have some documentation like \param, \return ...
|
||||||
<doxygen:param>MACRO_EXPANSION=YES # YES will expand all macro names in the source code (default = NO).
|
<doxygen:param>MACRO_EXPANSION=YES # YES will expand all macro names in the source code (default = NO).
|
||||||
<doxygen:param>EXPAND_ONLY_PREDEF=YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
|
<doxygen:param>EXPAND_ONLY_PREDEF=YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
|
||||||
# then the macro expansion is limited to the macros specified with the PREDEFINED and EXPAND_AS_DEFINED tags.
|
# then the macro expansion is limited to the macros specified with the PREDEFINED and EXPAND_AS_DEFINED tags.
|
||||||
# If EXPAND_ONLY_PREDEF tag can be used to specify a list of macro names that should be expanded (as defined).
|
# If EXPAND_ONLY_PREDEF tag can be used to specify a list of macro names that should be expanded (as defined).
|
||||||
# The PREDEFINED tag can be used to specify one or more macro names that are defined
|
# The PREDEFINED tag can be used to specify one or more macro names that are defined
|
||||||
# before the preprocessor is started (similar to the -D option of gcc).
|
# before the preprocessor is started (similar to the -D option of gcc).
|
||||||
# The argument of the tag is a list of macros of the form:
|
# The argument of the tag is a list of macros of the form:
|
||||||
# name or name=definition (no spaces).
|
# name or name=definition (no spaces).
|
||||||
@@ -78,17 +80,17 @@ doxygen autodoc
|
|||||||
<doxygen:param>EXCLUDE_SYMBOLS=*_throws
|
<doxygen:param>EXCLUDE_SYMBOLS=*_throws
|
||||||
# <doxygen:param>IMAGE_PATH="../images" # for circular_buffer.png
|
# <doxygen:param>IMAGE_PATH="../images" # for circular_buffer.png
|
||||||
# See autodoxywarnings.log to check this is correct.
|
# See autodoxywarnings.log to check this is correct.
|
||||||
|
|
||||||
# The syntax hoops to jump through are 'interesting' for more than one PREDEFINED,
|
# The syntax hoops to jump through are 'interesting' for more than one PREDEFINED,
|
||||||
# and to permit spaces within definitions (use double quotes).
|
# and to permit spaces within definitions (use double quotes).
|
||||||
# Don't forget that every double quote " needs a preceding \trip character!
|
# Don't forget that every double quote " needs a preceeding \trip character!
|
||||||
# and that each trailing continuation \ needs a preceding \trip character too!
|
# and that each trailing continuation \ needs a preceeding \trip character too!
|
||||||
# And finally that if more than one item is included (as here) the whole is
|
# And finally that if more than one item is included (as here) the whole is
|
||||||
# enclosed in "PREDEFINED=... ", but without a leading \. Go figure...
|
# enclosed in "PREDEFINED=... ", but without a leading \. Go figure...
|
||||||
|
|
||||||
# A grep for PREDEFINED= in jamfiles will reveal even more complex examples.
|
# A grep for PREDEFINED= in jamfiles will reveal even more complex examples.
|
||||||
# Boost Libraries with useful examples are: Accumulators, Interprocess, MPI, Random, Units, Expressive.
|
# Boost Libraries with useful examples are: Accumulators, Interprocess, MPI, Random, Units, Expressive.
|
||||||
|
|
||||||
# Optionally, you can provide a Reference section name specific for your library, for example:
|
# Optionally, you can provide a Reference section name specific for your library, for example:
|
||||||
<xsl:param>"boost.doxygen.reftitle=Boost.Circular_buffer C++ Reference"
|
<xsl:param>"boost.doxygen.reftitle=Boost.Circular_buffer C++ Reference"
|
||||||
;
|
;
|
||||||
@@ -101,7 +103,7 @@ boostbook standalone
|
|||||||
:
|
:
|
||||||
circular_buffer
|
circular_buffer
|
||||||
:
|
:
|
||||||
|
|
||||||
# General settings
|
# General settings
|
||||||
# =================
|
# =================
|
||||||
<format>html:<xsl:param>boost.root=../../../..
|
<format>html:<xsl:param>boost.root=../../../..
|
||||||
@@ -118,7 +120,7 @@ boostbook standalone
|
|||||||
<xsl:param>page.margin.outer=0.5in
|
<xsl:param>page.margin.outer=0.5in
|
||||||
# Yes, we want graphics for admonishments:
|
# Yes, we want graphics for admonishments:
|
||||||
<xsl:param>admon.graphics=1
|
<xsl:param>admon.graphics=1
|
||||||
|
|
||||||
# HTML options:
|
# HTML options:
|
||||||
# =============
|
# =============
|
||||||
# Use graphics icons not text for navigation:
|
# Use graphics icons not text for navigation:
|
||||||
@@ -137,27 +139,27 @@ boostbook standalone
|
|||||||
<format>html:<xsl:param>html.cellspacing=3 # pixels
|
<format>html:<xsl:param>html.cellspacing=3 # pixels
|
||||||
# Vertical spacing in table cells.
|
# Vertical spacing in table cells.
|
||||||
<format>html:<xsl:param>html.cellpadding=5 # pixels
|
<format>html:<xsl:param>html.cellpadding=5 # pixels
|
||||||
# Not sure if these are right way round?
|
# Not sure if these are right way round?
|
||||||
|
|
||||||
<auto-index>on # Turns on index (or off).
|
<auto-index>on # Turns on index (or off).
|
||||||
# Turns on (or off) index-verbose for diagnostic info (using /bin auto-index-verbose folders).
|
# Turns on (or off) index-verbose for diagnostic info (using /bin auto-index-verbose folders).
|
||||||
<auto-index-verbose>on
|
<auto-index-verbose>on
|
||||||
|
|
||||||
<format>pdf:<auto-index-internal>off # on (or off) to use internally generated indexes.
|
<format>pdf:<auto-index-internal>off # on (or off) to use internally generated indexes.
|
||||||
|
|
||||||
<format>html:<xsl:param>index.on.type=1 # = 1 For the native stylesheets to generate multiple different indexes.
|
<format>html:<xsl:param>index.on.type=1 # = 1 For the native stylesheets to generate multiple different indexes.
|
||||||
|
|
||||||
<auto-index-script>circular_buffer.idx # Specifies the name of the script to load for circular_buffer.
|
<auto-index-script>circular_buffer.idx # Specifies the name of the script to load for circular_buffer.
|
||||||
<auto-index-prefix>../../.. # Will get you back up to /circular_buffer, so !scan-path "boost/circular_buffer/" is where *.hpp will be,
|
<auto-index-prefix>../../.. # Will get you back up to /circular_buffer, so !scan-path "boost/circular_buffer/" is where *.hpp will be,
|
||||||
# and /libs/circular_buffer for other files.
|
# and /libs/circular_buffer for other files.
|
||||||
# Without this would need !scan-path "../../../boost/circular_buffer"
|
# Without this would need !scan-path "../../../boost/circular_buffer"
|
||||||
|
|
||||||
# Used by Quickbook to invoke indexing.
|
# Used by Quickbook to invoke indexing.
|
||||||
# Required by boost-trunk/doc/ see jamfile.v2 to use auto-index.
|
# Required by boost-trunk/doc/ see jamfile.v2 to use auto-index.
|
||||||
# Choose indexing method for html:
|
# Choose indexing method for html:
|
||||||
<format>html:<auto-index-internal>on
|
<format>html:<auto-index-internal>on
|
||||||
<format>docbook:<auto-index-internal>on
|
<format>docbook:<auto-index-internal>on
|
||||||
|
|
||||||
# PDF Options:
|
# PDF Options:
|
||||||
# ============
|
# ============
|
||||||
# TOC Generation: this is needed for FOP-0.9 and later:
|
# TOC Generation: this is needed for FOP-0.9 and later:
|
||||||
@@ -172,30 +174,29 @@ boostbook standalone
|
|||||||
<xsl:param>page.margin.inner=0.5in
|
<xsl:param>page.margin.inner=0.5in
|
||||||
# Margin size:
|
# Margin size:
|
||||||
<xsl:param>page.margin.outer=0.5in
|
<xsl:param>page.margin.outer=0.5in
|
||||||
|
|
||||||
# Yes, we want graphics for admonishments:
|
# Yes, we want graphics for admonishments:
|
||||||
<xsl:param>admon.graphics=1
|
<xsl:param>admon.graphics=1
|
||||||
|
|
||||||
# Set these one for PDF generation *only*:
|
# Set these one for PDF generation *only*:
|
||||||
# default png graphics are awful in PDF form,
|
# default png graphics are awful in PDF form,
|
||||||
# better use SVG instead:
|
# better use SVG instead:
|
||||||
<format>pdf:<xsl:param>admon.graphics.extension=".svg"
|
#<format>pdf:<xsl:param>admon.graphics.extension=".svg"
|
||||||
#<format>pdf:<xsl:param>admon.graphics.extension=".png" # Only png images are available.
|
<format>pdf:<xsl:param>admon.graphics.extension=".png" # Only png images are available.
|
||||||
# Don't need this, default path works OK:
|
<format>pdf:<xsl:param>admon.graphics.path=$(nav_images)/ # next, prev, note, tip ... for pdf.
|
||||||
#<format>pdf:<xsl:param>admon.graphics.path=$(nav_images)/ # next, prev, note, tip ... for pdf.
|
<format>pdf:<xsl:param>use.role.for.mediaobject=1
|
||||||
<format>pdf:<xsl:param>use.role.for.mediaobject=1
|
|
||||||
<format>pdf:<xsl:param>preferred.mediaobject.role=print
|
<format>pdf:<xsl:param>preferred.mediaobject.role=print
|
||||||
<format>pdf:<xsl:param>img.src.path=$(pdf_images_location)/ # graphics (diagrams) for pdf.
|
<format>pdf:<xsl:param>img.src.path=$(pdf_images_location)/ # graphics (diagrams) for pdf.
|
||||||
<format>pdf:<xsl:param>draft.mode="no"
|
<format>pdf:<xsl:param>draft.mode="no"
|
||||||
<format>pdf:<xsl:param>boost.url.prefix=../../../..
|
<format>pdf:<xsl:param>boost.url.prefix=../../../..
|
||||||
|
|
||||||
<dependency>autodoc #
|
<dependency>autodoc #
|
||||||
<dependency>png_install
|
<dependency>png_install
|
||||||
;
|
;
|
||||||
|
|
||||||
# Install (copy) the 'master' copies of all icon images (both PNG and SVG)
|
# Install (copy) the 'master' copies of all icon images (both PNG and SVG)
|
||||||
# and the Boost logo from your current Boost-root
|
# and the Boost logo from your current Boost-root
|
||||||
# to the local /doc/html/images folder so that html is complete and standalone.
|
# to the local /doc/html/images folder so that html is complete and standalone.
|
||||||
install png_install : [ glob $(here)/*.png ] : <location>$(here)/../../../doc/html/images ;
|
install png_install : [ glob $(here)/*.png ] : <location>$(here)/../../../doc/html/images ;
|
||||||
|
|
||||||
# install pdf-install : standalone : <install-type>PDF <location>. ;
|
# install pdf-install : standalone : <install-type>PDF <location>. ;
|
||||||
@@ -204,14 +205,7 @@ install png_install : [ glob $(here)/*.png ] : <location>$(here)/../../../doc/ht
|
|||||||
# because a modified pdf file is created, so this command
|
# because a modified pdf file is created, so this command
|
||||||
# will rename the file to the expected filename, here circular_buffer.pdf.
|
# will rename the file to the expected filename, here circular_buffer.pdf.
|
||||||
|
|
||||||
install pdfinstall : standalone : <install-type>PDF <location>. <name>circular_buffer.pdf ;
|
install pdf-install : standalone : <install-type>PDF <location>. <name>circular_buffer.pdf ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
alias boostdoc
|
|
||||||
: standalone/<format>docbook
|
|
||||||
:
|
|
||||||
:
|
|
||||||
: ;
|
|
||||||
explicit boostdoc ;
|
|
||||||
alias boostrelease ;
|
|
||||||
explicit boostrelease ;
|
|
||||||
|
|||||||
@@ -7,12 +7,14 @@
|
|||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#define BOOST_CB_DISABLE_DEBUG
|
||||||
|
|
||||||
#include <boost/circular_buffer.hpp>
|
#include <boost/circular_buffer.hpp>
|
||||||
#include <boost/thread/mutex.hpp>
|
#include <boost/thread/mutex.hpp>
|
||||||
#include <boost/thread/condition.hpp>
|
#include <boost/thread/condition.hpp>
|
||||||
#include <boost/thread/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
#include <boost/timer/timer.hpp>
|
|
||||||
#include <boost/call_traits.hpp>
|
#include <boost/call_traits.hpp>
|
||||||
|
#include <boost/progress.hpp>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <list>
|
#include <list>
|
||||||
@@ -229,11 +231,11 @@ template<class Buffer>
|
|||||||
void fifo_test(Buffer* buffer) {
|
void fifo_test(Buffer* buffer) {
|
||||||
|
|
||||||
// Start of measurement
|
// Start of measurement
|
||||||
boost::timer::auto_cpu_timer progress;
|
boost::progress_timer progress;
|
||||||
|
|
||||||
// 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(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(__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());
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ as an underlying container of the bounded buffer.
|
|||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
#include <boost/timer/timer.hpp> // for auto_cpu_timer
|
#include <boost/timer/timer.hpp> // for auto_cpu_timer
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class bounded_buffer
|
class bounded_buffer
|
||||||
@@ -136,7 +135,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(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(__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());
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
// Create a circular buffer with a capacity for 3 integers.
|
// Create a circular buffer with a capacity for 3 integers.
|
||||||
boost::circular_buffer<int> cb(3);
|
boost::circular_buffer<int> cb(3);
|
||||||
|
|
||||||
// Insert three elements into the buffer.
|
// Insert threee elements into the buffer.
|
||||||
cb.push_back(1);
|
cb.push_back(1);
|
||||||
cb.push_back(2);
|
cb.push_back(2);
|
||||||
cb.push_back(3);
|
cb.push_back(3);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
echo off
|
echo off
|
||||||
rem quickbook doxygen auto-index docs template circular_buffer_html_index.bat
|
rem quickbook doxgen auto-index docs template circular_buffer_html_index.bat
|
||||||
rem echo circular_buffer_html_index_%date%_%time:~0,2%_%time:~3,2%.log
|
rem echo circular_buffer_html_index_%date%_%time:~0,2%_%time:~3,2%.log
|
||||||
rem The DOS time format is assumed 12:34 and the : separator is not used.
|
rem The DOS time format is assumed 12:34 and the : separator is not used.
|
||||||
set t=%time% /T
|
set t=%time% /T
|
||||||
|
|||||||
@@ -5,13 +5,11 @@
|
|||||||
// (See the accompanying file LICENSE_1_0.txt
|
// (See the accompanying file LICENSE_1_0.txt
|
||||||
// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
|
// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
|
||||||
|
|
||||||
#undef BOOST_CB_ENABLE_DEBUG
|
|
||||||
|
|
||||||
//[circular_buffer_iter_example_1
|
//[circular_buffer_iter_example_1
|
||||||
/*`
|
/*`
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BOOST_CB_ENABLE_DEBUG 0 // The Debug Support has to be disabled, otherwise the code produces a runtime error.
|
#define BOOST_CB_DISABLE_DEBUG // The Debug Support has to be disabled, otherwise the code produces a runtime error.
|
||||||
|
|
||||||
#include <boost/circular_buffer.hpp>
|
#include <boost/circular_buffer.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
@@ -36,5 +34,5 @@ int main(int /*argc*/, char* /*argv*/[])
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//] [/circular_buffer_iter_example_1]
|
//] [/circular_buffer_iter_example_1]
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ project
|
|||||||
<toolset>msvc:<cxxflags>/wd4305
|
<toolset>msvc:<cxxflags>/wd4305
|
||||||
;
|
;
|
||||||
|
|
||||||
run bounded_buffer_comparison.cpp ../../timer/build//boost_timer ;
|
run bounded_buffer_comparison.cpp ;
|
||||||
run circular_buffer_iter_example.cpp ;
|
run circular_buffer_iter_example.cpp ;
|
||||||
run circular_buffer_sum_example.cpp ;
|
run circular_buffer_sum_example.cpp ;
|
||||||
run circular_buffer_bound_example.cpp ../../thread/build//boost_thread ../../timer/build//boost_timer ;
|
run circular_buffer_bound_example.cpp ../../thread/build//boost_thread ../../timer/build//boost_timer ;
|
||||||
|
|||||||
@@ -8,27 +8,24 @@
|
|||||||
|
|
||||||
// See www.boost.org/libs/circular_buffer for documentation.
|
// See www.boost.org/libs/circular_buffer for documentation.
|
||||||
|
|
||||||
/*! @file
|
|
||||||
Includes <boost/circular_buffer/base.hpp>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(BOOST_CIRCULAR_BUFFER_HPP)
|
#if !defined(BOOST_CIRCULAR_BUFFER_HPP)
|
||||||
#define BOOST_CIRCULAR_BUFFER_HPP
|
#define BOOST_CIRCULAR_BUFFER_HPP
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/circular_buffer_fwd.hpp>
|
#include <boost/circular_buffer_fwd.hpp>
|
||||||
#include <boost/config/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <boost/static_assert.hpp>
|
|
||||||
|
|
||||||
/*! Debug support control. */
|
// BOOST_CB_ENABLE_DEBUG: Debug support control.
|
||||||
#if !defined(BOOST_CB_ENABLE_DEBUG)
|
#if defined(NDEBUG) || defined(BOOST_CB_DISABLE_DEBUG)
|
||||||
#define BOOST_CB_ENABLE_DEBUG 0
|
#define BOOST_CB_ENABLE_DEBUG 0
|
||||||
|
#else
|
||||||
|
#define BOOST_CB_ENABLE_DEBUG 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
// BOOST_CB_ASSERT: Runtime assertion.
|
||||||
#if BOOST_CB_ENABLE_DEBUG
|
#if BOOST_CB_ENABLE_DEBUG
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#define BOOST_CB_ASSERT(Expr) BOOST_ASSERT(Expr)
|
#define BOOST_CB_ASSERT(Expr) BOOST_ASSERT(Expr)
|
||||||
@@ -36,19 +33,29 @@ Includes <boost/circular_buffer/base.hpp>
|
|||||||
#define BOOST_CB_ASSERT(Expr) ((void)0)
|
#define BOOST_CB_ASSERT(Expr) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
// BOOST_CB_STATIC_ASSERT: Compile time assertion.
|
||||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x0550) || BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
#define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) ((void)0)
|
#define BOOST_CB_STATIC_ASSERT(Expr) ((void)0)
|
||||||
#else
|
#else
|
||||||
#include <iterator>
|
#include <boost/static_assert.hpp>
|
||||||
#include <boost/type_traits/is_convertible.hpp>
|
#define BOOST_CB_STATIC_ASSERT(Expr) BOOST_STATIC_ASSERT(Expr)
|
||||||
#define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) \
|
|
||||||
BOOST_STATIC_ASSERT((is_convertible<typename std::iterator_traits<Iterator>::value_type, Type>::value))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
// BOOST_CB_IS_CONVERTIBLE: Check if Iterator::value_type is convertible to Type.
|
||||||
|
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x0550) || BOOST_WORKAROUND(__MWERKS__, <= 0x2407) || \
|
||||||
|
BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
|
#define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) ((void)0)
|
||||||
|
#else
|
||||||
|
#include <boost/detail/iterator.hpp>
|
||||||
|
#include <boost/type_traits/is_convertible.hpp>
|
||||||
|
#define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) \
|
||||||
|
BOOST_CB_STATIC_ASSERT((is_convertible<typename detail::iterator_traits<Iterator>::value_type, Type>::value))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS:
|
||||||
|
// Check if the STL provides templated iterator constructors for its containers.
|
||||||
#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
|
#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
|
||||||
#define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS BOOST_STATIC_ASSERT(false);
|
#define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS BOOST_CB_STATIC_ASSERT(false);
|
||||||
#else
|
#else
|
||||||
#define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS ((void)0);
|
#define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS ((void)0);
|
||||||
#endif
|
#endif
|
||||||
@@ -60,6 +67,8 @@ Includes <boost/circular_buffer/base.hpp>
|
|||||||
|
|
||||||
#undef BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS
|
#undef BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
#undef BOOST_CB_IS_CONVERTIBLE
|
#undef BOOST_CB_IS_CONVERTIBLE
|
||||||
|
#undef BOOST_CB_STATIC_ASSERT
|
||||||
#undef BOOST_CB_ASSERT
|
#undef BOOST_CB_ASSERT
|
||||||
|
#undef BOOST_CB_ENABLE_DEBUG
|
||||||
|
|
||||||
#endif // #if !defined(BOOST_CIRCULAR_BUFFER_HPP)
|
#endif // #if !defined(BOOST_CIRCULAR_BUFFER_HPP)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -9,20 +9,10 @@
|
|||||||
#if !defined(BOOST_CIRCULAR_BUFFER_DEBUG_HPP)
|
#if !defined(BOOST_CIRCULAR_BUFFER_DEBUG_HPP)
|
||||||
#define BOOST_CIRCULAR_BUFFER_DEBUG_HPP
|
#define BOOST_CIRCULAR_BUFFER_DEBUG_HPP
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOOST_CB_ENABLE_DEBUG
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
|
||||||
namespace std {
|
|
||||||
using ::memset;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // BOOST_CB_ENABLE_DEBUG
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
namespace cb_details {
|
namespace cb_details {
|
||||||
@@ -32,21 +22,6 @@ namespace cb_details {
|
|||||||
// The value the uninitialized memory is filled with.
|
// The value the uninitialized memory is filled with.
|
||||||
const int UNINITIALIZED = 0xcc;
|
const int UNINITIALIZED = 0xcc;
|
||||||
|
|
||||||
template <class T>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
inline void do_fill_uninitialized_memory(T& /*data*/, std::size_t /*size_in_bytes*/) BOOST_NOEXCEPT {
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class debug_iterator_registry;
|
class debug_iterator_registry;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
// Copyright (c) 2003-2008 Jan Gaspar
|
// Copyright (c) 2003-2008 Jan Gaspar
|
||||||
|
|
||||||
// Copyright 2014,2018 Glen Joseph Fernandes
|
|
||||||
// (glenjofe@gmail.com)
|
|
||||||
|
|
||||||
// Use, modification, and distribution is subject to the Boost Software
|
// Use, modification, and distribution is subject to the Boost Software
|
||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
@@ -12,16 +9,15 @@
|
|||||||
#if !defined(BOOST_CIRCULAR_BUFFER_DETAILS_HPP)
|
#if !defined(BOOST_CIRCULAR_BUFFER_DETAILS_HPP)
|
||||||
#define BOOST_CIRCULAR_BUFFER_DETAILS_HPP
|
#define BOOST_CIRCULAR_BUFFER_DETAILS_HPP
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <boost/iterator.hpp>
|
||||||
#include <boost/throw_exception.hpp>
|
#include <boost/throw_exception.hpp>
|
||||||
#include <boost/core/allocator_access.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>
|
||||||
#include <boost/core/no_exceptions_support.hpp>
|
#include <boost/detail/no_exceptions_support.hpp>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
// Silence MS /W4 warnings like C4913:
|
// Silence MS /W4 warnings like C4913:
|
||||||
@@ -36,50 +32,50 @@ namespace boost {
|
|||||||
|
|
||||||
namespace cb_details {
|
namespace cb_details {
|
||||||
|
|
||||||
template <class Alloc> struct nonconst_traits;
|
template <class Traits> 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(
|
||||||
ForwardIterator first, Diff n, const T& item, Alloc& alloc);
|
ForwardIterator first, Diff n, const T& item, Alloc& alloc);
|
||||||
|
|
||||||
template<class InputIterator, class ForwardIterator, class Alloc>
|
template<class ValueType, class InputIterator, class ForwardIterator>
|
||||||
ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a);
|
ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest);
|
||||||
|
|
||||||
template<class InputIterator, class ForwardIterator, class Alloc>
|
template<class ValueType, class InputIterator, class ForwardIterator>
|
||||||
ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a);
|
ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\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 Alloc>
|
template <class Traits>
|
||||||
struct const_traits {
|
struct const_traits {
|
||||||
// Basic types
|
// Basic types
|
||||||
typedef typename Alloc::value_type value_type;
|
typedef typename Traits::value_type value_type;
|
||||||
typedef typename boost::allocator_const_pointer<Alloc>::type pointer;
|
typedef typename Traits::const_pointer pointer;
|
||||||
typedef const value_type& reference;
|
typedef typename Traits::const_reference reference;
|
||||||
typedef typename boost::allocator_size_type<Alloc>::type size_type;
|
typedef typename Traits::size_type size_type;
|
||||||
typedef typename boost::allocator_difference_type<Alloc>::type difference_type;
|
typedef typename Traits::difference_type difference_type;
|
||||||
|
|
||||||
// Non-const traits
|
// Non-const traits
|
||||||
typedef nonconst_traits<Alloc> nonconst_self;
|
typedef nonconst_traits<Traits> 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 Alloc>
|
template <class Traits>
|
||||||
struct nonconst_traits {
|
struct nonconst_traits {
|
||||||
// Basic types
|
// Basic types
|
||||||
typedef typename Alloc::value_type value_type;
|
typedef typename Traits::value_type value_type;
|
||||||
typedef typename boost::allocator_pointer<Alloc>::type pointer;
|
typedef typename Traits::pointer pointer;
|
||||||
typedef value_type& reference;
|
typedef typename Traits::reference reference;
|
||||||
typedef typename boost::allocator_size_type<Alloc>::type size_type;
|
typedef typename Traits::size_type size_type;
|
||||||
typedef typename boost::allocator_difference_type<Alloc>::type difference_type;
|
typedef typename Traits::difference_type difference_type;
|
||||||
|
|
||||||
// Non-const traits
|
// Non-const traits
|
||||||
typedef nonconst_traits<Alloc> nonconst_self;
|
typedef nonconst_traits<Traits> nonconst_self;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -114,7 +110,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
template <class Value, class Alloc>
|
template <class Value, class Alloc>
|
||||||
struct assign_n {
|
struct assign_n {
|
||||||
typedef typename boost::allocator_size_type<Alloc>::type size_type;
|
typedef typename Alloc::size_type size_type;
|
||||||
size_type m_n;
|
size_type m_n;
|
||||||
Value m_item;
|
Value m_item;
|
||||||
Alloc& m_alloc;
|
Alloc& m_alloc;
|
||||||
@@ -131,24 +127,23 @@ private:
|
|||||||
\struct assign_range
|
\struct assign_range
|
||||||
\brief Helper functor for assigning range of items.
|
\brief Helper functor for assigning range of items.
|
||||||
*/
|
*/
|
||||||
template <class Iterator, class Alloc>
|
template <class ValueType, class Iterator>
|
||||||
struct assign_range {
|
struct assign_range {
|
||||||
Iterator m_first;
|
Iterator m_first;
|
||||||
Iterator m_last;
|
Iterator m_last;
|
||||||
Alloc& m_alloc;
|
|
||||||
|
|
||||||
assign_range(const Iterator& first, const Iterator& last, Alloc& alloc)
|
assign_range(const Iterator& first, const Iterator& last) BOOST_NOEXCEPT
|
||||||
: m_first(first), m_last(last), m_alloc(alloc) {}
|
: m_first(first), m_last(last) {}
|
||||||
|
|
||||||
template <class Pointer>
|
template <class Pointer>
|
||||||
void operator () (Pointer p) const {
|
void operator () (Pointer p) const {
|
||||||
boost::cb_details::uninitialized_copy(m_first, m_last, p, m_alloc);
|
boost::cb_details::uninitialized_copy<ValueType>(m_first, m_last, p);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Iterator, class Alloc>
|
template <class ValueType, class Iterator>
|
||||||
inline assign_range<Iterator, Alloc> make_assign_range(const Iterator& first, const Iterator& last, Alloc& a) {
|
inline assign_range<ValueType, Iterator> make_assign_range(const Iterator& first, const Iterator& last) {
|
||||||
return assign_range<Iterator, Alloc>(first, last, a);
|
return assign_range<ValueType, Iterator>(first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -196,33 +191,46 @@ public:
|
|||||||
for iterating from begin() to end() of the circular buffer.
|
for iterating from begin() to end() of the circular buffer.
|
||||||
*/
|
*/
|
||||||
template <class Buff, class Traits>
|
template <class Buff, class Traits>
|
||||||
struct iterator
|
struct iterator :
|
||||||
|
public boost::iterator<
|
||||||
|
std::random_access_iterator_tag,
|
||||||
|
typename Traits::value_type,
|
||||||
|
typename Traits::difference_type,
|
||||||
|
typename Traits::pointer,
|
||||||
|
typename Traits::reference>
|
||||||
#if BOOST_CB_ENABLE_DEBUG
|
#if BOOST_CB_ENABLE_DEBUG
|
||||||
: public debug_iterator_base
|
, public debug_iterator_base
|
||||||
#endif // #if BOOST_CB_ENABLE_DEBUG
|
#endif // #if BOOST_CB_ENABLE_DEBUG
|
||||||
{
|
{
|
||||||
// Helper types
|
// Helper types
|
||||||
|
|
||||||
|
//! Base iterator.
|
||||||
|
typedef boost::iterator<
|
||||||
|
std::random_access_iterator_tag,
|
||||||
|
typename Traits::value_type,
|
||||||
|
typename Traits::difference_type,
|
||||||
|
typename Traits::pointer,
|
||||||
|
typename Traits::reference> base_iterator;
|
||||||
|
|
||||||
//! Non-const iterator.
|
//! Non-const iterator.
|
||||||
typedef iterator<Buff, typename Traits::nonconst_self> nonconst_self;
|
typedef iterator<Buff, typename Traits::nonconst_self> nonconst_self;
|
||||||
|
|
||||||
// Basic types
|
// Basic types
|
||||||
typedef std::random_access_iterator_tag iterator_category;
|
|
||||||
|
|
||||||
//! The type of the elements stored in the circular buffer.
|
//! The type of the elements stored in the circular buffer.
|
||||||
typedef typename Traits::value_type value_type;
|
typedef typename base_iterator::value_type value_type;
|
||||||
|
|
||||||
//! Pointer to the element.
|
//! Pointer to the element.
|
||||||
typedef typename Traits::pointer pointer;
|
typedef typename base_iterator::pointer pointer;
|
||||||
|
|
||||||
//! Reference to the element.
|
//! Reference to the element.
|
||||||
typedef typename Traits::reference reference;
|
typedef typename base_iterator::reference reference;
|
||||||
|
|
||||||
//! Size type.
|
//! Size type.
|
||||||
typedef typename Traits::size_type size_type;
|
typedef typename Traits::size_type size_type;
|
||||||
|
|
||||||
//! Difference type.
|
//! Difference type.
|
||||||
typedef typename Traits::difference_type difference_type;
|
typedef typename base_iterator::difference_type difference_type;
|
||||||
|
|
||||||
// Member variables
|
// Member variables
|
||||||
|
|
||||||
@@ -259,10 +267,7 @@ struct iterator
|
|||||||
#endif // #if BOOST_CB_ENABLE_DEBUG
|
#endif // #if BOOST_CB_ENABLE_DEBUG
|
||||||
|
|
||||||
//! Assign operator.
|
//! Assign operator.
|
||||||
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
|
iterator& operator = (const iterator& it) {
|
||||||
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
|
||||||
@@ -272,7 +277,6 @@ 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
|
||||||
|
|
||||||
@@ -419,47 +423,70 @@ operator + (typename Traits::difference_type n, const iterator<Buff, Traits>& it
|
|||||||
return it + n;
|
return it + n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)
|
||||||
|
|
||||||
|
//! Iterator category.
|
||||||
|
template <class Buff, class Traits>
|
||||||
|
inline std::random_access_iterator_tag iterator_category(const iterator<Buff, Traits>&) {
|
||||||
|
return std::random_access_iterator_tag();
|
||||||
|
}
|
||||||
|
|
||||||
|
//! The type of the elements stored in the circular buffer.
|
||||||
|
template <class Buff, class Traits>
|
||||||
|
inline typename Traits::value_type* value_type(const iterator<Buff, Traits>&) { return 0; }
|
||||||
|
|
||||||
|
//! Distance type.
|
||||||
|
template <class Buff, class Traits>
|
||||||
|
inline typename Traits::difference_type* distance_type(const iterator<Buff, Traits>&) { return 0; }
|
||||||
|
|
||||||
|
#endif // #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest)
|
\fn ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest)
|
||||||
\brief Equivalent of <code>std::uninitialized_copy</code> but with explicit specification of value type.
|
\brief Equivalent of <code>std::uninitialized_copy</code> but with explicit specification of value type.
|
||||||
*/
|
*/
|
||||||
template<class InputIterator, class ForwardIterator, class Alloc>
|
template<class ValueType, class InputIterator, class ForwardIterator>
|
||||||
inline ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a) {
|
inline ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest) {
|
||||||
|
typedef ValueType value_type;
|
||||||
|
|
||||||
|
// We do not use allocator.construct and allocator.destroy
|
||||||
|
// because C++03 requires to take parameter by const reference but
|
||||||
|
// Boost.move requires nonconst reference
|
||||||
ForwardIterator next = dest;
|
ForwardIterator next = dest;
|
||||||
BOOST_TRY {
|
BOOST_TRY {
|
||||||
for (; first != last; ++first, ++dest)
|
for (; first != last; ++first, ++dest)
|
||||||
boost::allocator_construct(a, boost::to_address(dest), *first);
|
::new (dest) value_type(*first);
|
||||||
} BOOST_CATCH(...) {
|
} BOOST_CATCH(...) {
|
||||||
for (; next != dest; ++next)
|
for (; next != dest; ++next)
|
||||||
boost::allocator_destroy(a, boost::to_address(next));
|
next->~value_type();
|
||||||
BOOST_RETHROW
|
BOOST_RETHROW
|
||||||
}
|
}
|
||||||
BOOST_CATCH_END
|
BOOST_CATCH_END
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIterator, class ForwardIterator, class Alloc>
|
template<class ValueType, class InputIterator, class ForwardIterator>
|
||||||
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,
|
||||||
true_type) {
|
true_type) {
|
||||||
for (; first != last; ++first, ++dest)
|
for (; first != last; ++first, ++dest)
|
||||||
boost::allocator_construct(a, boost::to_address(dest), boost::move(*first));
|
::new (dest) ValueType(boost::move(*first));
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIterator, class ForwardIterator, class Alloc>
|
template<class ValueType, class InputIterator, class ForwardIterator>
|
||||||
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,
|
||||||
false_type) {
|
false_type) {
|
||||||
return uninitialized_copy(first, last, dest, a);
|
return uninitialized_copy<ValueType>(first, last, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest)
|
\fn ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest)
|
||||||
\brief Equivalent of <code>std::uninitialized_copy</code> but with explicit specification of value type and moves elements if they have noexcept move constructors.
|
\brief Equivalent of <code>std::uninitialized_copy</code> but with explicit specification of value type and moves elements if they have noexcept move constructors.
|
||||||
*/
|
*/
|
||||||
template<class InputIterator, class ForwardIterator, class Alloc>
|
template<class ValueType, class InputIterator, class ForwardIterator>
|
||||||
ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a) {
|
ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest) {
|
||||||
typedef typename boost::is_nothrow_move_constructible<typename Alloc::value_type>::type tag_t;
|
typedef typename boost::is_nothrow_move_constructible<ValueType>::type tag_t;
|
||||||
return uninitialized_move_if_noexcept_impl(first, last, dest, a, tag_t());
|
return uninitialized_move_if_noexcept_impl<ValueType>(first, last, dest, tag_t());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -471,10 +498,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)
|
||||||
boost::allocator_construct(alloc, boost::to_address(first), item);
|
alloc.construct(first, item);
|
||||||
} BOOST_CATCH(...) {
|
} BOOST_CATCH(...) {
|
||||||
for (; next != first; ++next)
|
for (; next != first; ++next)
|
||||||
boost::allocator_destroy(alloc, boost::to_address(next));
|
alloc.destroy(next);
|
||||||
BOOST_RETHROW
|
BOOST_RETHROW
|
||||||
}
|
}
|
||||||
BOOST_CATCH_END
|
BOOST_CATCH_END
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
#if !defined(BOOST_CIRCULAR_BUFFER_SPACE_OPTIMIZED_HPP)
|
#if !defined(BOOST_CIRCULAR_BUFFER_SPACE_OPTIMIZED_HPP)
|
||||||
#define BOOST_CIRCULAR_BUFFER_SPACE_OPTIMIZED_HPP
|
#define BOOST_CIRCULAR_BUFFER_SPACE_OPTIMIZED_HPP
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/type_traits/is_same.hpp>
|
#include <boost/type_traits/is_same.hpp>
|
||||||
#include <boost/config/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
@@ -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(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
#if BOOST_WORKAROUND(__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
|
||||||
@@ -416,6 +416,31 @@ public:
|
|||||||
: circular_buffer<T, Alloc>(init_capacity(capacity_ctrl, n), n, item, alloc)
|
: circular_buffer<T, Alloc>(init_capacity(capacity_ctrl, n), n, item, alloc)
|
||||||
, m_capacity_ctrl(capacity_ctrl) {}
|
, m_capacity_ctrl(capacity_ctrl) {}
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
|
|
||||||
|
/*! \cond */
|
||||||
|
circular_buffer_space_optimized(const circular_buffer_space_optimized<T, Alloc>& cb)
|
||||||
|
: circular_buffer<T, Alloc>(cb.begin(), cb.end())
|
||||||
|
, m_capacity_ctrl(cb.m_capacity_ctrl) {}
|
||||||
|
|
||||||
|
template <class InputIterator>
|
||||||
|
circular_buffer_space_optimized(InputIterator first, InputIterator last)
|
||||||
|
: circular_buffer<T, Alloc>(first, last)
|
||||||
|
, m_capacity_ctrl(circular_buffer<T, Alloc>::capacity()) {}
|
||||||
|
|
||||||
|
template <class InputIterator>
|
||||||
|
circular_buffer_space_optimized(capacity_type capacity_ctrl, InputIterator first, InputIterator last)
|
||||||
|
: circular_buffer<T, Alloc>(
|
||||||
|
init_capacity(capacity_ctrl, first, last, is_integral<InputIterator>()),
|
||||||
|
first, last)
|
||||||
|
, m_capacity_ctrl(capacity_ctrl) {
|
||||||
|
reduce_capacity(
|
||||||
|
is_same< BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<InputIterator>::type, std::input_iterator_tag >());
|
||||||
|
}
|
||||||
|
/*! \endcond */
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
//! The copy constructor.
|
//! The copy constructor.
|
||||||
/*!
|
/*!
|
||||||
Creates a copy of the specified <code>circular_buffer_space_optimized</code>.
|
Creates a copy of the specified <code>circular_buffer_space_optimized</code>.
|
||||||
@@ -453,7 +478,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
\pre Valid range <code>[first, last)</code>.<br>
|
\pre Valid range <code>[first, last)</code>.<br>
|
||||||
<code>first</code> and <code>last</code> have to meet the requirements of
|
<code>first</code> and <code>last</code> have to meet the requirements of
|
||||||
<a href="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>.
|
<a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
|
||||||
\post <code>capacity().%capacity() == std::distance(first, last) \&\& capacity().min_capacity() == 0 \&\&
|
\post <code>capacity().%capacity() == std::distance(first, last) \&\& capacity().min_capacity() == 0 \&\&
|
||||||
full() \&\& (*this)[0]== *first \&\& (*this)[1] == *(first + 1) \&\& ... \&\&
|
full() \&\& (*this)[0]== *first \&\& (*this)[1] == *(first + 1) \&\& ... \&\&
|
||||||
(*this)[std::distance(first, last) - 1] == *(last - 1)</code><br><br>
|
(*this)[std::distance(first, last) - 1] == *(last - 1)</code><br><br>
|
||||||
@@ -478,7 +503,7 @@ public:
|
|||||||
of allocated memory) filled with a copy of the range.
|
of allocated memory) filled with a copy of the range.
|
||||||
\pre Valid range <code>[first, last)</code>.<br>
|
\pre Valid range <code>[first, last)</code>.<br>
|
||||||
<code>first</code> and <code>last</code> have to meet the requirements of
|
<code>first</code> and <code>last</code> have to meet the requirements of
|
||||||
<a href="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>.
|
<a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
|
||||||
\post <code>capacity() == capacity_ctrl \&\& size() \<= std::distance(first, last) \&\& (*this)[0]==
|
\post <code>capacity() == capacity_ctrl \&\& size() \<= std::distance(first, last) \&\& (*this)[0]==
|
||||||
*(last - capacity_ctrl.%capacity()) \&\& (*this)[1] == *(last - capacity_ctrl.%capacity() + 1) \&\& ...
|
*(last - capacity_ctrl.%capacity()) \&\& (*this)[1] == *(last - capacity_ctrl.%capacity() + 1) \&\& ...
|
||||||
\&\& (*this)[capacity_ctrl.%capacity() - 1] == *(last - 1)</code><br><br>
|
\&\& (*this)[capacity_ctrl.%capacity() - 1] == *(last - 1)</code><br><br>
|
||||||
@@ -499,7 +524,7 @@ public:
|
|||||||
\par Complexity
|
\par Complexity
|
||||||
Linear (in <code>std::distance(first, last)</code>; in
|
Linear (in <code>std::distance(first, last)</code>; in
|
||||||
<code>min[capacity_ctrl.%capacity(), std::distance(first, last)]</code> if the <code>InputIterator</code>
|
<code>min[capacity_ctrl.%capacity(), std::distance(first, last)]</code> if the <code>InputIterator</code>
|
||||||
is a <a href="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
|
is a <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
|
||||||
*/
|
*/
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
circular_buffer_space_optimized(capacity_type capacity_ctrl, InputIterator first, InputIterator last,
|
circular_buffer_space_optimized(capacity_type capacity_ctrl, InputIterator first, InputIterator last,
|
||||||
@@ -509,9 +534,11 @@ public:
|
|||||||
first, last, alloc)
|
first, last, alloc)
|
||||||
, m_capacity_ctrl(capacity_ctrl) {
|
, m_capacity_ctrl(capacity_ctrl) {
|
||||||
reduce_capacity(
|
reduce_capacity(
|
||||||
is_same< BOOST_DEDUCED_TYPENAME std::iterator_traits<InputIterator>::iterator_category, std::input_iterator_tag >());
|
is_same< BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<InputIterator>::type, std::input_iterator_tag >());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
|
|
||||||
#if defined(BOOST_CB_NEVER_DEFINED)
|
#if defined(BOOST_CB_NEVER_DEFINED)
|
||||||
// This section will never be compiled - the default destructor will be generated instead.
|
// This section will never be compiled - the default destructor will be generated instead.
|
||||||
// Declared only for documentation purpose.
|
// Declared only for documentation purpose.
|
||||||
@@ -579,7 +606,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
circular_buffer_space_optimized<T, Alloc>& operator = (circular_buffer_space_optimized<T, Alloc>&& cb) BOOST_NOEXCEPT {
|
circular_buffer_space_optimized<T, Alloc>& operator = (circular_buffer_space_optimized<T, Alloc>&& cb) BOOST_NOEXCEPT {
|
||||||
cb.swap(*this); // now `this` holds `cb`
|
cb.swap(*this); // now `this` holds `cb`
|
||||||
circular_buffer<T, Alloc>(get_allocator()) // temporary that holds initial `cb` allocator
|
circular_buffer<T, Alloc>(get_allocator()) // temprary that holds initial `cb` allocator
|
||||||
.swap(cb); // makes `cb` empty
|
.swap(cb); // makes `cb` empty
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -655,7 +682,7 @@ public:
|
|||||||
elements from the specified range.
|
elements from the specified range.
|
||||||
\pre Valid range <code>[first, last)</code>.<br>
|
\pre Valid range <code>[first, last)</code>.<br>
|
||||||
<code>first</code> and <code>last</code> have to meet the requirements of
|
<code>first</code> and <code>last</code> have to meet the requirements of
|
||||||
<a href="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>.
|
<a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
|
||||||
\post <code>capacity().%capacity() == std::distance(first, last) \&\& capacity().min_capacity() == 0 \&\&
|
\post <code>capacity().%capacity() == std::distance(first, last) \&\& capacity().min_capacity() == 0 \&\&
|
||||||
size() == std::distance(first, last) \&\& (*this)[0]== *first \&\& (*this)[1] == *(first + 1) \&\& ...
|
size() == std::distance(first, last) \&\& (*this)[0]== *first \&\& (*this)[1] == *(first + 1) \&\& ...
|
||||||
\&\& (*this)[std::distance(first, last) - 1] == *(last - 1)</code><br><br>
|
\&\& (*this)[std::distance(first, last) - 1] == *(last - 1)</code><br><br>
|
||||||
@@ -692,7 +719,7 @@ public:
|
|||||||
elements from the specified range.
|
elements from the specified range.
|
||||||
\pre Valid range <code>[first, last)</code>.<br>
|
\pre Valid range <code>[first, last)</code>.<br>
|
||||||
<code>first</code> and <code>last</code> have to meet the requirements of
|
<code>first</code> and <code>last</code> have to meet the requirements of
|
||||||
<a href="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>.
|
<a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
|
||||||
\post <code>capacity() == capacity_ctrl \&\& size() \<= std::distance(first, last) \&\&
|
\post <code>capacity() == capacity_ctrl \&\& size() \<= std::distance(first, last) \&\&
|
||||||
(*this)[0]== *(last - capacity) \&\& (*this)[1] == *(last - capacity + 1) \&\& ... \&\&
|
(*this)[0]== *(last - capacity) \&\& (*this)[1] == *(last - capacity + 1) \&\& ... \&\&
|
||||||
(*this)[capacity - 1] == *(last - 1)</code><br><br>
|
(*this)[capacity - 1] == *(last - 1)</code><br><br>
|
||||||
@@ -715,7 +742,7 @@ public:
|
|||||||
\par Complexity
|
\par Complexity
|
||||||
Linear (in <code>std::distance(first, last)</code>; in
|
Linear (in <code>std::distance(first, last)</code>; in
|
||||||
<code>min[capacity_ctrl.%capacity(), std::distance(first, last)]</code> if the <code>InputIterator</code>
|
<code>min[capacity_ctrl.%capacity(), std::distance(first, last)]</code> if the <code>InputIterator</code>
|
||||||
is a <a href="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
|
is a <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
|
||||||
\sa <code>\link operator=(const circular_buffer_space_optimized&) operator=\endlink</code>,
|
\sa <code>\link operator=(const circular_buffer_space_optimized&) operator=\endlink</code>,
|
||||||
<code>\link assign(size_type, param_value_type) assign(size_type, const_reference)\endlink</code>,
|
<code>\link assign(size_type, param_value_type) assign(size_type, const_reference)\endlink</code>,
|
||||||
<code>\link assign(capacity_type, size_type, param_value_type)
|
<code>\link assign(capacity_type, size_type, param_value_type)
|
||||||
@@ -740,7 +767,7 @@ public:
|
|||||||
\par Iterator Invalidation
|
\par Iterator Invalidation
|
||||||
Invalidates all iterators of both <code>circular_buffer_space_optimized</code> containers. (On the other
|
Invalidates all iterators of both <code>circular_buffer_space_optimized</code> containers. (On the other
|
||||||
hand the iterators still point to the same elements but within another container. If you want to rely on
|
hand the iterators still point to the same elements but within another container. If you want to rely on
|
||||||
this feature you have to turn the __debug_support off,
|
this feature you have to turn the __debug_support off by defining macro BOOST_CB_DISABLE_DEBUG,
|
||||||
otherwise an assertion will report an error if such invalidated iterator is used.)
|
otherwise an assertion will report an error if such invalidated iterator is used.)
|
||||||
\par Complexity
|
\par Complexity
|
||||||
Constant (in the size of the <code>circular_buffer_space_optimized</code>).
|
Constant (in the size of the <code>circular_buffer_space_optimized</code>).
|
||||||
@@ -1114,7 +1141,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
\pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
|
\pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
|
||||||
end.<br>Valid range <code>[first, last)</code> where <code>first</code> and <code>last</code> meet the
|
end.<br>Valid range <code>[first, last)</code> where <code>first</code> and <code>last</code> meet the
|
||||||
requirements of an <a href="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>.
|
requirements of an <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
|
||||||
\post Elements from the range
|
\post Elements from the range
|
||||||
<code>[first + max[0, distance(first, last) - (pos - begin()) - reserve()], last)</code> will be
|
<code>[first + max[0, distance(first, last) - (pos - begin()) - reserve()], last)</code> will be
|
||||||
inserted at the position <code>pos</code>.<br>The number of <code>min[pos - begin(), max[0,
|
inserted at the position <code>pos</code>.<br>The number of <code>min[pos - begin(), max[0,
|
||||||
@@ -1136,7 +1163,7 @@ public:
|
|||||||
Linear (in <code>[size() + std::distance(first, last)]</code>; in
|
Linear (in <code>[size() + std::distance(first, last)]</code>; in
|
||||||
<code>min[capacity().%capacity(), size() + std::distance(first, last)]</code> if the
|
<code>min[capacity().%capacity(), size() + std::distance(first, last)]</code> if the
|
||||||
<code>InputIterator</code> is a
|
<code>InputIterator</code> is a
|
||||||
<a href="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
|
<a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
|
||||||
\par Example
|
\par Example
|
||||||
Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
|
Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
|
||||||
internal buffer may look like the one below.<br><br>
|
internal buffer may look like the one below.<br><br>
|
||||||
@@ -1326,7 +1353,7 @@ public:
|
|||||||
\pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
|
\pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
|
||||||
end.<br>
|
end.<br>
|
||||||
Valid range <code>[first, last)</code> where <code>first</code> and <code>last</code> meet the
|
Valid range <code>[first, last)</code> where <code>first</code> and <code>last</code> meet the
|
||||||
requirements of an <a href="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>.
|
requirements of an <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
|
||||||
\post Elements from the range
|
\post Elements from the range
|
||||||
<code>[first, last - max[0, distance(first, last) - (end() - pos) - reserve()])</code> will be inserted
|
<code>[first, last - max[0, distance(first, last) - (end() - pos) - reserve()])</code> will be inserted
|
||||||
before the position <code>pos</code>.<br>The number of <code>min[end() - pos, max[0,
|
before the position <code>pos</code>.<br>The number of <code>min[end() - pos, max[0,
|
||||||
@@ -1349,7 +1376,7 @@ public:
|
|||||||
Linear (in <code>[size() + std::distance(first, last)]</code>; in
|
Linear (in <code>[size() + std::distance(first, last)]</code>; in
|
||||||
<code>min[capacity().%capacity(), size() + std::distance(first, last)]</code> if the
|
<code>min[capacity().%capacity(), size() + std::distance(first, last)]</code> if the
|
||||||
<code>InputIterator</code> is a
|
<code>InputIterator</code> is a
|
||||||
<a href="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
|
<a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
|
||||||
\par Example
|
\par Example
|
||||||
Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
|
Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
|
||||||
internal buffer may look like the one below.<br><br>
|
internal buffer may look like the one below.<br><br>
|
||||||
@@ -1522,7 +1549,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
// Helper methods
|
// Helper methods
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Adjust the amount of allocated memory.
|
||||||
void adjust_min_capacity() {
|
void adjust_min_capacity() {
|
||||||
if (m_capacity_ctrl.min_capacity() > circular_buffer<T, Alloc>::capacity())
|
if (m_capacity_ctrl.min_capacity() > circular_buffer<T, Alloc>::capacity())
|
||||||
circular_buffer<T, Alloc>::set_capacity(m_capacity_ctrl.min_capacity());
|
circular_buffer<T, Alloc>::set_capacity(m_capacity_ctrl.min_capacity());
|
||||||
@@ -1530,7 +1557,7 @@ private:
|
|||||||
check_high_capacity();
|
check_high_capacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Ensure the reserve for possible growth up.
|
||||||
size_type ensure_reserve(size_type new_capacity, size_type buffer_size) const {
|
size_type ensure_reserve(size_type new_capacity, size_type buffer_size) const {
|
||||||
if (buffer_size + new_capacity / 5 >= new_capacity)
|
if (buffer_size + new_capacity / 5 >= new_capacity)
|
||||||
new_capacity *= 2; // ensure at least 20% reserve
|
new_capacity *= 2; // ensure at least 20% reserve
|
||||||
@@ -1539,7 +1566,10 @@ private:
|
|||||||
return new_capacity;
|
return new_capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Check for low capacity.
|
||||||
|
/*
|
||||||
|
\post If the capacity is low it will be increased.
|
||||||
|
*/
|
||||||
void check_low_capacity(size_type n = 1) {
|
void check_low_capacity(size_type n = 1) {
|
||||||
size_type new_size = size() + n;
|
size_type new_size = size() + n;
|
||||||
size_type new_capacity = circular_buffer<T, Alloc>::capacity();
|
size_type new_capacity = circular_buffer<T, Alloc>::capacity();
|
||||||
@@ -1555,7 +1585,10 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Check for high capacity.
|
||||||
|
/*
|
||||||
|
\post If the capacity is high it will be decreased.
|
||||||
|
*/
|
||||||
void check_high_capacity() {
|
void check_high_capacity() {
|
||||||
size_type new_capacity = circular_buffer<T, Alloc>::capacity();
|
size_type new_capacity = circular_buffer<T, Alloc>::capacity();
|
||||||
while (new_capacity / 3 >= size()) { // (new_capacity / 3) -> avoid oscillations
|
while (new_capacity / 3 >= size()) { // (new_capacity / 3) -> avoid oscillations
|
||||||
@@ -1572,48 +1605,48 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Specialized method for reducing the capacity.
|
||||||
void reduce_capacity(const true_type&) {
|
void reduce_capacity(const true_type&) {
|
||||||
circular_buffer<T, Alloc>::set_capacity((std::max)(m_capacity_ctrl.min_capacity(), size()));
|
circular_buffer<T, Alloc>::set_capacity((std::max)(m_capacity_ctrl.min_capacity(), size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Specialized method for reducing the capacity.
|
||||||
void reduce_capacity(const false_type&) {}
|
void reduce_capacity(const false_type&) {}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Determine the initial capacity.
|
||||||
static size_type init_capacity(const capacity_type& capacity_ctrl, size_type n) {
|
static size_type init_capacity(const capacity_type& capacity_ctrl, size_type n) {
|
||||||
BOOST_CB_ASSERT(capacity_ctrl.capacity() >= n); // check for capacity lower than n
|
BOOST_CB_ASSERT(capacity_ctrl.capacity() >= n); // check for capacity lower than n
|
||||||
return (std::max)(capacity_ctrl.min_capacity(), n);
|
return (std::max)(capacity_ctrl.min_capacity(), n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Specialized method for determining the initial capacity.
|
||||||
template <class IntegralType>
|
template <class IntegralType>
|
||||||
static size_type init_capacity(const capacity_type& capacity_ctrl, IntegralType n, IntegralType,
|
static size_type init_capacity(const capacity_type& capacity_ctrl, IntegralType n, IntegralType,
|
||||||
const true_type&) {
|
const true_type&) {
|
||||||
return init_capacity(capacity_ctrl, static_cast<size_type>(n));
|
return init_capacity(capacity_ctrl, static_cast<size_type>(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Specialized method for determining the initial capacity.
|
||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
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(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(__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, BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||||
#else
|
#else
|
||||||
return init_capacity(
|
return init_capacity(
|
||||||
capacity_ctrl, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
|
capacity_ctrl, first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Specialized method for determining the initial capacity.
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
static size_type init_capacity(const capacity_type& capacity_ctrl, InputIterator, InputIterator,
|
static size_type init_capacity(const capacity_type& capacity_ctrl, InputIterator, InputIterator,
|
||||||
const std::input_iterator_tag&) {
|
const std::input_iterator_tag&) {
|
||||||
return capacity_ctrl.capacity();
|
return capacity_ctrl.capacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Specialized method for determining the initial capacity.
|
||||||
template <class ForwardIterator>
|
template <class ForwardIterator>
|
||||||
static size_type init_capacity(const capacity_type& capacity_ctrl, ForwardIterator first, ForwardIterator last,
|
static size_type init_capacity(const capacity_type& capacity_ctrl, ForwardIterator first, ForwardIterator last,
|
||||||
const std::forward_iterator_tag&) {
|
const std::forward_iterator_tag&) {
|
||||||
@@ -1622,13 +1655,13 @@ private:
|
|||||||
(std::min)(capacity_ctrl.capacity(), static_cast<size_type>(std::distance(first, last))));
|
(std::min)(capacity_ctrl.capacity(), static_cast<size_type>(std::distance(first, last))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Specialized insert method.
|
||||||
template <class IntegralType>
|
template <class IntegralType>
|
||||||
void insert(const iterator& pos, IntegralType n, IntegralType item, const true_type&) {
|
void insert(const iterator& pos, IntegralType n, IntegralType item, const true_type&) {
|
||||||
insert(pos, static_cast<size_type>(n), static_cast<value_type>(item));
|
insert(pos, static_cast<size_type>(n), static_cast<value_type>(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Specialized insert method.
|
||||||
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&) {
|
||||||
size_type index = pos - begin();
|
size_type index = pos - begin();
|
||||||
@@ -1636,13 +1669,13 @@ private:
|
|||||||
circular_buffer<T, Alloc>::insert(begin() + index, first, last);
|
circular_buffer<T, Alloc>::insert(begin() + index, first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Specialized rinsert method.
|
||||||
template <class IntegralType>
|
template <class IntegralType>
|
||||||
void rinsert(const iterator& pos, IntegralType n, IntegralType item, const true_type&) {
|
void rinsert(const iterator& pos, IntegralType n, IntegralType item, const true_type&) {
|
||||||
rinsert(pos, static_cast<size_type>(n), static_cast<value_type>(item));
|
rinsert(pos, static_cast<size_type>(n), static_cast<value_type>(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! INTERNAL ONLY */
|
//! Specialized rinsert method.
|
||||||
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&) {
|
||||||
size_type index = pos - begin();
|
size_type index = pos - begin();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#if !defined(BOOST_CIRCULAR_BUFFER_FWD_HPP)
|
#if !defined(BOOST_CIRCULAR_BUFFER_FWD_HPP)
|
||||||
#define BOOST_CIRCULAR_BUFFER_FWD_HPP
|
#define BOOST_CIRCULAR_BUFFER_FWD_HPP
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"key": "circular_buffer",
|
|
||||||
"name": "Circular Buffer",
|
|
||||||
"authors": [
|
|
||||||
"Jan Gaspar"
|
|
||||||
],
|
|
||||||
"description": "A STL compliant container also known as ring or cyclic buffer.",
|
|
||||||
"category": [
|
|
||||||
"Containers"
|
|
||||||
],
|
|
||||||
"maintainers": [
|
|
||||||
"Jan Gaspar <jano_gaspar -at- yahoo.com>"
|
|
||||||
],
|
|
||||||
"cxxstd": "03"
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
# 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()
|
|
||||||
@@ -6,25 +6,25 @@
|
|||||||
# accompanying file LICENSE_1_0.txt or copy at
|
# accompanying file LICENSE_1_0.txt or copy at
|
||||||
# http://www.boost.org/LICENSE_1_0.txt)
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
# Added warning suppression Paul A. Bristow 25 Nov 2008
|
# Added warning supression Paul A. Bristow 25 Nov 2008
|
||||||
|
|
||||||
# Bring in rules for testing.
|
# Bring in rules for testing.
|
||||||
import testing ;
|
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
|
||||||
;
|
;
|
||||||
|
|
||||||
run base_test.cpp ;
|
test-suite "circular_buffer"
|
||||||
run space_optimized_test.cpp ;
|
: [ run base_test.cpp : <threading>single : ]
|
||||||
run base_test.cpp : : : <define>"BOOST_CB_ENABLE_DEBUG=1" : base_test_dbg ;
|
[ run space_optimized_test.cpp : <threading>single : ]
|
||||||
run space_optimized_test.cpp : : : <define>"BOOST_CB_ENABLE_DEBUG=1" : space_optimized_test_dbg ;
|
[ run soft_iterator_invalidation.cpp : <threading>single : ]
|
||||||
run soft_iterator_invalidation.cpp ;
|
[ run constant_erase_test.cpp : <threading>single : ]
|
||||||
run constant_erase_test.cpp ;
|
[ compile bounded_buffer_comparison.cpp : <threading>multi : ]
|
||||||
compile bounded_buffer_comparison.cpp : <threading>multi <library>/boost/thread//boost_thread <library>/boost/timer//boost_timer ;
|
;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -7,12 +7,14 @@
|
|||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#define BOOST_CB_DISABLE_DEBUG
|
||||||
|
|
||||||
#include <boost/circular_buffer.hpp>
|
#include <boost/circular_buffer.hpp>
|
||||||
#include <boost/thread/mutex.hpp>
|
#include <boost/thread/mutex.hpp>
|
||||||
#include <boost/thread/condition_variable.hpp>
|
#include <boost/thread/condition_variable.hpp>
|
||||||
#include <boost/thread/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
#include <boost/timer/timer.hpp>
|
|
||||||
#include <boost/call_traits.hpp>
|
#include <boost/call_traits.hpp>
|
||||||
|
#include <boost/progress.hpp>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <list>
|
#include <list>
|
||||||
@@ -229,11 +231,11 @@ template<class Buffer>
|
|||||||
void fifo_test(Buffer* buffer) {
|
void fifo_test(Buffer* buffer) {
|
||||||
|
|
||||||
// Start of measurement
|
// Start of measurement
|
||||||
boost::timer::auto_cpu_timer progress;
|
boost::progress_timer progress;
|
||||||
|
|
||||||
// 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(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
#if BOOST_WORKAROUND(__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());
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
# 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>)
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// 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;
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
# 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>)
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// 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;
|
|
||||||
}
|
|
||||||
1842
test/common.ipp
1842
test/common.ipp
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,8 @@
|
|||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#define BOOST_CB_DISABLE_DEBUG
|
||||||
|
|
||||||
#include "test.hpp"
|
#include "test.hpp"
|
||||||
|
|
||||||
int MyInteger::ms_exception_trigger = 0;
|
int MyInteger::ms_exception_trigger = 0;
|
||||||
@@ -25,35 +27,35 @@ void erase_begin_test() {
|
|||||||
|
|
||||||
cb1.erase_begin(2);
|
cb1.erase_begin(2);
|
||||||
|
|
||||||
BOOST_TEST(cb1.size() == 3);
|
BOOST_CHECK(cb1.size() == 3);
|
||||||
BOOST_TEST(cb1[0] == 4);
|
BOOST_CHECK(cb1[0] == 4);
|
||||||
BOOST_TEST(cb1[1] == 5);
|
BOOST_CHECK(cb1[1] == 5);
|
||||||
BOOST_TEST(cb1[2] == 6);
|
BOOST_CHECK(cb1[2] == 6);
|
||||||
|
|
||||||
cb1.erase_begin(3);
|
cb1.erase_begin(3);
|
||||||
BOOST_TEST(cb1.empty());
|
BOOST_CHECK(cb1.empty());
|
||||||
BOOST_TEST(*p == 2);
|
BOOST_CHECK(*p == 2);
|
||||||
BOOST_TEST(*(p + 1) == 3);
|
BOOST_CHECK(*(p + 1) == 3);
|
||||||
BOOST_TEST(*(p + 2) == 4);
|
BOOST_CHECK(*(p + 2) == 4);
|
||||||
|
|
||||||
cb1.push_back(10);
|
cb1.push_back(10);
|
||||||
cb1.push_back(11);
|
cb1.push_back(11);
|
||||||
cb1.push_back(12);
|
cb1.push_back(12);
|
||||||
|
|
||||||
BOOST_TEST(cb1.size() == 3);
|
BOOST_CHECK(cb1.size() == 3);
|
||||||
BOOST_TEST(cb1[0] == 10);
|
BOOST_CHECK(cb1[0] == 10);
|
||||||
BOOST_TEST(cb1[1] == 11);
|
BOOST_CHECK(cb1[1] == 11);
|
||||||
BOOST_TEST(cb1[2] == 12);
|
BOOST_CHECK(cb1[2] == 12);
|
||||||
|
|
||||||
circular_buffer<InstanceCounter> cb2(5, InstanceCounter());
|
circular_buffer<InstanceCounter> cb2(5, InstanceCounter());
|
||||||
|
|
||||||
BOOST_TEST(cb2.size() == 5);
|
BOOST_CHECK(cb2.size() == 5);
|
||||||
BOOST_TEST(InstanceCounter::count() == 5);
|
BOOST_CHECK(InstanceCounter::count() == 5);
|
||||||
|
|
||||||
cb2.erase_begin(2);
|
cb2.erase_begin(2);
|
||||||
|
|
||||||
BOOST_TEST(cb2.size() == 3);
|
BOOST_CHECK(cb2.size() == 3);
|
||||||
BOOST_TEST(InstanceCounter::count() == 3);
|
BOOST_CHECK(InstanceCounter::count() == 3);
|
||||||
|
|
||||||
circular_buffer<MyInteger> cb3(5);
|
circular_buffer<MyInteger> cb3(5);
|
||||||
cb3.push_back(1);
|
cb3.push_back(1);
|
||||||
@@ -64,10 +66,10 @@ void erase_begin_test() {
|
|||||||
cb3.push_back(6);
|
cb3.push_back(6);
|
||||||
cb3.erase_begin(2);
|
cb3.erase_begin(2);
|
||||||
|
|
||||||
BOOST_TEST(cb3.size() == 3);
|
BOOST_CHECK(cb3.size() == 3);
|
||||||
BOOST_TEST(cb3[0] == 4);
|
BOOST_CHECK(cb3[0] == 4);
|
||||||
BOOST_TEST(cb3[1] == 5);
|
BOOST_CHECK(cb3[1] == 5);
|
||||||
BOOST_TEST(cb3[2] == 6);
|
BOOST_CHECK(cb3[2] == 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void erase_end_test() {
|
void erase_end_test() {
|
||||||
@@ -84,35 +86,35 @@ void erase_end_test() {
|
|||||||
|
|
||||||
cb1.erase_end(2);
|
cb1.erase_end(2);
|
||||||
|
|
||||||
BOOST_TEST(cb1.size() == 3);
|
BOOST_CHECK(cb1.size() == 3);
|
||||||
BOOST_TEST(cb1[0] == 2);
|
BOOST_CHECK(cb1[0] == 2);
|
||||||
BOOST_TEST(cb1[1] == 3);
|
BOOST_CHECK(cb1[1] == 3);
|
||||||
BOOST_TEST(cb1[2] ==4);
|
BOOST_CHECK(cb1[2] ==4);
|
||||||
|
|
||||||
cb1.erase_end(3);
|
cb1.erase_end(3);
|
||||||
BOOST_TEST(cb1.empty());
|
BOOST_CHECK(cb1.empty());
|
||||||
BOOST_TEST(*p == 5);
|
BOOST_CHECK(*p == 5);
|
||||||
BOOST_TEST(*(p - 1) == 4);
|
BOOST_CHECK(*(p - 1) == 4);
|
||||||
BOOST_TEST(*(p - 2) == 3);
|
BOOST_CHECK(*(p - 2) == 3);
|
||||||
|
|
||||||
cb1.push_back(10);
|
cb1.push_back(10);
|
||||||
cb1.push_back(11);
|
cb1.push_back(11);
|
||||||
cb1.push_back(12);
|
cb1.push_back(12);
|
||||||
|
|
||||||
BOOST_TEST(cb1.size() == 3);
|
BOOST_CHECK(cb1.size() == 3);
|
||||||
BOOST_TEST(cb1[0] == 10);
|
BOOST_CHECK(cb1[0] == 10);
|
||||||
BOOST_TEST(cb1[1] == 11);
|
BOOST_CHECK(cb1[1] == 11);
|
||||||
BOOST_TEST(cb1[2] == 12);
|
BOOST_CHECK(cb1[2] == 12);
|
||||||
|
|
||||||
circular_buffer<InstanceCounter> cb2(5, InstanceCounter());
|
circular_buffer<InstanceCounter> cb2(5, InstanceCounter());
|
||||||
|
|
||||||
BOOST_TEST(cb2.size() == 5);
|
BOOST_CHECK(cb2.size() == 5);
|
||||||
BOOST_TEST(InstanceCounter::count() == 5);
|
BOOST_CHECK(InstanceCounter::count() == 5);
|
||||||
|
|
||||||
cb2.erase_end(2);
|
cb2.erase_end(2);
|
||||||
|
|
||||||
BOOST_TEST(cb2.size() == 3);
|
BOOST_CHECK(cb2.size() == 3);
|
||||||
BOOST_TEST(InstanceCounter::count() == 3);
|
BOOST_CHECK(InstanceCounter::count() == 3);
|
||||||
|
|
||||||
circular_buffer<MyInteger> cb3(5);
|
circular_buffer<MyInteger> cb3(5);
|
||||||
cb3.push_back(1);
|
cb3.push_back(1);
|
||||||
@@ -123,10 +125,10 @@ void erase_end_test() {
|
|||||||
cb3.push_back(6);
|
cb3.push_back(6);
|
||||||
cb3.erase_end(2);
|
cb3.erase_end(2);
|
||||||
|
|
||||||
BOOST_TEST(cb3.size() == 3);
|
BOOST_CHECK(cb3.size() == 3);
|
||||||
BOOST_TEST(cb3[0] == 2);
|
BOOST_CHECK(cb3[0] == 2);
|
||||||
BOOST_TEST(cb3[1] == 3);
|
BOOST_CHECK(cb3[1] == 3);
|
||||||
BOOST_TEST(cb3[2] == 4);
|
BOOST_CHECK(cb3[2] == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_test() {
|
void clear_test() {
|
||||||
@@ -143,22 +145,22 @@ void clear_test() {
|
|||||||
|
|
||||||
cb1.clear();
|
cb1.clear();
|
||||||
|
|
||||||
BOOST_TEST(cb1.empty());
|
BOOST_CHECK(cb1.empty());
|
||||||
BOOST_TEST(*p == 2);
|
BOOST_CHECK(*p == 2);
|
||||||
BOOST_TEST(*(p + 1) == 3);
|
BOOST_CHECK(*(p + 1) == 3);
|
||||||
BOOST_TEST(*(p + 2) == 4);
|
BOOST_CHECK(*(p + 2) == 4);
|
||||||
BOOST_TEST(*(p + 3) == 5);
|
BOOST_CHECK(*(p + 3) == 5);
|
||||||
BOOST_TEST(*(p - 1) == 6);
|
BOOST_CHECK(*(p - 1) == 6);
|
||||||
|
|
||||||
circular_buffer<InstanceCounter> cb2(5, InstanceCounter());
|
circular_buffer<InstanceCounter> cb2(5, InstanceCounter());
|
||||||
|
|
||||||
BOOST_TEST(cb2.size() == 5);
|
BOOST_CHECK(cb2.size() == 5);
|
||||||
BOOST_TEST(InstanceCounter::count() == 5);
|
BOOST_CHECK(InstanceCounter::count() == 5);
|
||||||
|
|
||||||
cb2.clear();
|
cb2.clear();
|
||||||
|
|
||||||
BOOST_TEST(cb2.empty());
|
BOOST_CHECK(cb2.empty());
|
||||||
BOOST_TEST(InstanceCounter::count() == 0);
|
BOOST_CHECK(InstanceCounter::count() == 0);
|
||||||
|
|
||||||
circular_buffer<MyInteger> cb3(5);
|
circular_buffer<MyInteger> cb3(5);
|
||||||
cb3.push_back(1);
|
cb3.push_back(1);
|
||||||
@@ -169,14 +171,17 @@ void clear_test() {
|
|||||||
cb3.push_back(6);
|
cb3.push_back(6);
|
||||||
cb3.clear();
|
cb3.clear();
|
||||||
|
|
||||||
BOOST_TEST(cb3.empty());
|
BOOST_CHECK(cb3.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
// test main
|
// test main
|
||||||
int main()
|
test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) {
|
||||||
{
|
|
||||||
erase_begin_test();
|
test_suite* tests = BOOST_TEST_SUITE("Unit tests for erase_begin/end and clear methods of the circular_buffer.");
|
||||||
erase_end_test();
|
|
||||||
clear_test();
|
tests->add(BOOST_TEST_CASE(&erase_begin_test));
|
||||||
return boost::report_errors();
|
tests->add(BOOST_TEST_CASE(&erase_end_test));
|
||||||
|
tests->add(BOOST_TEST_CASE(&clear_test));
|
||||||
|
|
||||||
|
return tests;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#define BOOST_CB_DISABLE_DEBUG
|
||||||
|
|
||||||
#include "test.hpp"
|
#include "test.hpp"
|
||||||
|
|
||||||
// test of the example (introduced in the documentation)
|
// test of the example (introduced in the documentation)
|
||||||
@@ -22,11 +24,11 @@ void validity_example_test() {
|
|||||||
|
|
||||||
circular_buffer<int>::iterator it = cb.begin();
|
circular_buffer<int>::iterator it = cb.begin();
|
||||||
|
|
||||||
BOOST_TEST(*it == 1);
|
BOOST_CHECK(*it == 1);
|
||||||
|
|
||||||
cb.push_back(4);
|
cb.push_back(4);
|
||||||
|
|
||||||
BOOST_TEST(*it == 4);
|
BOOST_CHECK(*it == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_insert_test() {
|
void validity_insert_test() {
|
||||||
@@ -46,13 +48,13 @@ void validity_insert_test() {
|
|||||||
|
|
||||||
// memory placement: { 1, 4, 2, 3 }
|
// memory placement: { 1, 4, 2, 3 }
|
||||||
// circular buffer: { 1, 4, 2, 3 }
|
// circular buffer: { 1, 4, 2, 3 }
|
||||||
BOOST_TEST(*it1 == 1);
|
BOOST_CHECK(*it1 == 1);
|
||||||
BOOST_TEST(*it2 == 4);
|
BOOST_CHECK(*it2 == 4);
|
||||||
BOOST_TEST(*it3 == 2);
|
BOOST_CHECK(*it3 == 2);
|
||||||
BOOST_TEST(cb[0] == 1);
|
BOOST_CHECK(cb[0] == 1);
|
||||||
BOOST_TEST(cb[1] == 4);
|
BOOST_CHECK(cb[1] == 4);
|
||||||
BOOST_TEST(cb[2] == 2);
|
BOOST_CHECK(cb[2] == 2);
|
||||||
BOOST_TEST(cb[3] == 3);
|
BOOST_CHECK(cb[3] == 3);
|
||||||
|
|
||||||
// it4 -> 3
|
// it4 -> 3
|
||||||
circular_buffer<int>::iterator it4 = it1 + 3;
|
circular_buffer<int>::iterator it4 = it1 + 3;
|
||||||
@@ -61,14 +63,14 @@ void validity_insert_test() {
|
|||||||
|
|
||||||
// memory placement: { 3, 5, 4, 2 }
|
// memory placement: { 3, 5, 4, 2 }
|
||||||
// circular buffer: { 5, 4, 2, 3 }
|
// circular buffer: { 5, 4, 2, 3 }
|
||||||
BOOST_TEST(*it1 == 3);
|
BOOST_CHECK(*it1 == 3);
|
||||||
BOOST_TEST(*it2 == 5);
|
BOOST_CHECK(*it2 == 5);
|
||||||
BOOST_TEST(*it3 == 4);
|
BOOST_CHECK(*it3 == 4);
|
||||||
BOOST_TEST(*it4 == 2);
|
BOOST_CHECK(*it4 == 2);
|
||||||
BOOST_TEST(cb[0] == 5);
|
BOOST_CHECK(cb[0] == 5);
|
||||||
BOOST_TEST(cb[1] == 4);
|
BOOST_CHECK(cb[1] == 4);
|
||||||
BOOST_TEST(cb[2] == 2);
|
BOOST_CHECK(cb[2] == 2);
|
||||||
BOOST_TEST(cb[3] == 3);
|
BOOST_CHECK(cb[3] == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_insert_n_test() {
|
void validity_insert_n_test() {
|
||||||
@@ -89,14 +91,14 @@ void validity_insert_n_test() {
|
|||||||
|
|
||||||
// memory placement: { 1, 4, 4, 2, 3 }
|
// memory placement: { 1, 4, 4, 2, 3 }
|
||||||
// circular buffer: { 1, 4, 4, 2, 3 }
|
// circular buffer: { 1, 4, 4, 2, 3 }
|
||||||
BOOST_TEST(*it1 == 1);
|
BOOST_CHECK(*it1 == 1);
|
||||||
BOOST_TEST(*it2 == 4);
|
BOOST_CHECK(*it2 == 4);
|
||||||
BOOST_TEST(*it3 == 4);
|
BOOST_CHECK(*it3 == 4);
|
||||||
BOOST_TEST(cb[0] == 1);
|
BOOST_CHECK(cb[0] == 1);
|
||||||
BOOST_TEST(cb[1] == 4);
|
BOOST_CHECK(cb[1] == 4);
|
||||||
BOOST_TEST(cb[2] == 4);
|
BOOST_CHECK(cb[2] == 4);
|
||||||
BOOST_TEST(cb[3] == 2);
|
BOOST_CHECK(cb[3] == 2);
|
||||||
BOOST_TEST(cb[4] == 3);
|
BOOST_CHECK(cb[4] == 3);
|
||||||
|
|
||||||
// it4 -> 2, it5 -> 3
|
// it4 -> 2, it5 -> 3
|
||||||
circular_buffer<int>::iterator it4 = it1 + 3;
|
circular_buffer<int>::iterator it4 = it1 + 3;
|
||||||
@@ -106,16 +108,16 @@ void validity_insert_n_test() {
|
|||||||
|
|
||||||
// memory placement: { 3, 5, 4, 4, 2 } - 5 inserted only once
|
// memory placement: { 3, 5, 4, 4, 2 } - 5 inserted only once
|
||||||
// circular buffer: { 5, 4, 4, 2, 3 }
|
// circular buffer: { 5, 4, 4, 2, 3 }
|
||||||
BOOST_TEST(*it1 == 3);
|
BOOST_CHECK(*it1 == 3);
|
||||||
BOOST_TEST(*it2 == 5);
|
BOOST_CHECK(*it2 == 5);
|
||||||
BOOST_TEST(*it3 == 4);
|
BOOST_CHECK(*it3 == 4);
|
||||||
BOOST_TEST(*it4 == 4);
|
BOOST_CHECK(*it4 == 4);
|
||||||
BOOST_TEST(*it5 == 2);
|
BOOST_CHECK(*it5 == 2);
|
||||||
BOOST_TEST(cb[0] == 5);
|
BOOST_CHECK(cb[0] == 5);
|
||||||
BOOST_TEST(cb[1] == 4);
|
BOOST_CHECK(cb[1] == 4);
|
||||||
BOOST_TEST(cb[2] == 4);
|
BOOST_CHECK(cb[2] == 4);
|
||||||
BOOST_TEST(cb[3] == 2);
|
BOOST_CHECK(cb[3] == 2);
|
||||||
BOOST_TEST(cb[4] == 3);
|
BOOST_CHECK(cb[4] == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_insert_range_test() {
|
void validity_insert_range_test() {
|
||||||
@@ -145,14 +147,14 @@ void validity_insert_range_test() {
|
|||||||
|
|
||||||
// memory placement: { 1, 4, 5, 2, 3 }
|
// memory placement: { 1, 4, 5, 2, 3 }
|
||||||
// circular buffer: { 1, 4, 5, 2, 3 }
|
// circular buffer: { 1, 4, 5, 2, 3 }
|
||||||
BOOST_TEST(*it11 == 1);
|
BOOST_CHECK(*it11 == 1);
|
||||||
BOOST_TEST(*it12 == 4);
|
BOOST_CHECK(*it12 == 4);
|
||||||
BOOST_TEST(*it13 == 5);
|
BOOST_CHECK(*it13 == 5);
|
||||||
BOOST_TEST(cb1[0] == 1);
|
BOOST_CHECK(cb1[0] == 1);
|
||||||
BOOST_TEST(cb1[1] == 4);
|
BOOST_CHECK(cb1[1] == 4);
|
||||||
BOOST_TEST(cb1[2] == 5);
|
BOOST_CHECK(cb1[2] == 5);
|
||||||
BOOST_TEST(cb1[3] == 2);
|
BOOST_CHECK(cb1[3] == 2);
|
||||||
BOOST_TEST(cb1[4] == 3);
|
BOOST_CHECK(cb1[4] == 3);
|
||||||
|
|
||||||
// it14 -> 2, it15 -> 3
|
// it14 -> 2, it15 -> 3
|
||||||
circular_buffer<int>::iterator it14 = it11 + 3;
|
circular_buffer<int>::iterator it14 = it11 + 3;
|
||||||
@@ -162,16 +164,16 @@ void validity_insert_range_test() {
|
|||||||
|
|
||||||
// memory placement: { 3, 7, 4, 5, 2 } - 7 inserted only
|
// memory placement: { 3, 7, 4, 5, 2 } - 7 inserted only
|
||||||
// circular buffer: { 7, 4, 5, 2, 3 }
|
// circular buffer: { 7, 4, 5, 2, 3 }
|
||||||
BOOST_TEST(*it11 == 3);
|
BOOST_CHECK(*it11 == 3);
|
||||||
BOOST_TEST(*it12 == 7);
|
BOOST_CHECK(*it12 == 7);
|
||||||
BOOST_TEST(*it13 == 4);
|
BOOST_CHECK(*it13 == 4);
|
||||||
BOOST_TEST(*it14 == 5);
|
BOOST_CHECK(*it14 == 5);
|
||||||
BOOST_TEST(*it15 == 2);
|
BOOST_CHECK(*it15 == 2);
|
||||||
BOOST_TEST(cb1[0] == 7);
|
BOOST_CHECK(cb1[0] == 7);
|
||||||
BOOST_TEST(cb1[1] == 4);
|
BOOST_CHECK(cb1[1] == 4);
|
||||||
BOOST_TEST(cb1[2] == 5);
|
BOOST_CHECK(cb1[2] == 5);
|
||||||
BOOST_TEST(cb1[3] == 2);
|
BOOST_CHECK(cb1[3] == 2);
|
||||||
BOOST_TEST(cb1[4] == 3);
|
BOOST_CHECK(cb1[4] == 3);
|
||||||
|
|
||||||
// memory placement: { 1, 2, 3 }
|
// memory placement: { 1, 2, 3 }
|
||||||
// circular buffer: { 1, 2, 3 }
|
// circular buffer: { 1, 2, 3 }
|
||||||
@@ -189,14 +191,14 @@ void validity_insert_range_test() {
|
|||||||
|
|
||||||
// memory placement: { 1, 4, 5, 2, 3 }
|
// memory placement: { 1, 4, 5, 2, 3 }
|
||||||
// circular buffer: { 1, 4, 5, 2, 3 }
|
// circular buffer: { 1, 4, 5, 2, 3 }
|
||||||
BOOST_TEST(*it21 == 1);
|
BOOST_CHECK(*it21 == 1);
|
||||||
BOOST_TEST(*it22 == 4);
|
BOOST_CHECK(*it22 == 4);
|
||||||
BOOST_TEST(*it23 == 5);
|
BOOST_CHECK(*it23 == 5);
|
||||||
BOOST_TEST(cb2[0] == 1);
|
BOOST_CHECK(cb2[0] == 1);
|
||||||
BOOST_TEST(cb2[1] == 4);
|
BOOST_CHECK(cb2[1] == 4);
|
||||||
BOOST_TEST(cb2[2] == 5);
|
BOOST_CHECK(cb2[2] == 5);
|
||||||
BOOST_TEST(cb2[3] == 2);
|
BOOST_CHECK(cb2[3] == 2);
|
||||||
BOOST_TEST(cb2[4] == 3);
|
BOOST_CHECK(cb2[4] == 3);
|
||||||
|
|
||||||
// it24 -> 2, it25 -> 3
|
// it24 -> 2, it25 -> 3
|
||||||
circular_buffer<int>::iterator it24 = it21 + 3;
|
circular_buffer<int>::iterator it24 = it21 + 3;
|
||||||
@@ -206,16 +208,16 @@ void validity_insert_range_test() {
|
|||||||
|
|
||||||
// memory placement: { 2, 3, 7, 4, 5 } - using input iterator inserts all items even if they are later replaced
|
// memory placement: { 2, 3, 7, 4, 5 } - using input iterator inserts all items even if they are later replaced
|
||||||
// circular buffer: { 7, 4, 5, 2, 3 }
|
// circular buffer: { 7, 4, 5, 2, 3 }
|
||||||
BOOST_TEST(*it21 == 2);
|
BOOST_CHECK(*it21 == 2);
|
||||||
BOOST_TEST(*it22 == 3);
|
BOOST_CHECK(*it22 == 3);
|
||||||
BOOST_TEST(*it23 == 7);
|
BOOST_CHECK(*it23 == 7);
|
||||||
BOOST_TEST(*it24 == 4);
|
BOOST_CHECK(*it24 == 4);
|
||||||
BOOST_TEST(*it25 == 5);
|
BOOST_CHECK(*it25 == 5);
|
||||||
BOOST_TEST(cb2[0] == 7);
|
BOOST_CHECK(cb2[0] == 7);
|
||||||
BOOST_TEST(cb2[1] == 4);
|
BOOST_CHECK(cb2[1] == 4);
|
||||||
BOOST_TEST(cb2[2] == 5);
|
BOOST_CHECK(cb2[2] == 5);
|
||||||
BOOST_TEST(cb2[3] == 2);
|
BOOST_CHECK(cb2[3] == 2);
|
||||||
BOOST_TEST(cb2[4] == 3);
|
BOOST_CHECK(cb2[4] == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_rinsert_test() {
|
void validity_rinsert_test() {
|
||||||
@@ -235,13 +237,13 @@ void validity_rinsert_test() {
|
|||||||
|
|
||||||
// memory placement: { 2, 4, 3, 1 }
|
// memory placement: { 2, 4, 3, 1 }
|
||||||
// circular buffer: { 1, 2, 4, 3 }
|
// circular buffer: { 1, 2, 4, 3 }
|
||||||
BOOST_TEST(*it1 == 2);
|
BOOST_CHECK(*it1 == 2);
|
||||||
BOOST_TEST(*it2 == 4);
|
BOOST_CHECK(*it2 == 4);
|
||||||
BOOST_TEST(*it3 == 3);
|
BOOST_CHECK(*it3 == 3);
|
||||||
BOOST_TEST(cb[0] == 1);
|
BOOST_CHECK(cb[0] == 1);
|
||||||
BOOST_TEST(cb[1] == 2);
|
BOOST_CHECK(cb[1] == 2);
|
||||||
BOOST_TEST(cb[2] == 4);
|
BOOST_CHECK(cb[2] == 4);
|
||||||
BOOST_TEST(cb[3] == 3);
|
BOOST_CHECK(cb[3] == 3);
|
||||||
|
|
||||||
// it4 -> 1
|
// it4 -> 1
|
||||||
circular_buffer<int>::iterator it4 = it1 - 1;
|
circular_buffer<int>::iterator it4 = it1 - 1;
|
||||||
@@ -250,14 +252,14 @@ void validity_rinsert_test() {
|
|||||||
|
|
||||||
// memory placement: { 5, 4, 1, 2 }
|
// memory placement: { 5, 4, 1, 2 }
|
||||||
// circular buffer: { 1, 2, 5, 4 }
|
// circular buffer: { 1, 2, 5, 4 }
|
||||||
BOOST_TEST(*it1 == 5);
|
BOOST_CHECK(*it1 == 5);
|
||||||
BOOST_TEST(*it2 == 4);
|
BOOST_CHECK(*it2 == 4);
|
||||||
BOOST_TEST(*it3 == 1);
|
BOOST_CHECK(*it3 == 1);
|
||||||
BOOST_TEST(*it4 == 2);
|
BOOST_CHECK(*it4 == 2);
|
||||||
BOOST_TEST(cb[0] == 1);
|
BOOST_CHECK(cb[0] == 1);
|
||||||
BOOST_TEST(cb[1] == 2);
|
BOOST_CHECK(cb[1] == 2);
|
||||||
BOOST_TEST(cb[2] == 5);
|
BOOST_CHECK(cb[2] == 5);
|
||||||
BOOST_TEST(cb[3] == 4);
|
BOOST_CHECK(cb[3] == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_rinsert_n_test() {
|
void validity_rinsert_n_test() {
|
||||||
@@ -278,14 +280,14 @@ void validity_rinsert_n_test() {
|
|||||||
|
|
||||||
// memory placement: { 4, 4, 3, 1, 2 }
|
// memory placement: { 4, 4, 3, 1, 2 }
|
||||||
// circular buffer: { 1, 2, 4, 4, 3 }
|
// circular buffer: { 1, 2, 4, 4, 3 }
|
||||||
BOOST_TEST(*it1 == 4);
|
BOOST_CHECK(*it1 == 4);
|
||||||
BOOST_TEST(*it2 == 4);
|
BOOST_CHECK(*it2 == 4);
|
||||||
BOOST_TEST(*it3 == 3);
|
BOOST_CHECK(*it3 == 3);
|
||||||
BOOST_TEST(cb[0] == 1);
|
BOOST_CHECK(cb[0] == 1);
|
||||||
BOOST_TEST(cb[1] == 2);
|
BOOST_CHECK(cb[1] == 2);
|
||||||
BOOST_TEST(cb[2] == 4);
|
BOOST_CHECK(cb[2] == 4);
|
||||||
BOOST_TEST(cb[3] == 4);
|
BOOST_CHECK(cb[3] == 4);
|
||||||
BOOST_TEST(cb[4] == 3);
|
BOOST_CHECK(cb[4] == 3);
|
||||||
|
|
||||||
// it4 -> 1, it5 -> 2
|
// it4 -> 1, it5 -> 2
|
||||||
circular_buffer<int>::iterator it4 = it1 - 2;
|
circular_buffer<int>::iterator it4 = it1 - 2;
|
||||||
@@ -295,16 +297,16 @@ void validity_rinsert_n_test() {
|
|||||||
|
|
||||||
// memory placement: { 4, 5, 1, 2, 4 } - 5 inserted only once
|
// memory placement: { 4, 5, 1, 2, 4 } - 5 inserted only once
|
||||||
// circular buffer: { 1, 2, 4, 4, 5 }
|
// circular buffer: { 1, 2, 4, 4, 5 }
|
||||||
BOOST_TEST(*it1 == 4);
|
BOOST_CHECK(*it1 == 4);
|
||||||
BOOST_TEST(*it2 == 5);
|
BOOST_CHECK(*it2 == 5);
|
||||||
BOOST_TEST(*it3 == 1);
|
BOOST_CHECK(*it3 == 1);
|
||||||
BOOST_TEST(*it4 == 2);
|
BOOST_CHECK(*it4 == 2);
|
||||||
BOOST_TEST(*it5 == 4);
|
BOOST_CHECK(*it5 == 4);
|
||||||
BOOST_TEST(cb[0] == 1);
|
BOOST_CHECK(cb[0] == 1);
|
||||||
BOOST_TEST(cb[1] == 2);
|
BOOST_CHECK(cb[1] == 2);
|
||||||
BOOST_TEST(cb[2] == 4);
|
BOOST_CHECK(cb[2] == 4);
|
||||||
BOOST_TEST(cb[3] == 4);
|
BOOST_CHECK(cb[3] == 4);
|
||||||
BOOST_TEST(cb[4] == 5);
|
BOOST_CHECK(cb[4] == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_rinsert_range_test() {
|
void validity_rinsert_range_test() {
|
||||||
@@ -334,14 +336,14 @@ void validity_rinsert_range_test() {
|
|||||||
|
|
||||||
// memory placement: { 4, 5, 3, 1, 2 }
|
// memory placement: { 4, 5, 3, 1, 2 }
|
||||||
// circular buffer: { 1, 2, 4, 5, 3 }
|
// circular buffer: { 1, 2, 4, 5, 3 }
|
||||||
BOOST_TEST(*it11 == 4);
|
BOOST_CHECK(*it11 == 4);
|
||||||
BOOST_TEST(*it12 == 5);
|
BOOST_CHECK(*it12 == 5);
|
||||||
BOOST_TEST(*it13 == 3);
|
BOOST_CHECK(*it13 == 3);
|
||||||
BOOST_TEST(cb1[0] == 1);
|
BOOST_CHECK(cb1[0] == 1);
|
||||||
BOOST_TEST(cb1[1] == 2);
|
BOOST_CHECK(cb1[1] == 2);
|
||||||
BOOST_TEST(cb1[2] == 4);
|
BOOST_CHECK(cb1[2] == 4);
|
||||||
BOOST_TEST(cb1[3] == 5);
|
BOOST_CHECK(cb1[3] == 5);
|
||||||
BOOST_TEST(cb1[4] == 3);
|
BOOST_CHECK(cb1[4] == 3);
|
||||||
|
|
||||||
// it14 -> 1, it15 -> 2
|
// it14 -> 1, it15 -> 2
|
||||||
circular_buffer<int>::iterator it14 = it11 - 2;
|
circular_buffer<int>::iterator it14 = it11 - 2;
|
||||||
@@ -351,16 +353,16 @@ void validity_rinsert_range_test() {
|
|||||||
|
|
||||||
// memory placement: { 5, 6, 1, 2, 4 } - 6 inserted only
|
// memory placement: { 5, 6, 1, 2, 4 } - 6 inserted only
|
||||||
// circular buffer: { 1, 2, 4, 5, 6 }
|
// circular buffer: { 1, 2, 4, 5, 6 }
|
||||||
BOOST_TEST(*it11 == 5);
|
BOOST_CHECK(*it11 == 5);
|
||||||
BOOST_TEST(*it12 == 6);
|
BOOST_CHECK(*it12 == 6);
|
||||||
BOOST_TEST(*it13 == 1);
|
BOOST_CHECK(*it13 == 1);
|
||||||
BOOST_TEST(*it14 == 2);
|
BOOST_CHECK(*it14 == 2);
|
||||||
BOOST_TEST(*it15 == 4);
|
BOOST_CHECK(*it15 == 4);
|
||||||
BOOST_TEST(cb1[0] == 1);
|
BOOST_CHECK(cb1[0] == 1);
|
||||||
BOOST_TEST(cb1[1] == 2);
|
BOOST_CHECK(cb1[1] == 2);
|
||||||
BOOST_TEST(cb1[2] == 4);
|
BOOST_CHECK(cb1[2] == 4);
|
||||||
BOOST_TEST(cb1[3] == 5);
|
BOOST_CHECK(cb1[3] == 5);
|
||||||
BOOST_TEST(cb1[4] == 6);
|
BOOST_CHECK(cb1[4] == 6);
|
||||||
|
|
||||||
// memory placement: { 1, 2, 3 }
|
// memory placement: { 1, 2, 3 }
|
||||||
// circular buffer: { 1, 2, 3 }
|
// circular buffer: { 1, 2, 3 }
|
||||||
@@ -378,14 +380,14 @@ void validity_rinsert_range_test() {
|
|||||||
|
|
||||||
// memory placement: { 4, 5, 3, 1, 2 }
|
// memory placement: { 4, 5, 3, 1, 2 }
|
||||||
// circular buffer: { 1, 2, 4, 5, 3 }
|
// circular buffer: { 1, 2, 4, 5, 3 }
|
||||||
BOOST_TEST(*it21 == 4);
|
BOOST_CHECK(*it21 == 4);
|
||||||
BOOST_TEST(*it22 == 5);
|
BOOST_CHECK(*it22 == 5);
|
||||||
BOOST_TEST(*it23 == 3);
|
BOOST_CHECK(*it23 == 3);
|
||||||
BOOST_TEST(cb2[0] == 1);
|
BOOST_CHECK(cb2[0] == 1);
|
||||||
BOOST_TEST(cb2[1] == 2);
|
BOOST_CHECK(cb2[1] == 2);
|
||||||
BOOST_TEST(cb2[2] == 4);
|
BOOST_CHECK(cb2[2] == 4);
|
||||||
BOOST_TEST(cb2[3] == 5);
|
BOOST_CHECK(cb2[3] == 5);
|
||||||
BOOST_TEST(cb2[4] == 3);
|
BOOST_CHECK(cb2[4] == 3);
|
||||||
|
|
||||||
// it24 -> 1, it25 -> 2
|
// it24 -> 1, it25 -> 2
|
||||||
circular_buffer<int>::iterator it24 = it21 - 2;
|
circular_buffer<int>::iterator it24 = it21 - 2;
|
||||||
@@ -395,16 +397,16 @@ void validity_rinsert_range_test() {
|
|||||||
|
|
||||||
// memory placement: { 5, 6, 1, 2, 4 }
|
// memory placement: { 5, 6, 1, 2, 4 }
|
||||||
// circular buffer: { 1, 2, 4, 5, 6 }
|
// circular buffer: { 1, 2, 4, 5, 6 }
|
||||||
BOOST_TEST(*it21 == 5);
|
BOOST_CHECK(*it21 == 5);
|
||||||
BOOST_TEST(*it22 == 6);
|
BOOST_CHECK(*it22 == 6);
|
||||||
BOOST_TEST(*it23 == 1);
|
BOOST_CHECK(*it23 == 1);
|
||||||
BOOST_TEST(*it24 == 2);
|
BOOST_CHECK(*it24 == 2);
|
||||||
BOOST_TEST(*it25 == 4);
|
BOOST_CHECK(*it25 == 4);
|
||||||
BOOST_TEST(cb2[0] == 1);
|
BOOST_CHECK(cb2[0] == 1);
|
||||||
BOOST_TEST(cb2[1] == 2);
|
BOOST_CHECK(cb2[1] == 2);
|
||||||
BOOST_TEST(cb2[2] == 4);
|
BOOST_CHECK(cb2[2] == 4);
|
||||||
BOOST_TEST(cb2[3] == 5);
|
BOOST_CHECK(cb2[3] == 5);
|
||||||
BOOST_TEST(cb2[4] == 6);
|
BOOST_CHECK(cb2[4] == 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_erase_test() {
|
void validity_erase_test() {
|
||||||
@@ -430,14 +432,14 @@ void validity_erase_test() {
|
|||||||
|
|
||||||
// memory placement: { 5, X, 1, 3, 4 }
|
// memory placement: { 5, X, 1, 3, 4 }
|
||||||
// circular buffer: { 1, 3, 4, 5 }
|
// circular buffer: { 1, 3, 4, 5 }
|
||||||
BOOST_TEST(*it1 == 1);
|
BOOST_CHECK(*it1 == 1);
|
||||||
BOOST_TEST(*it2 == 3);
|
BOOST_CHECK(*it2 == 3);
|
||||||
BOOST_TEST(*it3 == 4);
|
BOOST_CHECK(*it3 == 4);
|
||||||
BOOST_TEST(*it4 == 5);
|
BOOST_CHECK(*it4 == 5);
|
||||||
BOOST_TEST(cb[0] == 1);
|
BOOST_CHECK(cb[0] == 1);
|
||||||
BOOST_TEST(cb[1] == 3);
|
BOOST_CHECK(cb[1] == 3);
|
||||||
BOOST_TEST(cb[2] == 4);
|
BOOST_CHECK(cb[2] == 4);
|
||||||
BOOST_TEST(cb[3] == 5);
|
BOOST_CHECK(cb[3] == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_erase_range_test() {
|
void validity_erase_range_test() {
|
||||||
@@ -465,14 +467,14 @@ void validity_erase_range_test() {
|
|||||||
|
|
||||||
// memory placement: { 6, X, X, 1, 2, 5 }
|
// memory placement: { 6, X, X, 1, 2, 5 }
|
||||||
// circular buffer: { 1, 2, 5, 6 }
|
// circular buffer: { 1, 2, 5, 6 }
|
||||||
BOOST_TEST(*it1 == 1);
|
BOOST_CHECK(*it1 == 1);
|
||||||
BOOST_TEST(*it2 == 2);
|
BOOST_CHECK(*it2 == 2);
|
||||||
BOOST_TEST(*it3 == 5);
|
BOOST_CHECK(*it3 == 5);
|
||||||
BOOST_TEST(*it4 == 6);
|
BOOST_CHECK(*it4 == 6);
|
||||||
BOOST_TEST(cb[0] == 1);
|
BOOST_CHECK(cb[0] == 1);
|
||||||
BOOST_TEST(cb[1] == 2);
|
BOOST_CHECK(cb[1] == 2);
|
||||||
BOOST_TEST(cb[2] == 5);
|
BOOST_CHECK(cb[2] == 5);
|
||||||
BOOST_TEST(cb[3] == 6);
|
BOOST_CHECK(cb[3] == 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_rerase_test() {
|
void validity_rerase_test() {
|
||||||
@@ -498,14 +500,14 @@ void validity_rerase_test() {
|
|||||||
|
|
||||||
// memory placement: { 4, 5, X, 1, 3 }
|
// memory placement: { 4, 5, X, 1, 3 }
|
||||||
// circular buffer: { 1, 3, 4, 5 }
|
// circular buffer: { 1, 3, 4, 5 }
|
||||||
BOOST_TEST(*it1 == 1);
|
BOOST_CHECK(*it1 == 1);
|
||||||
BOOST_TEST(*it2 == 3);
|
BOOST_CHECK(*it2 == 3);
|
||||||
BOOST_TEST(*it3 == 4);
|
BOOST_CHECK(*it3 == 4);
|
||||||
BOOST_TEST(*it4 == 5);
|
BOOST_CHECK(*it4 == 5);
|
||||||
BOOST_TEST(cb[0] == 1);
|
BOOST_CHECK(cb[0] == 1);
|
||||||
BOOST_TEST(cb[1] == 3);
|
BOOST_CHECK(cb[1] == 3);
|
||||||
BOOST_TEST(cb[2] == 4);
|
BOOST_CHECK(cb[2] == 4);
|
||||||
BOOST_TEST(cb[3] == 5);
|
BOOST_CHECK(cb[3] == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_rerase_range_test() {
|
void validity_rerase_range_test() {
|
||||||
@@ -533,14 +535,14 @@ void validity_rerase_range_test() {
|
|||||||
|
|
||||||
// memory placement: { 2, 5, 6, X, X, 1 }
|
// memory placement: { 2, 5, 6, X, X, 1 }
|
||||||
// circular buffer: { 1, 2, 5, 6 }
|
// circular buffer: { 1, 2, 5, 6 }
|
||||||
BOOST_TEST(*it1 == 1);
|
BOOST_CHECK(*it1 == 1);
|
||||||
BOOST_TEST(*it2 == 2);
|
BOOST_CHECK(*it2 == 2);
|
||||||
BOOST_TEST(*it3 == 5);
|
BOOST_CHECK(*it3 == 5);
|
||||||
BOOST_TEST(*it4 == 6);
|
BOOST_CHECK(*it4 == 6);
|
||||||
BOOST_TEST(cb[0] == 1);
|
BOOST_CHECK(cb[0] == 1);
|
||||||
BOOST_TEST(cb[1] == 2);
|
BOOST_CHECK(cb[1] == 2);
|
||||||
BOOST_TEST(cb[2] == 5);
|
BOOST_CHECK(cb[2] == 5);
|
||||||
BOOST_TEST(cb[3] == 6);
|
BOOST_CHECK(cb[3] == 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_linearize_test() {
|
void validity_linearize_test() {
|
||||||
@@ -562,12 +564,12 @@ void validity_linearize_test() {
|
|||||||
|
|
||||||
// memory placement: { 1, 2, 3 }
|
// memory placement: { 1, 2, 3 }
|
||||||
// circular buffer: { 1, 2, 3 }
|
// circular buffer: { 1, 2, 3 }
|
||||||
BOOST_TEST(*it1 == 2);
|
BOOST_CHECK(*it1 == 2);
|
||||||
BOOST_TEST(*it2 == 3);
|
BOOST_CHECK(*it2 == 3);
|
||||||
BOOST_TEST(*it3 == 1);
|
BOOST_CHECK(*it3 == 1);
|
||||||
BOOST_TEST(cb[0] == 1);
|
BOOST_CHECK(cb[0] == 1);
|
||||||
BOOST_TEST(cb[1] == 2);
|
BOOST_CHECK(cb[1] == 2);
|
||||||
BOOST_TEST(cb[2] == 3);
|
BOOST_CHECK(cb[2] == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_swap_test() {
|
void validity_swap_test() {
|
||||||
@@ -600,20 +602,20 @@ void validity_swap_test() {
|
|||||||
cb1.swap(cb2);
|
cb1.swap(cb2);
|
||||||
|
|
||||||
// Although iterators refer to the original elements,
|
// Although iterators refer to the original elements,
|
||||||
// their internal state is inconsistent and no other operation
|
// their interal state is inconsistent and no other operation
|
||||||
// (except dereferencing) can be invoked on them any more.
|
// (except dereferencing) can be invoked on them any more.
|
||||||
BOOST_TEST(*it11 == 1);
|
BOOST_CHECK(*it11 == 1);
|
||||||
BOOST_TEST(*it12 == 2);
|
BOOST_CHECK(*it12 == 2);
|
||||||
BOOST_TEST(*it13 == 3);
|
BOOST_CHECK(*it13 == 3);
|
||||||
BOOST_TEST(*it21 == 4);
|
BOOST_CHECK(*it21 == 4);
|
||||||
BOOST_TEST(*it22 == 5);
|
BOOST_CHECK(*it22 == 5);
|
||||||
BOOST_TEST(*it23 == 6);
|
BOOST_CHECK(*it23 == 6);
|
||||||
BOOST_TEST(cb1[0] == 4);
|
BOOST_CHECK(cb1[0] == 4);
|
||||||
BOOST_TEST(cb1[1] == 5);
|
BOOST_CHECK(cb1[1] == 5);
|
||||||
BOOST_TEST(cb1[2] == 6);
|
BOOST_CHECK(cb1[2] == 6);
|
||||||
BOOST_TEST(cb2[0] == 1);
|
BOOST_CHECK(cb2[0] == 1);
|
||||||
BOOST_TEST(cb2[1] == 2);
|
BOOST_CHECK(cb2[1] == 2);
|
||||||
BOOST_TEST(cb2[2] == 3);
|
BOOST_CHECK(cb2[2] == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_push_back_test() {
|
void validity_push_back_test() {
|
||||||
@@ -635,12 +637,12 @@ void validity_push_back_test() {
|
|||||||
|
|
||||||
// memory placement: { 3, 4, 2 }
|
// memory placement: { 3, 4, 2 }
|
||||||
// circular buffer: { 2, 3, 4 }
|
// circular buffer: { 2, 3, 4 }
|
||||||
BOOST_TEST(*it1 == 4);
|
BOOST_CHECK(*it1 == 4);
|
||||||
BOOST_TEST(*it2 == 2);
|
BOOST_CHECK(*it2 == 2);
|
||||||
BOOST_TEST(*it3 == 3);
|
BOOST_CHECK(*it3 == 3);
|
||||||
BOOST_TEST(cb[0] == 2);
|
BOOST_CHECK(cb[0] == 2);
|
||||||
BOOST_TEST(cb[1] == 3);
|
BOOST_CHECK(cb[1] == 3);
|
||||||
BOOST_TEST(cb[2] == 4);
|
BOOST_CHECK(cb[2] == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_push_front_test() {
|
void validity_push_front_test() {
|
||||||
@@ -662,12 +664,12 @@ void validity_push_front_test() {
|
|||||||
|
|
||||||
// memory placement: { 4, 1, 2 }
|
// memory placement: { 4, 1, 2 }
|
||||||
// circular buffer: { 4, 1, 2 }
|
// circular buffer: { 4, 1, 2 }
|
||||||
BOOST_TEST(*it1 == 1);
|
BOOST_CHECK(*it1 == 1);
|
||||||
BOOST_TEST(*it2 == 2);
|
BOOST_CHECK(*it2 == 2);
|
||||||
BOOST_TEST(*it3 == 4);
|
BOOST_CHECK(*it3 == 4);
|
||||||
BOOST_TEST(cb[0] == 4);
|
BOOST_CHECK(cb[0] == 4);
|
||||||
BOOST_TEST(cb[1] == 1);
|
BOOST_CHECK(cb[1] == 1);
|
||||||
BOOST_TEST(cb[2] == 2);
|
BOOST_CHECK(cb[2] == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_pop_back_test() {
|
void validity_pop_back_test() {
|
||||||
@@ -688,10 +690,10 @@ void validity_pop_back_test() {
|
|||||||
|
|
||||||
// memory placement: { X, 1, 2 }
|
// memory placement: { X, 1, 2 }
|
||||||
// circular buffer: { 1, 2 }
|
// circular buffer: { 1, 2 }
|
||||||
BOOST_TEST(*it1 == 1);
|
BOOST_CHECK(*it1 == 1);
|
||||||
BOOST_TEST(*it2 == 2);
|
BOOST_CHECK(*it2 == 2);
|
||||||
BOOST_TEST(cb[0] == 1);
|
BOOST_CHECK(cb[0] == 1);
|
||||||
BOOST_TEST(cb[1] == 2);
|
BOOST_CHECK(cb[1] == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validity_pop_front_test() {
|
void validity_pop_front_test() {
|
||||||
@@ -712,31 +714,34 @@ void validity_pop_front_test() {
|
|||||||
|
|
||||||
// memory placement: { 3, X, 2 }
|
// memory placement: { 3, X, 2 }
|
||||||
// circular buffer: { 2, 3 }
|
// circular buffer: { 2, 3 }
|
||||||
BOOST_TEST(*it1 == 2);
|
BOOST_CHECK(*it1 == 2);
|
||||||
BOOST_TEST(*it2 == 3);
|
BOOST_CHECK(*it2 == 3);
|
||||||
BOOST_TEST(cb[0] == 2);
|
BOOST_CHECK(cb[0] == 2);
|
||||||
BOOST_TEST(cb[1] == 3);
|
BOOST_CHECK(cb[1] == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test main
|
// test main
|
||||||
int main()
|
test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) {
|
||||||
{
|
|
||||||
validity_example_test();
|
test_suite* tests = BOOST_TEST_SUITE("Unit tests for the iterator of the circular_buffer.");
|
||||||
validity_insert_test();
|
|
||||||
validity_insert_n_test();
|
tests->add(BOOST_TEST_CASE(&validity_example_test));
|
||||||
validity_insert_range_test();
|
tests->add(BOOST_TEST_CASE(&validity_insert_test));
|
||||||
validity_rinsert_test();
|
tests->add(BOOST_TEST_CASE(&validity_insert_n_test));
|
||||||
validity_rinsert_n_test();
|
tests->add(BOOST_TEST_CASE(&validity_insert_range_test));
|
||||||
validity_rinsert_range_test();
|
tests->add(BOOST_TEST_CASE(&validity_rinsert_test));
|
||||||
validity_erase_test();
|
tests->add(BOOST_TEST_CASE(&validity_rinsert_n_test));
|
||||||
validity_erase_range_test();
|
tests->add(BOOST_TEST_CASE(&validity_rinsert_range_test));
|
||||||
validity_rerase_test();
|
tests->add(BOOST_TEST_CASE(&validity_erase_test));
|
||||||
validity_rerase_range_test();
|
tests->add(BOOST_TEST_CASE(&validity_erase_range_test));
|
||||||
validity_linearize_test();
|
tests->add(BOOST_TEST_CASE(&validity_rerase_test));
|
||||||
validity_swap_test();
|
tests->add(BOOST_TEST_CASE(&validity_rerase_range_test));
|
||||||
validity_push_back_test();
|
tests->add(BOOST_TEST_CASE(&validity_linearize_test));
|
||||||
validity_push_front_test();
|
tests->add(BOOST_TEST_CASE(&validity_swap_test));
|
||||||
validity_pop_back_test();
|
tests->add(BOOST_TEST_CASE(&validity_push_back_test));
|
||||||
validity_pop_front_test();
|
tests->add(BOOST_TEST_CASE(&validity_push_front_test));
|
||||||
return boost::report_errors();
|
tests->add(BOOST_TEST_CASE(&validity_pop_back_test));
|
||||||
|
tests->add(BOOST_TEST_CASE(&validity_pop_front_test));
|
||||||
|
|
||||||
|
return tests;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,33 +29,33 @@ void min_capacity_test() {
|
|||||||
cb_space_optimized cb2(capacity_ctrl(10, 5), 1);
|
cb_space_optimized cb2(capacity_ctrl(10, 5), 1);
|
||||||
cb_space_optimized cb3(capacity_ctrl(20, 10), v.begin(), v.end());
|
cb_space_optimized cb3(capacity_ctrl(20, 10), v.begin(), v.end());
|
||||||
|
|
||||||
BOOST_TEST(cb1.size() == 0);
|
BOOST_CHECK(cb1.size() == 0);
|
||||||
BOOST_TEST(cb1.capacity().capacity() == 10);
|
BOOST_CHECK(cb1.capacity().capacity() == 10);
|
||||||
BOOST_TEST(cb1.capacity().min_capacity() == 10);
|
BOOST_CHECK(cb1.capacity().min_capacity() == 10);
|
||||||
BOOST_TEST(cb2[0] == 1);
|
BOOST_CHECK(cb2[0] == 1);
|
||||||
BOOST_TEST(cb2.size() == 10);
|
BOOST_CHECK(cb2.size() == 10);
|
||||||
BOOST_TEST(cb2.capacity() == 10);
|
BOOST_CHECK(cb2.capacity() == 10);
|
||||||
BOOST_TEST(cb2.capacity().min_capacity() == 5);
|
BOOST_CHECK(cb2.capacity().min_capacity() == 5);
|
||||||
BOOST_TEST(cb3[0] == 1);
|
BOOST_CHECK(cb3[0] == 1);
|
||||||
BOOST_TEST(cb3.size() == 5);
|
BOOST_CHECK(cb3.size() == 5);
|
||||||
BOOST_TEST(cb3.capacity() == 20);
|
BOOST_CHECK(cb3.capacity() == 20);
|
||||||
BOOST_TEST(cb3.capacity().min_capacity() == 10);
|
BOOST_CHECK(cb3.capacity().min_capacity() == 10);
|
||||||
BOOST_TEST(cb1.capacity().min_capacity() <= cb1.internal_capacity());
|
BOOST_CHECK(cb1.capacity().min_capacity() <= cb1.internal_capacity());
|
||||||
BOOST_TEST(cb2.capacity().min_capacity() <= cb2.internal_capacity());
|
BOOST_CHECK(cb2.capacity().min_capacity() <= cb2.internal_capacity());
|
||||||
BOOST_TEST(cb3.capacity().min_capacity() <= cb3.internal_capacity());
|
BOOST_CHECK(cb3.capacity().min_capacity() <= cb3.internal_capacity());
|
||||||
|
|
||||||
cb2.erase(cb2.begin() + 2, cb2.end());
|
cb2.erase(cb2.begin() + 2, cb2.end());
|
||||||
|
|
||||||
BOOST_TEST(cb2.size() == 2);
|
BOOST_CHECK(cb2.size() == 2);
|
||||||
BOOST_TEST(cb2.capacity().min_capacity() <= cb2.internal_capacity());
|
BOOST_CHECK(cb2.capacity().min_capacity() <= cb2.internal_capacity());
|
||||||
|
|
||||||
cb2.clear();
|
cb2.clear();
|
||||||
cb3.clear();
|
cb3.clear();
|
||||||
|
|
||||||
BOOST_TEST(cb2.empty());
|
BOOST_CHECK(cb2.empty());
|
||||||
BOOST_TEST(cb3.empty());
|
BOOST_CHECK(cb3.empty());
|
||||||
BOOST_TEST(cb2.capacity().min_capacity() <= cb2.internal_capacity());
|
BOOST_CHECK(cb2.capacity().min_capacity() <= cb2.internal_capacity());
|
||||||
BOOST_TEST(cb3.capacity().min_capacity() <= cb3.internal_capacity());
|
BOOST_CHECK(cb3.capacity().min_capacity() <= cb3.internal_capacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
void capacity_control_test() {
|
void capacity_control_test() {
|
||||||
@@ -65,33 +65,33 @@ void capacity_control_test() {
|
|||||||
circular_buffer_space_optimized<int>::capacity_type(20, 5);
|
circular_buffer_space_optimized<int>::capacity_type(20, 5);
|
||||||
circular_buffer_space_optimized<int>::capacity_type c3 = c2;
|
circular_buffer_space_optimized<int>::capacity_type c3 = c2;
|
||||||
|
|
||||||
BOOST_TEST(c1.capacity() == 10);
|
BOOST_CHECK(c1.capacity() == 10);
|
||||||
BOOST_TEST(c1.min_capacity() == 0);
|
BOOST_CHECK(c1.min_capacity() == 0);
|
||||||
BOOST_TEST(c2.capacity() == 20);
|
BOOST_CHECK(c2.capacity() == 20);
|
||||||
BOOST_TEST(c2.min_capacity() == 5);
|
BOOST_CHECK(c2.min_capacity() == 5);
|
||||||
BOOST_TEST(c3.capacity() == 20);
|
BOOST_CHECK(c3.capacity() == 20);
|
||||||
BOOST_TEST(c3.min_capacity() == 5);
|
BOOST_CHECK(c3.min_capacity() == 5);
|
||||||
|
|
||||||
c1 = c2;
|
c1 = c2;
|
||||||
|
|
||||||
BOOST_TEST(c1.capacity() == 20);
|
BOOST_CHECK(c1.capacity() == 20);
|
||||||
BOOST_TEST(c1.min_capacity() == 5);
|
BOOST_CHECK(c1.min_capacity() == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void specific_constructors_test() {
|
void specific_constructors_test() {
|
||||||
|
|
||||||
cb_space_optimized cb1;
|
cb_space_optimized cb1;
|
||||||
BOOST_TEST(cb1.capacity() == 0);
|
BOOST_CHECK(cb1.capacity() == 0);
|
||||||
BOOST_TEST(cb1.capacity().min_capacity() == 0);
|
BOOST_CHECK(cb1.capacity().min_capacity() == 0);
|
||||||
BOOST_TEST(cb1.internal_capacity() == 0);
|
BOOST_CHECK(cb1.internal_capacity() == 0);
|
||||||
BOOST_TEST(cb1.size() == 0);
|
BOOST_CHECK(cb1.size() == 0);
|
||||||
|
|
||||||
cb1.push_back(1);
|
cb1.push_back(1);
|
||||||
cb1.push_back(2);
|
cb1.push_back(2);
|
||||||
cb1.push_back(3);
|
cb1.push_back(3);
|
||||||
|
|
||||||
BOOST_TEST(cb1.size() == 0);
|
BOOST_CHECK(cb1.size() == 0);
|
||||||
BOOST_TEST(cb1.capacity() == 0);
|
BOOST_CHECK(cb1.capacity() == 0);
|
||||||
|
|
||||||
vector<int> v;
|
vector<int> v;
|
||||||
v.push_back(1);
|
v.push_back(1);
|
||||||
@@ -100,9 +100,9 @@ void specific_constructors_test() {
|
|||||||
|
|
||||||
cb_space_optimized cb2(v.begin(), v.end());
|
cb_space_optimized cb2(v.begin(), v.end());
|
||||||
|
|
||||||
BOOST_TEST(cb2.capacity() == 3);
|
BOOST_CHECK(cb2.capacity() == 3);
|
||||||
BOOST_TEST(cb2.capacity().min_capacity() == 0);
|
BOOST_CHECK(cb2.capacity().min_capacity() == 0);
|
||||||
BOOST_TEST(cb2.size() == 3);
|
BOOST_CHECK(cb2.size() == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void shrink_to_fit_test() {
|
void shrink_to_fit_test() {
|
||||||
@@ -112,20 +112,20 @@ void shrink_to_fit_test() {
|
|||||||
cb.push_back(2);
|
cb.push_back(2);
|
||||||
cb.push_back(3);
|
cb.push_back(3);
|
||||||
|
|
||||||
BOOST_TEST(cb.size() == 3);
|
BOOST_CHECK(cb.size() == 3);
|
||||||
BOOST_TEST(cb.capacity() == 1000);
|
BOOST_CHECK(cb.capacity() == 1000);
|
||||||
|
|
||||||
size_t internal_capacity = cb.internal_capacity();
|
size_t internal_capacity = cb.internal_capacity();
|
||||||
cb_space_optimized(cb).swap(cb);
|
cb_space_optimized(cb).swap(cb);
|
||||||
|
|
||||||
BOOST_TEST(cb.size() == 3);
|
BOOST_CHECK(cb.size() == 3);
|
||||||
BOOST_TEST(cb.capacity() == 1000);
|
BOOST_CHECK(cb.capacity() == 1000);
|
||||||
BOOST_TEST(internal_capacity >= cb.internal_capacity());
|
BOOST_CHECK(internal_capacity >= cb.internal_capacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
void iterator_invalidation_test() {
|
void iterator_invalidation_test() {
|
||||||
|
|
||||||
#if BOOST_CB_ENABLE_DEBUG
|
#if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG)
|
||||||
|
|
||||||
cb_space_optimized cb1(10, 1);
|
cb_space_optimized cb1(10, 1);
|
||||||
cb1.push_back(2);
|
cb1.push_back(2);
|
||||||
@@ -136,33 +136,33 @@ void iterator_invalidation_test() {
|
|||||||
cb_space_optimized::iterator it3 = cb1.begin() + 6;
|
cb_space_optimized::iterator it3 = cb1.begin() + 6;
|
||||||
|
|
||||||
cb1.set_capacity(10);
|
cb1.set_capacity(10);
|
||||||
BOOST_TEST(it1.is_valid(&cb1));
|
BOOST_CHECK(it1.is_valid(&cb1));
|
||||||
BOOST_TEST(!it2.is_valid(&cb1));
|
BOOST_CHECK(!it2.is_valid(&cb1));
|
||||||
BOOST_TEST(!it3.is_valid(&cb1));
|
BOOST_CHECK(!it3.is_valid(&cb1));
|
||||||
|
|
||||||
it1 = cb1.end();
|
it1 = cb1.end();
|
||||||
it2 = cb1.begin();
|
it2 = cb1.begin();
|
||||||
it3 = cb1.begin() + 6;
|
it3 = cb1.begin() + 6;
|
||||||
cb1.rset_capacity(10);
|
cb1.rset_capacity(10);
|
||||||
BOOST_TEST(it1.is_valid(&cb1));
|
BOOST_CHECK(it1.is_valid(&cb1));
|
||||||
BOOST_TEST(!it2.is_valid(&cb1));
|
BOOST_CHECK(!it2.is_valid(&cb1));
|
||||||
BOOST_TEST(!it3.is_valid(&cb1));
|
BOOST_CHECK(!it3.is_valid(&cb1));
|
||||||
|
|
||||||
it1 = cb1.end();
|
it1 = cb1.end();
|
||||||
it2 = cb1.begin();
|
it2 = cb1.begin();
|
||||||
it3 = cb1.begin() + 6;
|
it3 = cb1.begin() + 6;
|
||||||
cb1.resize(10);
|
cb1.resize(10);
|
||||||
BOOST_TEST(it1.is_valid(&cb1));
|
BOOST_CHECK(it1.is_valid(&cb1));
|
||||||
BOOST_TEST(!it2.is_valid(&cb1));
|
BOOST_CHECK(!it2.is_valid(&cb1));
|
||||||
BOOST_TEST(!it3.is_valid(&cb1));
|
BOOST_CHECK(!it3.is_valid(&cb1));
|
||||||
|
|
||||||
it1 = cb1.end();
|
it1 = cb1.end();
|
||||||
it2 = cb1.begin();
|
it2 = cb1.begin();
|
||||||
it3 = cb1.begin() + 6;
|
it3 = cb1.begin() + 6;
|
||||||
cb1.rresize(10);
|
cb1.rresize(10);
|
||||||
BOOST_TEST(it1.is_valid(&cb1));
|
BOOST_CHECK(it1.is_valid(&cb1));
|
||||||
BOOST_TEST(!it2.is_valid(&cb1));
|
BOOST_CHECK(!it2.is_valid(&cb1));
|
||||||
BOOST_TEST(!it3.is_valid(&cb1));
|
BOOST_CHECK(!it3.is_valid(&cb1));
|
||||||
|
|
||||||
{
|
{
|
||||||
cb_space_optimized cb2(10, 1);
|
cb_space_optimized cb2(10, 1);
|
||||||
@@ -173,21 +173,24 @@ void iterator_invalidation_test() {
|
|||||||
it2 = cb2.begin();
|
it2 = cb2.begin();
|
||||||
it3 = cb2.begin() + 6;
|
it3 = cb2.begin() + 6;
|
||||||
}
|
}
|
||||||
BOOST_TEST(!it1.is_valid(&cb1));
|
BOOST_CHECK(!it1.is_valid(&cb1));
|
||||||
BOOST_TEST(!it2.is_valid(&cb1));
|
BOOST_CHECK(!it2.is_valid(&cb1));
|
||||||
BOOST_TEST(!it3.is_valid(&cb1));
|
BOOST_CHECK(!it3.is_valid(&cb1));
|
||||||
|
|
||||||
#endif // #if BOOST_CB_ENABLE_DEBUG
|
#endif // #if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG)
|
||||||
}
|
}
|
||||||
|
|
||||||
// test main
|
// test main
|
||||||
int main()
|
test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) {
|
||||||
{
|
|
||||||
run_common_tests();
|
test_suite* tests = BOOST_TEST_SUITE("Unit tests for the circular_buffer_space_optimized.");
|
||||||
min_capacity_test();
|
add_common_tests(tests);
|
||||||
capacity_control_test();
|
|
||||||
specific_constructors_test();
|
tests->add(BOOST_TEST_CASE(&min_capacity_test));
|
||||||
shrink_to_fit_test();
|
tests->add(BOOST_TEST_CASE(&capacity_control_test));
|
||||||
iterator_invalidation_test();
|
tests->add(BOOST_TEST_CASE(&specific_constructors_test));
|
||||||
return boost::report_errors();
|
tests->add(BOOST_TEST_CASE(&shrink_to_fit_test));
|
||||||
|
tests->add(BOOST_TEST_CASE(&iterator_invalidation_test));
|
||||||
|
|
||||||
|
return tests;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
#define BOOST_CB_TEST
|
#define BOOST_CB_TEST
|
||||||
|
|
||||||
#include <boost/circular_buffer.hpp>
|
#include <boost/circular_buffer.hpp>
|
||||||
#include <boost/core/lightweight_test.hpp>
|
#include <boost/test/included/unit_test.hpp>
|
||||||
|
#include <boost/iterator.hpp>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -71,11 +72,6 @@ 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:
|
||||||
@@ -94,7 +90,6 @@ public:
|
|||||||
eVirtual
|
eVirtual
|
||||||
};
|
};
|
||||||
Dummy() : m_n(eVar) {}
|
Dummy() : m_n(eVar) {}
|
||||||
virtual ~Dummy() {}
|
|
||||||
DummyEnum fnc() { return eFnc; }
|
DummyEnum fnc() { return eFnc; }
|
||||||
DummyEnum const_fnc() const { return eConst; }
|
DummyEnum const_fnc() const { return eConst; }
|
||||||
virtual DummyEnum virtual_fnc() { return eVirtual; }
|
virtual DummyEnum virtual_fnc() { return eVirtual; }
|
||||||
@@ -102,18 +97,21 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// simulator of an input iterator
|
// simulator of an input iterator
|
||||||
struct MyInputIterator {
|
struct MyInputIterator
|
||||||
|
: boost::iterator<std::input_iterator_tag, int, ptrdiff_t, int*, int&> {
|
||||||
typedef std::vector<int>::iterator vector_iterator;
|
typedef std::vector<int>::iterator vector_iterator;
|
||||||
typedef std::input_iterator_tag iterator_category;
|
|
||||||
typedef int value_type;
|
typedef int value_type;
|
||||||
typedef int* pointer;
|
typedef int* pointer;
|
||||||
typedef int& reference;
|
typedef int& reference;
|
||||||
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) {
|
||||||
// Default assignment operator
|
if (this == &it)
|
||||||
|
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 ++ () {
|
||||||
@@ -141,6 +139,7 @@ inline ptrdiff_t* distance_type(const MyInputIterator&) { return 0; }
|
|||||||
|
|
||||||
#endif // #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)
|
#endif // #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)
|
||||||
|
|
||||||
|
using boost::unit_test::test_suite;
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user