Merge branch 'develop'

This commit is contained in:
djowel
2022-09-26 08:11:49 +08:00
parent 6539567952
commit e79a8690f0
73 changed files with 1610 additions and 139 deletions

467
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,467 @@
name: GitHub Actions CI
on:
pull_request:
push:
branches:
- master
- develop
- githubactions*
- feature/**
- fix/**
- pr/**
jobs:
posix:
strategy:
fail-fast: false
matrix:
include:
- name: "TOOLSET=gcc-4.4 CXXSTD=98,0x Job 0"
buildtype: "boost"
packages: "g++-4.4"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "gcc-4.4"
cxxstd: "98,0x"
- name: "TOOLSET=gcc-4.6 CXXSTD=03,0x Job 1"
buildtype: "boost"
packages: "g++-4.6"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "gcc-4.6"
cxxstd: "03,0x"
- name: "TOOLSET=gcc-4.7 CXXSTD=03,11 Job 2"
buildtype: "boost"
packages: "g++-4.7"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "gcc-4.7"
cxxstd: "03,11"
- name: "TOOLSET=gcc-4.8 CXXSTD=03,11,1y Job 3"
buildtype: "boost"
packages: "g++-4.8"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "gcc-4.8"
cxxstd: "03,11,1y"
- name: "TOOLSET=gcc-4.9 CXXSTD=03,11,14 Job 4"
buildtype: "boost"
packages: "g++-4.9"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "gcc-4.9"
cxxstd: "03,11,14"
- name: "TOOLSET=gcc-5 CXXSTD=03,11,14,17 Job 5"
buildtype: "boost"
packages: "g++-5"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "gcc-5"
cxxstd: "03,11,14,17"
- name: "TOOLSET=gcc-6 CXXSTD=03,11,14,17 Job 6"
buildtype: "boost"
packages: "g++-6"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "gcc-6"
cxxstd: "03,11,14,17"
- name: "TOOLSET=gcc-7 CXXSTD=03,11,14,17 Job 7"
buildtype: "boost"
packages: "g++-7"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "gcc-7"
cxxstd: "03,11,14,17"
- name: "TOOLSET=gcc-8 CXXSTD=03,11,14,17,2a Job 8"
buildtype: "boost"
packages: "g++-8"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "gcc-8"
cxxstd: "03,11,14,17,2a"
- name: "TOOLSET=clang-3.5 CXXSTD=03,11,14,1z Job 9"
buildtype: "boost"
packages: "clang-3.5"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "clang-3.5"
cxxstd: "03,11,14"
- name: "TOOLSET=clang-3.6 CXXSTD=03,11,14,1z Job 10"
buildtype: "boost"
packages: "clang-3.6"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "clang-3.6"
cxxstd: "03,11,14"
- name: "TOOLSET=clang-3.7 CXXSTD=03,11,14,1z Job 11"
buildtype: "boost"
packages: "clang-3.7"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "clang-3.7"
cxxstd: "03,11,14"
- name: "TOOLSET=clang-3.8 CXXSTD=03,11,14,1z Job 12"
buildtype: "boost"
packages: "clang-3.8"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "clang-3.8"
cxxstd: "03,11,14"
- name: "TOOLSET=clang-3.9 CXXSTD=03,11,14,1z Job 13"
buildtype: "boost"
packages: "clang-3.9"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "clang-3.9"
cxxstd: "03,11,14"
- name: "TOOLSET=clang-4.0 CXXSTD=03,11,14,1z Job 14"
buildtype: "boost"
packages: "clang-4.0"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
toolset: "clang-4.0"
cxxstd: "03,11,14"
- name: "TOOLSET=clang-5.0 CXXSTD=03,11,14,17,2a Job 15"
buildtype: "boost"
packages: "clang-5.0"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: "xenial"
llvm_ver: "5.0"
toolset: "clang-5.0"
cxxstd: "03,11,14,17,2a"
- name: "TOOLSET=clang-6.0 CXXSTD=03,11,14,17,2a Job 16"
buildtype: "boost"
packages: "clang-6.0"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: "xenial"
llvm_ver: "6.0"
toolset: "clang-6.0"
cxxstd: "03,11,14,17,2a"
- name: "TOOLSET=clang-7 CXXSTD=03,11,14,17,2a Job 17"
buildtype: "boost"
packages: "clang-7"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
cxx: "g++"
sources: ""
llvm_os: "xenial"
llvm_ver: "7"
toolset: "clang-7"
cxxstd: "03,11,14,17,2a"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- name: Check if running in container
if: matrix.container != ''
run: echo "GHA_CONTAINER=${{ matrix.container }}" >> $GITHUB_ENV
- name: If running in container, upgrade packages
if: matrix.container != ''
run: |
apt-get -o Acquire::Retries=3 update && DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata && apt-get -o Acquire::Retries=3 install -y sudo software-properties-common wget curl apt-transport-https make apt-file sudo unzip libssl-dev build-essential autotools-dev autoconf automake g++ libc++-helpers python ruby cpio gcc-multilib g++-multilib pkgconf python3 ccache libpython-dev
sudo apt-add-repository ppa:git-core/ppa
sudo apt-get -o Acquire::Retries=3 update && apt-get -o Acquire::Retries=3 -y install git
python_version=$(python3 -c 'import sys; print("{0.major}.{0.minor}".format(sys.version_info))')
sudo wget https://bootstrap.pypa.io/pip/$python_version/get-pip.py
sudo python3 get-pip.py
sudo /usr/local/bin/pip install cmake
- uses: actions/checkout@v2
- name: linux
shell: bash
env:
CXX: ${{ matrix.cxx }}
SOURCES: ${{ matrix.sources }}
LLVM_OS: ${{ matrix.llvm_os }}
LLVM_VER: ${{ matrix.llvm_ver }}
PACKAGES: ${{ matrix.packages }}
PACKAGES_TO_REMOVE: ${{ matrix.packages_to_remove }}
JOB_BUILDTYPE: ${{ matrix.buildtype }}
TOOLSET: ${{ matrix.toolset }}
CXXSTD: ${{ matrix.cxxstd }}
COMPILER: ${{ matrix.compiler }}
TRAVIS_BRANCH: ${{ github.base_ref }}
TRAVIS_OS_NAME: "linux"
run: |
echo '==================================> SETUP'
echo '==================================> PACKAGES'
set -e
if [ -n "$PACKAGES_TO_REMOVE" ]; then sudo apt-get purge -y $PACKAGES_TO_REMOVE; fi
echo ">>>>> APT: REPO.."
for i in {1..3}; do sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break || sleep 2; done
if test -n "${LLVM_OS}" ; then
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
if test -n "${LLVM_VER}" ; then
sudo -E apt-add-repository "deb http://apt.llvm.org/${LLVM_OS}/ llvm-toolchain-${LLVM_OS}-${LLVM_VER} main"
else
# Snapshot (i.e. trunk) build of clang
sudo -E apt-add-repository "deb http://apt.llvm.org/${LLVM_OS}/ llvm-toolchain-${LLVM_OS} main"
fi
fi
echo ">>>>> APT: UPDATE.."
sudo -E apt-get -o Acquire::Retries=3 update
if test -n "${SOURCES}" ; then
echo ">>>>> APT: INSTALL SOURCES.."
for SOURCE in $SOURCES; do
sudo -E apt-add-repository ppa:$SOURCE
done
fi
echo ">>>>> APT: INSTALL ${PACKAGES}.."
sudo -E DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries=3 -y --no-install-suggests --no-install-recommends install ${PACKAGES}
echo '==================================> INSTALL AND COMPILE'
set -e
export TRAVIS_BUILD_DIR=$(pwd)
export TRAVIS_BRANCH=${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')}
export VCS_COMMIT_ID=$GITHUB_SHA
export GIT_COMMIT=$GITHUB_SHA
export REPO_NAME=$(basename $GITHUB_REPOSITORY)
export USER=$(whoami)
export CC=${CC:-gcc}
export PATH=~/.local/bin:/usr/local/bin:$PATH
if [ "$JOB_BUILDTYPE" == "boost" ]; then
echo '==================================> INSTALL'
BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
cd ..
git clone --depth 1 -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule init libs/array
git submodule init libs/assert
git submodule init libs/bind
git submodule init libs/concept_check
git submodule init libs/config
git submodule init libs/container_hash
git submodule init libs/conversion
git submodule init libs/core
git submodule init libs/detail
git submodule init libs/function
git submodule init libs/function_types
git submodule init libs/functional
git submodule init libs/integer
git submodule init libs/iterator
git submodule init libs/lambda
git submodule init libs/move
git submodule init libs/mpl
git submodule init libs/optional
git submodule init libs/predef
git submodule init libs/preprocessor
git submodule init libs/smart_ptr
git submodule init libs/static_assert
git submodule init libs/throw_exception
git submodule init libs/tuple
git submodule init libs/type_index
git submodule init libs/type_traits
git submodule init libs/typeof
git submodule init libs/utility
git submodule init libs/headers tools/boost_install tools/build
git submodule update
rm -rf libs/fusion
cp -rp $TRAVIS_BUILD_DIR libs/fusion
ln -s $(pwd)/libs/fusion $TRAVIS_BUILD_DIR
./bootstrap.sh
./b2 headers
echo '==================================> SCRIPT'
./b2 -j`(nproc || sysctl -n hw.ncpu) 2> /dev/null` libs/fusion/test toolset=$TOOLSET cxxstd=$CXXSTD
fi
osx:
strategy:
fail-fast: false
matrix:
include:
- name: "TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,1 Job 18"
buildtype: "boost"
packages: ""
os: "macos-10.15"
cxx: "clang++"
sources: ""
llvm_os: ""
llvm_ver: ""
xcode_version: 11.7
toolset: "clang"
compiler: "clang++"
cxxstd: "03,11,14,1z"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set DEVELOPER_DIR
if: matrix.xcode_version != ''
run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer" >> $GITHUB_ENV
- name: Test DEVELOPER_DIR
run: echo $DEVELOPER_DIR
- name: "osx"
shell: bash
env:
CXX: ${{ matrix.cxx }}
SOURCES: ${{ matrix.sources }}
LLVM_OS: ${{ matrix.llvm_os }}
LLVM_VER: ${{ matrix.llvm_ver }}
PACKAGES: ${{ matrix.packages }}
JOB_BUILDTYPE: ${{ matrix.buildtype }}
TOOLSET: ${{ matrix.toolset }}
CXXSTD: ${{ matrix.cxxstd }}
COMPILER: ${{ matrix.compiler }}
TRAVIS_BRANCH: ${{ github.base_ref }}
TRAVIS_OS_NAME: "osx"
run: |
echo '==================================> SETUP'
set -e
sudo mv /Library/Developer/CommandLineTools /Library/Developer/CommandLineTools.bck
echo '==================================> PACKAGES'
echo '==================================> INSTALL AND COMPILE'
set -e
export TRAVIS_BUILD_DIR=$(pwd)
export TRAVIS_BRANCH=${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')}
export VCS_COMMIT_ID=$GITHUB_SHA
export GIT_COMMIT=$GITHUB_SHA
export REPO_NAME=$(basename $GITHUB_REPOSITORY)
export USER=$(whoami)
export CC=${CC:-gcc}
export PATH=~/.local/bin:/usr/local/bin:$PATH
if [ "$JOB_BUILDTYPE" == "boost" ]; then
echo '==================================> INSTALL'
BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
cd ..
git clone --depth 1 -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule init libs/array
git submodule init libs/assert
git submodule init libs/bind
git submodule init libs/concept_check
git submodule init libs/config
git submodule init libs/container_hash
git submodule init libs/conversion
git submodule init libs/core
git submodule init libs/detail
git submodule init libs/function
git submodule init libs/function_types
git submodule init libs/functional
git submodule init libs/integer
git submodule init libs/iterator
git submodule init libs/lambda
git submodule init libs/move
git submodule init libs/mpl
git submodule init libs/optional
git submodule init libs/predef
git submodule init libs/preprocessor
git submodule init libs/smart_ptr
git submodule init libs/static_assert
git submodule init libs/throw_exception
git submodule init libs/tuple
git submodule init libs/type_index
git submodule init libs/type_traits
git submodule init libs/typeof
git submodule init libs/utility
git submodule init libs/headers tools/boost_install tools/build
git submodule update
rm -rf libs/fusion
cp -rp $TRAVIS_BUILD_DIR libs/fusion
ln -s $(pwd)/libs/fusion $TRAVIS_BUILD_DIR
./bootstrap.sh
./b2 headers
echo '==================================> SCRIPT'
./b2 -j`(nproc || sysctl -n hw.ncpu) 2> /dev/null` libs/fusion/test toolset=$TOOLSET cxxstd=$CXXSTD
fi

View File

@ -23,4 +23,5 @@ target_link_libraries(boost_fusion
Boost::type_traits
Boost::typeof
Boost::utility
Boost::functional
)

View File

@ -11,15 +11,19 @@ environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-9.0
ADDRMD: 32
CXXSTD: latest # fake
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-10.0
ADDRMD: 32
CXXSTD: latest # fake
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-11.0
ADDRMD: 32
CXXSTD: latest # fake
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-12.0
ADDRMD: 32
CXXSTD: latest # fake
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-14.0
@ -88,4 +92,5 @@ install:
build: off
test_script:
- b2 -j%NUMBER_OF_PROCESSORS% --hash libs/fusion/test toolset=%TOOLSET% cxxstd=%CXXSTD%
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
- b2 -j%NUMBER_OF_PROCESSORS% --hash libs/fusion/test toolset=%TOOLSET% cxxstd=%CXXSTD% %ADDRMD%

View File

@ -1016,8 +1016,8 @@ __note_ref_wrappers__, __fusion_pair__
[section Tiers]
Tiers are sequences, where all elements are non-const reference types. They
are constructed with a call to a couple of /tie/ function templates. The
Tiers are sequences, where all elements are reference types. They are
constructed with a call to a couple of /tie/ function templates. The
succeeding sections document the various /tier/ flavors.
* __list_tie__

View File

@ -130,6 +130,7 @@
[def __reverse_view__ [link fusion.view.reverse_view `reverse_view`]]
[def __zip_view__ [link fusion.view.zip_view `zip_view`]]
[def __flatten_view__ [link fusion.view.flatten_view `flatten_view`]]
[def __identity_view__ [link fusion.view.identity_view `identity_view`]]
[def __array__ [link fusion.adapted.array array]]
[def __std_pair__ [link fusion.adapted.std__pair `std::pair`]]

View File

@ -163,6 +163,7 @@
<dt><span class="section"><a href="fusion/view/zip_view.html">zip_view</a></span></dt>
<dt><span class="section"><a href="fusion/view/transform_view.html">transform_view</a></span></dt>
<dt><span class="section"><a href="fusion/view/reverse_view.html">reverse_view</a></span></dt>
<dt><span class="section"><a href="fusion/view/identity_view.html">identity_view</a></span></dt>
<dt><span class="section"><a href="fusion/view/nview.html">nview</a></span></dt>
<dt><span class="section"><a href="fusion/view/repetitive_view.html">repetitive_view</a></span></dt>
<dt><span class="section"><a href="fusion/view/flatten_view.html">flatten_view</a></span></dt>

View File

@ -254,6 +254,7 @@ expressions must be valid:
* __iterator_range__ iterator (where adapted iterators are __associative_iterator__\ s)
* __joint_view__ iterator (where adapted sequences are __associative_sequence__\ s and __forward_sequence__\ s)
* __reverse_view__ iterator (where adapted sequence is an __associative_sequence__ and a __bidirectional_sequence__)
* __transform_view__ iterator (where adapted sequence is an __associative_sequence__ and a __forward_sequence__)
[endsect]

View File

@ -60,6 +60,7 @@ link against.
* single_view
* transform_view
* zip_view
* identity_view
* container
* deque
* list

View File

@ -133,6 +133,7 @@ For any Forward Sequence s the following invariants always hold:
* __transform_view__
* __reverse_view__
* __zip_view__
* __identity_view__
[endsect]
@ -166,7 +167,7 @@ Bidirectional Sequence the following must be met:
[[`__back__(s)`] [Any type] [] [Constant]]
[[`__back__(s) = o`] [Any type] [`s` is mutable and
`e = o`, where `e`
is the first element
is the last element
in the sequence, is
a valid expression.] [Constant]]
]
@ -201,6 +202,7 @@ are not defined in __forward_sequence__.
* __iterator_range__ (where adapted sequence is a Bidirectional Sequence)
* __transform_view__ (where adapted sequence is a Bidirectional Sequence)
* __zip_view__ (where adapted sequences are models of Bidirectional Sequence)
* __identity_view__ (where adapted sequence is a Bidirectional Sequence)
[endsect]
@ -237,14 +239,14 @@ any Random Access Sequence the following must be met:
[[`__at_c__<N>(s)`] [Any type] [] [Constant]]
[[`__at_c__<N>(s) = o`] [Any type] [`s` is mutable and
`e = o`, where `e`
is the first element
in the sequence, is
is the N-th element from the beginning
of the sequence, is
a valid expression.] [Constant]]
[[`__at__<M>(s)`] [Any type] [] [Constant]]
[[`__at__<M>(s) = o`] [Any type] [`s` is mutable and
`e = o`, where `e`
is the first element
in the sequence, is
is the M-th element from the beginning
of the sequence, is
a valid expression.] [Constant]]
]
@ -289,6 +291,7 @@ are not defined in __bidirectional_sequence__.
* __iterator_range__ (where adapted sequence is a Random Access Sequence)
* __transform_view__ (where adapted sequence is a Random Access Sequence)
* __zip_view__ (where adapted sequences are models of Random Access Sequence)
* __identity_view__ (where adapted sequence is a Random Access Sequence)
[endsect]
@ -321,8 +324,7 @@ For any Associative Sequence the following expressions must be valid:
[[`__at_key__<K>(s)`] [Any type] [] [Constant]]
[[`__at_key__<K>(s) = o`] [Any type] [`s` is mutable and
`e = o`, where `e`
is the first element
in the sequence, is
is the element associated with K, is
a valid expression.] [Constant]]
]
@ -361,6 +363,8 @@ you can use `__result_of_value_at_key__<S, K>`.]
* __iterator_range__ (where adapted iterators are __associative_iterator__\ s)
* __joint_view__ (where adapted sequences are __associative_sequence__\ s and __forward_sequence__\ s)
* __reverse_view__ (where adapted sequence is an __associative_sequence__ and a __bidirectional_sequence__)
* __transform_view__ (where adapted sequence is an __associative_sequence__ and a __forward_sequence__)
* __identity_view__ (where adapted sequence is an __associative_sequence__ and a __forward_sequence__)
[endsect]
@ -714,11 +718,11 @@ Returns the M-th element from the beginning of the sequence.
[heading Synopsis]
template <typename M, typename Sequence>
typename __result_of_at__<Sequence, N>::type
typename __result_of_at__<Sequence, M>::type
at(Sequence& seq);
template <typename M, typename Sequence>
typename __result_of_at__<Sequence const, N>::type
typename __result_of_at__<Sequence const, M>::type
at(Sequence const& seq);
[heading Parameters]

View File

@ -1,6 +1,7 @@
[/==============================================================================
Copyright (C) 2001-2011 Joel de Guzman
Copyright (C) 2006 Dan Marsden
Copyright (c) 2022 Denis Mikhailov
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -328,9 +329,7 @@ defined in __forward_sequence__.
The unary version of `transform_view` presents a view of its underlying
sequence given a unary function object or function pointer. The binary
version of `transform_view` presents a view of 2 underlying sequences,
given a binary function object or function pointer. The `transform_view`
inherits the traversal characteristics (see __traversal_concept__) of
its underlying sequence or sequences.
given a binary function object or function pointer.
[heading Header]
@ -364,7 +363,8 @@ its underlying sequence or sequences.
* __forward_sequence__, __bidirectional_sequence__ or
__random_access_sequence__ depending on the traversal characteristics (see
__traversal_concept__) of its underlying sequence.
__traversal_concept__) of its underlying sequence or sequences.
* __associative_sequence__ if underlying sequence implements the __associative_sequence__ model(available only with unary version of `transform_view`).
[variablelist Notation
[[`TV`] [A `transform_view` type]]
@ -381,9 +381,7 @@ __traversal_concept__) of its underlying sequence.
[heading Expression Semantics]
Semantics of an expression is defined only where it differs from, or is not
defined in __forward_sequence__, __bidirectional_sequence__ or
__random_access_sequence__ depending on the traversal characteristics (see
__traversal_concept__) of its underlying sequence or sequences.
defined in the implemented models.
[table
[[Expression] [Semantics]]
@ -667,4 +665,60 @@ defined in __forward_sequence__.
[endsect]
[section identity_view]
[heading Description]
`identity_view` presents underlying sequence unchanged.
[heading Header]
#include <boost/fusion/view/identity_view.hpp>
#include <boost/fusion/include/identity_view.hpp>
[heading Synopsis]
template <typename Sequence>
struct identity_view;
[heading Template parameters]
[table
[[Parameter] [Description] [Default]]
[[`Sequence`] [A __forward_sequence__] []]
]
[heading Model of]
* A model of __forward_sequence__ if `Sequence` is a __forward_sequence__ else, __bidirectional_sequence__ if `Sequence` is a __bidirectional_sequence__
else, __random_access_sequence__ if `Sequence` is a __random_access_sequence__.
* __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.
[variablelist Notation
[[`IV`] [An `identity_view` type]]
[[`s`] [An instance of `Sequence`]]
[[`iv`, `iv2`] [Instances of `identity_view`]]
]
[heading Expression Semantics]
Semantics of an expression is defined only where it differs from, or is not
defined in the implemented models.
[table
[[Expression] [Semantics]]
[[`IV(s)`] [Creates an `identity_view` given sequence, `s`.]]
[[`IV(iv)`] [Copy constructs an `identity_view` from another `identity_view`, `iv`.]]
[[`iv = iv2`] [Assigns to an `identity_view`, `iv`, from another `identity_view`, `iv2`.]]
]
[heading Example]
typedef __vector__<int, short, double> vector_type;
vector_type vec(2, 5, 3.3);
__identity_view__<vector_type> identity(vec);
std::cout << identity << std::endl; // (2 5 3.3)
[endsect]
[endsect]

View File

@ -46,7 +46,7 @@
#include <boost/mpl/max.hpp>
#include <boost/mpl/next.hpp>
#include <boost/ref.hpp>
#include <boost/core/ref.hpp>
#include <iostream>
#include <typeinfo>

View File

@ -18,6 +18,11 @@
#include <boost/type_traits/is_const.hpp>
#include <boost/fusion/iterator/iterator_facade.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct random_access_traversal_tag;
@ -102,11 +107,13 @@ namespace boost { namespace fusion
return type();
}
};
BOOST_DELETED_FUNCTION(array_iterator& operator=(array_iterator const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -45,6 +45,10 @@ namespace boost { namespace fusion
template <typename Cons>
struct boost_tuple_iterator_identity;
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
template <typename Cons = tuples::null_type>
struct boost_tuple_iterator
: iterator_facade<boost_tuple_iterator<Cons>, forward_traversal_tag>
@ -143,10 +147,10 @@ namespace boost { namespace fusion
struct equal_to
: is_same<typename I1::identity, typename I2::identity>
{};
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(boost_tuple_iterator& operator= (boost_tuple_iterator const&))
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
template <typename Null>
struct boost_tuple_null_iterator

View File

@ -19,6 +19,11 @@
#include <boost/fusion/iterator/iterator_facade.hpp>
#include <boost/fusion/adapted/std_array/detail/array_size.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct random_access_traversal_tag;
@ -99,9 +104,11 @@ namespace boost { namespace fusion
return type();
}
};
BOOST_DELETED_FUNCTION(std_array_iterator& operator=(std_array_iterator const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -17,6 +17,11 @@
#include <tuple>
#include <utility>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct random_access_traversal_tag;
@ -107,6 +112,10 @@ namespace boost { namespace fusion
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -326,6 +326,9 @@
#define BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR_IMPL_IMPL( \
NAME, ATTRIBUTES_SEQ, ATTRIBUTES_SEQ_SIZE) \
\
BOOST_FUSION_PUSH_WARNINGS \
BOOST_FUSION_DISABLE_MSVC_WARNING(4512) \
\
template <typename boost_fusion_detail_Seq, int N> \
struct BOOST_FUSION_ITERATOR_NAME(NAME) \
: boost::fusion::iterator_facade< \
@ -418,7 +421,10 @@
return type(it.seq_); \
} \
}; \
};
}; \
\
BOOST_FUSION_POP_WARNINGS \
/**/
#define BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL( \

View File

@ -19,6 +19,9 @@
\
BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_BEGIN(NAMESPACE_SEQ) \
\
BOOST_FUSION_PUSH_WARNINGS \
BOOST_FUSION_DISABLE_MSVC_WARNING(4512) \
\
struct NAME \
{ \
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
@ -27,10 +30,10 @@
{} \
\
WRAPPED_TYPE& obj; \
\
BOOST_DELETED_FUNCTION(NAME& operator= (NAME const&)) \
}; \
\
BOOST_FUSION_POP_WARNINGS \
\
BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_END(NAMESPACE_SEQ)
#define BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE( \

View File

@ -14,6 +14,10 @@
namespace boost { namespace fusion { namespace detail
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
template <typename Fun>
struct segmented_fold_fun
{
@ -37,6 +41,9 @@ namespace boost { namespace fusion { namespace detail
}
};
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
// The default implementation of this lives in detail/fold.hpp
template <typename Sequence, typename State, typename Fun, bool IsSequence, bool IsSegmented>

View File

@ -13,6 +13,11 @@
#include <boost/fusion/algorithm/iteration/for_each_fwd.hpp>
#include <boost/fusion/support/segmented_fold_until.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion { namespace detail
{
template <typename Fun>
@ -49,4 +54,8 @@ namespace boost { namespace fusion { namespace detail
}
}}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -18,6 +18,11 @@
#include <boost/mpl/int.hpp>
#include <boost/mpl/if.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
template <typename Iterator_, bool IsLast>
@ -168,5 +173,9 @@ namespace boost { namespace fusion
}
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -20,6 +20,11 @@
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion {
struct bidirectional_traversal_tag;
@ -110,13 +115,14 @@ namespace boost { namespace fusion {
{};
Seq& seq_;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(deque_iterator& operator= (deque_iterator const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -26,6 +26,10 @@ namespace boost { namespace fusion
template <typename Cons>
struct cons_iterator_identity;
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
template <typename Cons = nil_>
struct cons_iterator : iterator_base<cons_iterator<Cons> >
{
@ -41,10 +45,10 @@ namespace boost { namespace fusion
: cons(in_cons) {}
cons_type& cons;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(cons_iterator& operator= (cons_iterator const&))
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
struct nil_iterator : iterator_base<nil_iterator>
{

View File

@ -17,6 +17,11 @@
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_const.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct random_access_traversal_tag;
@ -155,13 +160,13 @@ namespace boost { namespace fusion
{};
Seq& seq_;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(map_iterator& operator= (map_iterator const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -220,21 +220,12 @@ namespace boost { namespace fusion
void
assign_sequence(Sequence&& seq)
{
assign(std::forward<Sequence>(seq), detail::index_sequence<I...>());
}
template <typename Sequence>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
void
assign(Sequence&&, detail::index_sequence<>) {}
template <typename Sequence, std::size_t N, std::size_t ...M>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
void
assign(Sequence&& seq, detail::index_sequence<N, M...>)
{
at_impl(mpl::int_<N>()) = vector_detail::forward_at_c<N>(seq);
assign(std::forward<Sequence>(seq), detail::index_sequence<M...>());
#ifndef BOOST_NO_CXX17_FOLD_EXPRESSIONS
(void(store<I, T>::elem = vector_detail::forward_at_c<I>(static_cast<Sequence&&>(seq))), ...);
#else
int nofold[] = { (void(store<I, T>::elem = vector_detail::forward_at_c<I>(static_cast<Sequence&&>(seq))), 0)..., 0 };
(void)nofold;
#endif
}
private:

View File

@ -19,6 +19,11 @@
#include <boost/type_traits/add_const.hpp>
#include <boost/mpl/int.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct vector_iterator_tag;
@ -41,17 +46,14 @@ namespace boost { namespace fusion
vector_iterator(Vector& in_vec)
: vec(in_vec) {}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
vector_iterator(vector_iterator const& rhs)
: vec(rhs.vec) {}
Vector& vec;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(vector_iterator& operator= (vector_iterator const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -0,0 +1,12 @@
/*=============================================================================
Copyright (c) 2022 Denis Mikhailov
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)
==============================================================================*/
#if !defined(FUSION_INCLUDE_IDENTITY_VIEW)
#define FUSION_INCLUDE_IDENTITY_VIEW
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/view/identity_view.hpp>
#endif

View File

@ -13,6 +13,11 @@
#include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion { namespace detail
{
struct segment_sequence_tag {};
@ -36,6 +41,10 @@ namespace boost { namespace fusion { namespace detail
};
}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
namespace extension
{
template<typename Tag>

View File

@ -19,6 +19,11 @@
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/type_traits/remove_const.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
template <typename Derived_, typename Iterator_,
@ -135,6 +140,10 @@ namespace boost { namespace fusion
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -75,6 +75,10 @@ namespace boost { namespace fusion
}
};
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
template <typename Tag, typename Stream>
class string_ios_manip
{
@ -143,10 +147,10 @@ namespace boost { namespace fusion
}
Stream& stream;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(string_ios_manip& operator= (string_ios_manip const&))
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // detail

View File

@ -127,4 +127,14 @@ namespace boost { namespace fusion { namespace detail
# define BOOST_FUSION_NOEXCEPT_ON_DEFAULTED BOOST_NOEXCEPT
#endif
#ifdef _MSC_VER
# define BOOST_FUSION_PUSH_WARNINGS __pragma(warning(push))
# define BOOST_FUSION_POP_WARNINGS __pragma(warning(pop))
# define BOOST_FUSION_DISABLE_MSVC_WARNING(num) __pragma(warning(disable : num))
#else
# define BOOST_FUSION_PUSH_WARNINGS
# define BOOST_FUSION_POP_WARNINGS
# define BOOST_FUSION_DISABLE_MSVC_WARNING(num)
#endif
#endif

View File

@ -10,7 +10,7 @@
#define BOOST_FUSION_SUPPORT_DEDUCE_HPP_INCLUDED
#include <boost/fusion/support/config.hpp>
#include <boost/ref.hpp>
#include <boost/core/ref.hpp>
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
#include <functional>

View File

@ -9,7 +9,7 @@
#define FUSION_AS_FUSION_ELEMENT_05052005_0338
#include <boost/fusion/support/config.hpp>
#include <boost/ref.hpp>
#include <boost/core/ref.hpp>
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
#include <functional>

View File

@ -17,5 +17,6 @@
#include <boost/fusion/view/transform_view.hpp>
#include <boost/fusion/view/zip_view.hpp>
#include <boost/fusion/view/flatten_view.hpp>
#include <boost/fusion/view/identity_view.hpp>
#endif

View File

@ -22,6 +22,11 @@
#include <boost/mpl/inherit.hpp>
#include <boost/mpl/identity.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct filter_view_tag;
@ -51,22 +56,18 @@ namespace boost { namespace fusion
: seq(in_seq)
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
filter_view(filter_view const& rhs)
: seq(rhs.seq)
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
first_type first() const { return fusion::begin(seq); }
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
last_type last() const { return fusion::end(seq); }
typename mpl::if_<traits::is_view<Sequence>, Sequence, Sequence&>::type seq;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(filter_view& operator= (filter_view const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -26,6 +26,11 @@
#include <boost/fusion/view/filter_view/detail/value_of_data_impl.hpp>
#include <boost/fusion/view/filter_view/detail/key_of_impl.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct filter_view_iterator_tag;
@ -59,17 +64,14 @@ namespace boost { namespace fusion
filter_iterator(First const& in_first)
: first(filter::iter_call(first_converter::call(in_first))) {}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
filter_iterator(filter_iterator const& rhs)
: first(rhs.first) {}
first_type first;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(filter_iterator& operator= (filter_iterator const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -19,6 +19,10 @@
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/view/flatten_view/flatten_view_iterator.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
@ -52,6 +56,10 @@ namespace boost { namespace fusion
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
namespace boost { namespace fusion { namespace extension
{
template<>

View File

@ -19,6 +19,10 @@
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
@ -46,6 +50,10 @@ namespace boost { namespace fusion
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
namespace boost { namespace fusion { namespace detail
{
template<class Iterator, class = void>

View File

@ -0,0 +1,14 @@
/*=============================================================================
Copyright (c) 2022 Denis Mikhailov
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)
==============================================================================*/
#if !defined(BOOST_FUSION_SEQUENCE_IDENTITY_VIEW_HPP_INCLUDED)
#define BOOST_FUSION_SEQUENCE_IDENTITY_VIEW_HPP_INCLUDED
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/view/identity_view/identity_view.hpp>
#endif

View File

@ -0,0 +1,50 @@
/*=============================================================================
Copyright (c) 2022 Denis Mikhailov
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)
==============================================================================*/
#if !defined(BOOST_FUSION_IDENTITY_VIEW_HPP_INCLUDED)
#define BOOST_FUSION_IDENTITY_VIEW_HPP_INCLUDED
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/view/transform_view.hpp>
#include <boost/functional/identity.hpp>
#include <boost/utility/result_of.hpp>
namespace boost { namespace fusion {
namespace detail {
struct identity : boost::identity
{
};
}
}}
namespace boost {
template<typename T>
struct result_of<fusion::detail::identity(T)>
{
typedef T type;
};
}
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion {
template<typename Sequence> struct identity_view
: transform_view<Sequence, detail::identity>
{
typedef transform_view<Sequence, detail::identity> base_type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
identity_view(Sequence& in_seq)
: base_type(in_seq, detail::identity()) {}
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -25,6 +25,11 @@
#include <boost/mpl/inherit.hpp>
#include <boost/mpl/identity.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct joint_view_tag;
@ -69,15 +74,16 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
concat_last_type concat_last() const { return fusion::end(seq2); }
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(joint_view& operator= (joint_view const&))
private:
typename mpl::if_<traits::is_view<Sequence1>, Sequence1, Sequence1&>::type seq1;
typename mpl::if_<traits::is_view<Sequence2>, Sequence2, Sequence2&>::type seq2;
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -20,6 +20,11 @@
#include <boost/fusion/view/joint_view/detail/key_of_impl.hpp>
#include <boost/static_assert.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct joint_view_iterator_tag;
@ -49,12 +54,13 @@ namespace boost { namespace fusion
first_type first;
concat_type concat;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(joint_view_iterator& operator= (joint_view_iterator const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -26,6 +26,11 @@
#include <boost/fusion/view/nview/detail/distance_impl.hpp>
#include <boost/fusion/view/nview/detail/equal_to_impl.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct nview_iterator_tag;
@ -46,13 +51,14 @@ namespace boost { namespace fusion
: seq(in_seq) {}
Sequence& seq;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(nview_iterator& operator= (nview_iterator const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -18,6 +18,10 @@
#include <boost/fusion/view/repetitive_view/detail/begin_impl.hpp>
#include <boost/fusion/view/repetitive_view/detail/end_impl.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
@ -43,11 +47,12 @@ namespace boost { namespace fusion
: seq(in_seq) {}
stored_seq_type seq;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(repetitive_view& operator= (repetitive_view const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -19,6 +19,11 @@
#include <boost/fusion/view/repetitive_view/detail/next_impl.hpp>
#include <boost/fusion/view/repetitive_view/detail/value_of_impl.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct repetitive_view_iterator_tag;
@ -46,12 +51,13 @@ namespace boost { namespace fusion
Sequence& seq;
pos_type pos;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(repetitive_view_iterator& operator= (repetitive_view_iterator const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -1,5 +1,6 @@
/*=============================================================================
Copyright (c) 2009 Christopher Schmidt
Copyright (c) 2021-2022 Denis Mikhailov
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)
@ -10,6 +11,7 @@
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/deref_data.hpp>
#include <boost/fusion/iterator/prior.hpp>
namespace boost { namespace fusion { namespace extension
{
@ -23,14 +25,18 @@ namespace boost { namespace fusion { namespace extension
struct apply
{
typedef typename
result_of::deref_data<typename It::first_type>::type
result_of::deref_data<
typename result_of::prior<
typename It::first_type
>::type
>::type
type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(It const& it)
{
return fusion::deref_data(it.first);
return fusion::deref_data(fusion::prior(it.first));
}
};
};

View File

@ -1,5 +1,6 @@
/*=============================================================================
Copyright (c) 2009 Christopher Schmidt
Copyright (c) 2021-2022 Denis Mikhailov
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)
@ -10,6 +11,7 @@
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/key_of.hpp>
#include <boost/fusion/iterator/prior.hpp>
namespace boost { namespace fusion { namespace extension
{
@ -21,8 +23,15 @@ namespace boost { namespace fusion { namespace extension
{
template <typename It>
struct apply
: result_of::key_of<typename It::it_type>
{};
{
typedef typename
result_of::key_of<
typename result_of::prior<
typename It::first_type
>::type
>::type
type;
};
};
}}}

View File

@ -1,5 +1,6 @@
/*=============================================================================
Copyright (c) 2009 Christopher Schmidt
Copyright (c) 2021-2022 Denis Mikhailov
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)
@ -10,6 +11,7 @@
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/value_of_data.hpp>
#include <boost/fusion/iterator/prior.hpp>
namespace boost { namespace fusion { namespace extension
{
@ -21,8 +23,15 @@ namespace boost { namespace fusion { namespace extension
{
template <typename It>
struct apply
: result_of::value_of_data<typename It::first_type>
{};
{
typedef typename
result_of::value_of_data<
typename result_of::prior<
typename It::first_type
>::type
>::type
type;
};
};
}}}

View File

@ -27,6 +27,11 @@
#include <boost/mpl/inherit.hpp>
#include <boost/mpl/identity.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct reverse_view_tag;
@ -60,12 +65,13 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
last_type last() const { return fusion::end(seq); }
typename mpl::if_<traits::is_view<Sequence>, Sequence, Sequence&>::type seq;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(reverse_view& operator= (reverse_view const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -24,6 +24,11 @@
#include <boost/type_traits/is_base_of.hpp>
#include <boost/static_assert.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct reverse_view_iterator_tag;
@ -47,12 +52,13 @@ namespace boost { namespace fusion
: first(converter::call(in_first)) {}
first_type first;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(reverse_view_iterator& operator= (reverse_view_iterator const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -20,6 +20,11 @@
#include <boost/fusion/view/single_view/detail/value_of_impl.hpp>
#include <boost/config.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct single_view_iterator_tag;
@ -40,11 +45,13 @@ namespace boost { namespace fusion
: view(in_view) {}
SingleView& view;
BOOST_DELETED_FUNCTION(single_view_iterator& operator=(single_view_iterator const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -0,0 +1,71 @@
/*=============================================================================
Copyright (c) 2022 Denis Mikhailov
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)
==============================================================================*/
#if !defined(BOOST_FUSION_TRANSFORM_VIEW_DEREF_DATA_IMPL_JAN_9_2022_0354PM)
#define BOOST_FUSION_TRANSFORM_VIEW_DEREF_DATA_IMPL_JAN_9_2022_0354PM
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/utility/result_of.hpp>
namespace boost { namespace fusion
{
struct transform_view_iterator_tag;
struct transform_view_iterator2_tag;
namespace extension
{
template<typename Tag>
struct deref_data_impl;
// Unary Version
template<>
struct deref_data_impl<transform_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename
result_of::deref<typename Iterator::first_type>::type
value_type;
typedef typename Iterator::transform_type F;
typedef typename boost::result_of<F(value_type)>::type transformed_type;
typedef typename boost::remove_reference<transformed_type>::type transformed_type_unref;
typedef typename boost::remove_const<transformed_type_unref>::type transformed_type_unconst;
typedef typename transformed_type_unconst::second_type raw_type;
typedef typename
boost::mpl::if_<
is_reference<transformed_type>
, typename boost::mpl::if_<
is_const<transformed_type_unref>
, typename boost::add_reference<typename boost::add_const<raw_type>::type>::type
, typename boost::add_reference<raw_type>::type
>::type
, raw_type
>::type
type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& i)
{
return i.f(fusion::deref(i.first)).second;
}
};
};
// Binary Version is not supported with Associative Sequence
}
}}
#endif

View File

@ -0,0 +1,47 @@
/*=============================================================================
Copyright (c) 2022 Denis Mikhailov
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)
==============================================================================*/
#if !defined(BOOST_FUSION_TRANSFORM_VIEW_KEY_OF_IMPL_JAN_9_2022_0354PM)
#define BOOST_FUSION_TRANSFORM_VIEW_KEY_OF_IMPL_JAN_9_2022_0354PM
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/utility/result_of.hpp>
namespace boost { namespace fusion
{
struct transform_view_iterator_tag;
struct transform_view_iterator2_tag;
namespace extension
{
template<typename Tag>
struct key_of_impl;
// Unary Version
template<>
struct key_of_impl<transform_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename
result_of::deref<typename Iterator::first_type>::type
value_type;
typedef typename Iterator::transform_type F;
typedef typename boost::result_of<F(value_type)>::type transformed_type;
typedef typename boost::remove_reference<transformed_type>::type transformed_type_unref;
typedef typename boost::remove_const<transformed_type_unref>::type transformed_type_unconst;
typedef typename transformed_type_unconst::first_type type;
};
};
// Binary Version is not supported with Associative Sequence
}
}}
#endif

View File

@ -0,0 +1,47 @@
/*=============================================================================
Copyright (c) 2022 Denis Mikhailov
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)
==============================================================================*/
#if !defined(BOOST_FUSION_TRANSFORM_VIEW_VALUE_OF_IMPL_JAN_9_2022_0354PM)
#define BOOST_FUSION_TRANSFORM_VIEW_VALUE_OF_IMPL_JAN_9_2022_0354PM
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/utility/result_of.hpp>
namespace boost { namespace fusion
{
struct transform_view_iterator_tag;
struct transform_view_iterator2_tag;
namespace extension
{
template<typename Tag>
struct value_of_data_impl;
// Unary Version
template<>
struct value_of_data_impl<transform_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename
result_of::deref<typename Iterator::first_type>::type
value_type;
typedef typename Iterator::transform_type F;
typedef typename boost::result_of<F(value_type)>::type transformed_type;
typedef typename boost::remove_reference<transformed_type>::type transformed_type_unref;
typedef typename boost::remove_const<transformed_type_unref>::type transformed_type_unconst;
typedef typename transformed_type_unconst::second_type type;
};
};
// Binary Version is not supported with Associative Sequence
}
}}
#endif

View File

@ -27,6 +27,11 @@
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/mpl/bool.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
struct void_;
@ -75,9 +80,6 @@ namespace boost { namespace fusion
transform_type f;
typename mpl::if_<traits::is_view<Sequence1>, Sequence1, Sequence1&>::type seq1;
typename mpl::if_<traits::is_view<Sequence2>, Sequence2, Sequence2&>::type seq2;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(transform_view& operator= (transform_view const&))
};
// Unary Version
@ -111,12 +113,13 @@ namespace boost { namespace fusion
last_type last() const { return fusion::end(seq); }
typename mpl::if_<traits::is_view<Sequence>, Sequence, Sequence&>::type seq;
transform_type f;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(transform_view& operator= (transform_view const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -19,6 +19,14 @@
#include <boost/fusion/view/transform_view/detail/advance_impl.hpp>
#include <boost/fusion/view/transform_view/detail/distance_impl.hpp>
#include <boost/fusion/view/transform_view/detail/equal_to_impl.hpp>
#include <boost/fusion/view/transform_view/detail/key_of_impl.hpp>
#include <boost/fusion/view/transform_view/detail/value_of_data_impl.hpp>
#include <boost/fusion/view/transform_view/detail/deref_data_impl.hpp>
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
namespace boost { namespace fusion
{
@ -41,9 +49,6 @@ namespace boost { namespace fusion
first_type first;
transform_type f;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(transform_view_iterator& operator= (transform_view_iterator const&))
};
// Binary Version
@ -68,12 +73,13 @@ namespace boost { namespace fusion
first1_type first1;
first2_type first2;
transform_type f;
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(transform_view_iterator2& operator= (transform_view_iterator2 const&))
};
}}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{

View File

@ -156,6 +156,7 @@ project
: <define>BOOST_FUSION_DISABLE_VARIADIC_VECTOR
: tuple_traits__no_variadic ]
[ run sequence/transform_view.cpp ]
[ run sequence/identity_view.cpp ]
[ run sequence/vector_comparison.cpp ]
[ run sequence/vector_construction.cpp ]
[ run sequence/vector_conversion.cpp ]

View File

@ -9,7 +9,7 @@
#include <boost/fusion/functional/adapter/fused.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/container/vector.hpp>

View File

@ -9,7 +9,7 @@
#include <boost/fusion/functional/adapter/fused_function_object.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/mpl/empty_base.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>

View File

@ -9,7 +9,7 @@
#include <boost/fusion/functional/adapter/fused_procedure.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/mpl/empty_base.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>

View File

@ -16,7 +16,7 @@
#endif
#include <memory>
#include <boost/noncopyable.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/type_traits/is_same.hpp>

View File

@ -17,7 +17,7 @@
#include <boost/type_traits/is_same.hpp>
#include <memory>
#include <boost/noncopyable.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/mpl/int.hpp>

View File

@ -16,7 +16,7 @@
#endif
#include <memory>
#include <boost/noncopyable.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/mpl/int.hpp>

View File

@ -9,7 +9,7 @@
#include <boost/fusion/functional/generation/make_fused.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/mpl/empty_base.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>

View File

@ -9,7 +9,7 @@
#include <boost/fusion/functional/generation/make_fused_function_object.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/mpl/empty_base.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>

View File

@ -9,7 +9,7 @@
#include <boost/fusion/functional/generation/make_fused_procedure.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/mpl/empty_base.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>

View File

@ -9,7 +9,7 @@
#include <boost/fusion/functional/generation/make_unfused.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/mpl/empty_base.hpp>
#include <boost/mpl/if.hpp>
@ -19,11 +19,11 @@
#include <boost/utility/result_of.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/core/ref.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/algorithm/iteration/fold.hpp>
#include <boost/ref.hpp>
namespace fusion = boost::fusion;
namespace mpl = boost::mpl;

View File

@ -9,7 +9,7 @@
#include <boost/fusion/functional/adapter/unfused.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/mpl/empty_base.hpp>
#include <boost/mpl/identity.hpp>

View File

@ -9,7 +9,7 @@
#include <boost/fusion/functional/adapter/unfused_typed.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/mpl/empty_base.hpp>
#include <boost/mpl/identity.hpp>

View File

@ -13,7 +13,7 @@
#include <boost/mpl/equal.hpp>
#include <boost/ref.hpp>
#include <boost/core/ref.hpp>
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
#include <functional>
#endif

View File

@ -0,0 +1,193 @@
/*=============================================================================
Copyright (c) 2022 Denis Mikhailov
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 <boost/detail/lightweight_test.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/container/map/map.hpp>
#include <boost/fusion/container/generation/make_map.hpp>
#include <boost/fusion/algorithm/auxiliary/copy.hpp>
#include <boost/fusion/adapted/mpl.hpp>
#include <boost/fusion/sequence/io/out.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/sequence/comparison/equal_to.hpp>
#include <boost/fusion/view/identity_view/identity_view.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
#include <boost/fusion/sequence/intrinsic/has_key.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/distance.hpp>
#include <boost/fusion/iterator/key_of.hpp>
#include <boost/fusion/iterator/deref_data.hpp>
#include <boost/fusion/iterator/value_of_data.hpp>
#include <boost/fusion/support/pair.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/mpl/range_c.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/map.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/static_assert.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/type_traits/remove_reference.hpp>
struct abstract
{
virtual void foo() = 0;
};
int
main()
{
using namespace boost::fusion;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
std::cout << tuple_delimiter(", ");
/// Testing the identity_view
{
typedef boost::mpl::range_c<int, 5, 9> sequence_type;
sequence_type sequence;
typedef identity_view<sequence_type> xform_type;
xform_type xform(sequence);
std::cout << xform << std::endl;
BOOST_TEST((xform == make_vector(5, 6, 7, 8)));
typedef boost::fusion::result_of::begin<xform_type>::type first_type;
first_type first_it(boost::fusion::begin(xform));
typedef boost::fusion::result_of::next<first_type>::type next_type;
next_type next_it(boost::fusion::next(first_it));
BOOST_TEST((*next_it == 6));
BOOST_TEST((*boost::fusion::prior(next_it) == 5));
BOOST_TEST((boost::fusion::distance(first_it, next_it) == 1));
BOOST_TEST((*boost::fusion::advance_c<3>(boost::fusion::begin(xform)) == 8));
BOOST_TEST((boost::fusion::at_c<2>(xform) == 7));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_c<xform_type, 0>::type, boost::mpl::integral_c<int, 5> >));
}
{
typedef vector<int, int, int, int, int> sequence_type;
sequence_type seq;
identity_view<sequence_type> ident(seq);
copy(make_vector(1, 2, 3, 4, 5), ident);
std::cout << seq << std::endl;
BOOST_TEST((seq == make_vector(1, 2, 3, 4, 5)));
}
/// Associative
{
typedef map<
pair<int, char>
, pair<double, std::string>
, pair<abstract, int> >
map_type;
typedef identity_view<map_type> transformed_type;
BOOST_MPL_ASSERT((traits::is_associative<transformed_type>));
BOOST_MPL_ASSERT((traits::is_random_access<transformed_type>));
map_type m(
make_pair<int>('X')
, make_pair<double>("Men")
, make_pair<abstract>(2));
transformed_type t(m);
std::cout << at_key<int>(t) << std::endl;
std::cout << at_key<double>(t) << std::endl;
std::cout << at_key<abstract>(t) << std::endl;
BOOST_TEST(at_key<int>(t) == 'X');
BOOST_TEST(at_key<double>(t) == "Men");
BOOST_TEST(at_key<abstract>(t) == 2);
BOOST_STATIC_ASSERT((
boost::is_same<boost::fusion::result_of::value_at_key<transformed_type, int>::type, char>::value));
BOOST_STATIC_ASSERT((
boost::is_same<boost::fusion::result_of::value_at_key<transformed_type, double>::type, std::string>::value));
BOOST_STATIC_ASSERT((
boost::is_same<boost::fusion::result_of::value_at_key<transformed_type, abstract>::type, int>::value));
std::cout << t << std::endl;
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<transformed_type, int>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<transformed_type, double>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<transformed_type, abstract>::value));
BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key<transformed_type, std::string>::value));
std::cout << deref_data(begin(t)) << std::endl;
std::cout << deref_data(boost::fusion::next(begin(t))) << std::endl;
BOOST_TEST(deref_data(begin(t)) == 'X');
BOOST_TEST(deref_data(boost::fusion::next(begin(t))) == "Men");
BOOST_TEST(deref_data(boost::fusion::next(next(begin(t)))) == 2);
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<transformed_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<transformed_type>::type>::type>::type, double>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<transformed_type>::type>::type>::type>::type, abstract>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<transformed_type>::type>::type, char>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<transformed_type>::type>::type>::type, std::string>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<transformed_type>::type>::type>::type>::type, int>::value));
// Test random access interface.
pair<int, char> a = at_c<0>(t); (void) a;
pair<double, std::string> b = at_c<1>(t);
pair<abstract, int> c = at_c<2>(t);
(void)c;
typedef boost::fusion::result_of::begin<transformed_type>::type first;
typedef boost::fusion::result_of::next<first>::type second;
typedef boost::fusion::result_of::next<second>::type third;
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<first>::type, boost::fusion::pair<int, char> >));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<second>::type, boost::fusion::pair<double, std::string> >));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<third>::type, boost::fusion::pair<abstract, int> >));
}
{
// compile test only
// make sure result_of::deref_data returns a reference
typedef map<pair<float, int> > map_type;
typedef identity_view<map_type> transformed_type;
typedef boost::fusion::result_of::begin<transformed_type>::type i_type;
typedef boost::fusion::result_of::deref_data<i_type>::type r_type;
BOOST_STATIC_ASSERT((boost::is_same<r_type, int&>::value));
}
{
// compile test only
// make sure result_of::deref_data is const correct
typedef map<pair<float, int> > const map_type;
typedef identity_view<map_type> transformed_type;
typedef boost::fusion::result_of::begin<transformed_type>::type i_type;
typedef boost::fusion::result_of::deref_data<i_type>::type r_type;
BOOST_STATIC_ASSERT((boost::is_same<r_type, int const&>::value));
}
{
// compile test only
// make sure result_of::deref_data will not const for non-constant references
typedef map<pair<float, int&> > const map_type;
typedef identity_view<map_type> transformed_type;
typedef boost::fusion::result_of::begin<transformed_type>::type i_type;
typedef boost::fusion::result_of::deref_data<i_type>::type r_type;
BOOST_STATIC_ASSERT((boost::is_same<r_type, int&>::value));
}
return boost::report_errors();
}

View File

@ -1,5 +1,6 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2021-2022 Denis Mikhailov
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)
@ -15,6 +16,9 @@
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
#include <boost/fusion/sequence/intrinsic/has_key.hpp>
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/iterator/deref.hpp>
@ -102,6 +106,21 @@ main()
BOOST_TEST((at_c<2>(rev) == pair2("two")));
BOOST_TEST((at_c<3>(rev) == pair1("one")));
BOOST_TEST((at_c<4>(rev) == pair0("zero")));
BOOST_TEST(( has_key< boost::mpl::int_<0> >(rev)
&& has_key< boost::mpl::int_<4> >(rev)
&& !has_key< boost::mpl::int_<-1> >(rev)
&& !has_key< boost::mpl::int_<5> >(rev) ));
BOOST_TEST((at_key< boost::mpl::int_<0> >(rev) == "zero"));
BOOST_TEST((at_key< boost::mpl::int_<1> >(rev) == "one"));
BOOST_TEST((at_key< boost::mpl::int_<2> >(rev) == "two"));
BOOST_TEST((at_key< boost::mpl::int_<3> >(rev) == "three"));
BOOST_TEST((at_key< boost::mpl::int_<4> >(rev) == "four"));
BOOST_TEST(( (at_key< boost::mpl::int_<0> >(rev) = "new_zero") == "new_zero"
&& at_key< boost::mpl::int_<0> >(rev) == "new_zero" ));
BOOST_MPL_ASSERT((boost::mpl::and_<result_of::has_key<view_type, boost::mpl::int_<0> >
, boost::mpl::not_<result_of::has_key<view_type, boost::mpl::int_<-1> > > >));
BOOST_MPL_ASSERT((boost::is_same<result_of::at_key<view_type, boost::mpl::int_<0> >::type, std::string&>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<view_type, boost::mpl::int_<0> >::type, std::string>));
}
return boost::report_errors();

View File

@ -21,6 +21,10 @@
#include <boost/static_assert.hpp>
#include "tree.hpp"
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
struct ostream_fun
{
ostream_fun(std::ostream &sout)
@ -34,6 +38,9 @@ struct ostream_fun
private:
std::ostream & sout_;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
template<typename Tree>
void

View File

@ -1,11 +1,14 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2022 Denis Mikhailov
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 <boost/detail/lightweight_test.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/container/map/map.hpp>
#include <boost/fusion/container/generation/make_map.hpp>
#include <boost/fusion/adapted/mpl.hpp>
#include <boost/fusion/sequence/io/out.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
@ -14,15 +17,29 @@
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
#include <boost/fusion/sequence/intrinsic/has_key.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/distance.hpp>
#include <boost/fusion/iterator/key_of.hpp>
#include <boost/fusion/iterator/deref_data.hpp>
#include <boost/fusion/iterator/value_of_data.hpp>
#include <boost/fusion/support/pair.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/mpl/range_c.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/map.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/static_assert.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/type_traits/remove_reference.hpp>
struct square
{
@ -60,6 +77,85 @@ struct add
}
};
struct abstract
{
virtual void foo() = 0;
};
struct functor
{
typedef boost::fusion::pair<short, char> pair_0;
typedef boost::fusion::pair<double, std::string> pair_1;
typedef boost::fusion::pair<abstract, long> pair_2;
typedef boost::mpl::map<
boost::mpl::pair< boost::fusion::pair<int, char> , pair_0>
, boost::mpl::pair< pair_1 , pair_1>
, boost::mpl::pair< boost::fusion::pair<abstract, int> , pair_2>
> m;
template<typename Sig>
struct result;
template<class F, class T>
struct result<F(T)>
: boost::mpl::at<
m,
typename boost::remove_reference<T>::type
>
{};
pair_0 operator() (const boost::fusion::pair<int, char>& arg) const
{
return pair_0(arg.second);
}
pair_1 operator() (const pair_1 & arg) const
{
return pair_1(arg.second + "_transformed");
}
pair_2 operator() (const boost::fusion::pair<abstract, int>& arg) const
{
return pair_2(arg.second);
}
};
struct simple_identity
{
template<typename Sig>
struct result;
template<typename U>
struct result<simple_identity(U)>
{
typedef U type;
};
template<typename T>
T& operator() (T& arg) const
{
return arg;
}
};
struct simple_identity_nonref
{
template<typename Sig>
struct result;
template<typename U>
struct result<simple_identity_nonref(U)>
: boost::remove_reference<U>
{};
template<typename T>
T operator() (T arg) const
{
return arg;
}
};
int
main()
{
@ -110,6 +206,183 @@ main()
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_c<xform_type, 0>::type, int>));
}
/// Associative
{
typedef map<
pair<int, char>
, pair<double, std::string>
, pair<abstract, int> >
map_type;
typedef transform_view<map_type, functor> transformed_type;
BOOST_MPL_ASSERT((traits::is_associative<transformed_type>));
BOOST_MPL_ASSERT((traits::is_random_access<transformed_type>));
map_type m(
make_pair<int>('X')
, make_pair<double>("Men")
, make_pair<abstract>(2));
transformed_type t(m, functor());
std::cout << at_key<short>(t) << std::endl;
std::cout << at_key<double>(t) << std::endl;
std::cout << at_key<abstract>(t) << std::endl;
BOOST_TEST(at_key<short>(t) == 'X');
BOOST_TEST(at_key<double>(t) == "Men_transformed");
BOOST_TEST(at_key<abstract>(t) == 2);
BOOST_STATIC_ASSERT((
boost::is_same<boost::fusion::result_of::value_at_key<transformed_type, short>::type, char>::value));
BOOST_STATIC_ASSERT((
boost::is_same<boost::fusion::result_of::value_at_key<transformed_type, double>::type, std::string>::value));
BOOST_STATIC_ASSERT((
boost::is_same<boost::fusion::result_of::value_at_key<transformed_type, abstract>::type, long>::value));
std::cout << t << std::endl;
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<transformed_type, short>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<transformed_type, double>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<transformed_type, abstract>::value));
BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key<transformed_type, std::string>::value));
std::cout << deref_data(begin(t)) << std::endl;
std::cout << deref_data(boost::fusion::next(begin(t))) << std::endl;
BOOST_TEST(deref_data(begin(t)) == 'X');
BOOST_TEST(deref_data(boost::fusion::next(begin(t))) == "Men_transformed");
BOOST_TEST(deref_data(boost::fusion::next(next(begin(t)))) == 2);
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<transformed_type>::type>::type, short>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<transformed_type>::type>::type>::type, double>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<transformed_type>::type>::type>::type>::type, abstract>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<transformed_type>::type>::type, char>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<transformed_type>::type>::type>::type, std::string>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<transformed_type>::type>::type>::type>::type, long>::value));
// Test random access interface.
pair<short, char> a = at_c<0>(t); (void) a;
pair<double, std::string> b = at_c<1>(t);
pair<abstract, int> c = at_c<2>(t);
(void)c;
typedef boost::fusion::result_of::begin<transformed_type>::type first;
typedef boost::fusion::result_of::next<first>::type second;
typedef boost::fusion::result_of::next<second>::type third;
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<first>::type, boost::fusion::pair<short, char> >));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<second>::type, boost::fusion::pair<double, std::string> >));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<third>::type, boost::fusion::pair<abstract, long> >));
}
{
typedef map<
pair<int, char>
, pair<double, std::string>
, pair<abstract, int> >
map_type;
typedef transform_view<map_type, simple_identity> transformed_type;
BOOST_MPL_ASSERT((traits::is_associative<transformed_type>));
BOOST_MPL_ASSERT((traits::is_random_access<transformed_type>));
map_type m(
make_pair<int>('X')
, make_pair<double>("Men")
, make_pair<abstract>(2));
transformed_type t(m, simple_identity());
std::cout << at_key<int>(t) << std::endl;
std::cout << at_key<double>(t) << std::endl;
std::cout << at_key<abstract>(t) << std::endl;
BOOST_TEST(at_key<int>(t) == 'X');
BOOST_TEST(at_key<double>(t) == "Men");
BOOST_TEST(at_key<abstract>(t) == 2);
BOOST_STATIC_ASSERT((
boost::is_same<boost::fusion::result_of::value_at_key<transformed_type, int>::type, char>::value));
BOOST_STATIC_ASSERT((
boost::is_same<boost::fusion::result_of::value_at_key<transformed_type, double>::type, std::string>::value));
BOOST_STATIC_ASSERT((
boost::is_same<boost::fusion::result_of::value_at_key<transformed_type, abstract>::type, int>::value));
std::cout << t << std::endl;
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<transformed_type, int>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<transformed_type, double>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<transformed_type, abstract>::value));
BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key<transformed_type, std::string>::value));
std::cout << deref_data(begin(t)) << std::endl;
std::cout << deref_data(boost::fusion::next(begin(t))) << std::endl;
BOOST_TEST(deref_data(begin(t)) == 'X');
BOOST_TEST(deref_data(boost::fusion::next(begin(t))) == "Men");
BOOST_TEST(deref_data(boost::fusion::next(next(begin(t)))) == 2);
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<transformed_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<transformed_type>::type>::type>::type, double>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<transformed_type>::type>::type>::type>::type, abstract>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<transformed_type>::type>::type, char>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<transformed_type>::type>::type>::type, std::string>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<transformed_type>::type>::type>::type>::type, int>::value));
// Test random access interface.
pair<int, char> a = at_c<0>(t); (void) a;
pair<double, std::string> b = at_c<1>(t);
pair<abstract, int> c = at_c<2>(t);
(void)c;
typedef boost::fusion::result_of::begin<transformed_type>::type first;
typedef boost::fusion::result_of::next<first>::type second;
typedef boost::fusion::result_of::next<second>::type third;
// BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<first>::type, boost::fusion::pair<int, char> >));
// BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<second>::type, boost::fusion::pair<double, std::string> >));
// BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<third>::type, boost::fusion::pair<abstract, int> >));
}
{
// compile test only
// make sure result_of::deref_data returns a reference
typedef map<pair<float, int> > map_type;
typedef transform_view<map_type, simple_identity> transformed_type;
typedef boost::fusion::result_of::begin<transformed_type>::type i_type;
typedef boost::fusion::result_of::deref_data<i_type>::type r_type;
BOOST_STATIC_ASSERT((boost::is_same<r_type, int&>::value));
}
{
// compile test only
// make sure result_of::deref_data is const correct
typedef map<pair<float, int> > const map_type;
typedef transform_view<map_type, simple_identity> transformed_type;
typedef boost::fusion::result_of::begin<transformed_type>::type i_type;
typedef boost::fusion::result_of::deref_data<i_type>::type r_type;
BOOST_STATIC_ASSERT((boost::is_same<r_type, int const&>::value));
}
{
// compile test only
// make sure result_of::deref_data will not return a reference to temp object
typedef map<pair<float, int> > const map_type;
typedef transform_view<map_type, simple_identity_nonref> transformed_type;
typedef boost::fusion::result_of::begin<transformed_type>::type i_type;
typedef boost::fusion::result_of::deref_data<i_type>::type r_type;
BOOST_STATIC_ASSERT((boost::is_same<r_type, int>::value));
}
{
// compile test only
// make sure result_of::deref_data will not const for non-constant references
typedef map<pair<float, int&> > const map_type;
typedef transform_view<map_type, simple_identity> transformed_type;
typedef boost::fusion::result_of::begin<transformed_type>::type i_type;
typedef boost::fusion::result_of::deref_data<i_type>::type r_type;
BOOST_STATIC_ASSERT((boost::is_same<r_type, int&>::value));
}
return boost::report_errors();
}