From e79a8690f0aa38ae105cbb385e18ee25f3398b5a Mon Sep 17 00:00:00 2001 From: djowel Date: Mon, 26 Sep 2022 08:11:49 +0800 Subject: [PATCH] Merge branch 'develop' --- .github/workflows/ci.yml | 467 ++++++++++++++++++ CMakeLists.txt | 1 + appveyor.yml | 7 +- doc/container.qbk | 8 +- doc/fusion.qbk | 1 + doc/html/index.html | 1 + doc/iterator.qbk | 1 + doc/organization.qbk | 1 + doc/sequence.qbk | 22 +- doc/view.qbk | 68 ++- example/cookbook/do_the_bind.cpp | 2 +- .../adapted/boost_array/array_iterator.hpp | 11 +- .../boost_tuple/boost_tuple_iterator.hpp | 10 +- .../adapted/std_array/std_array_iterator.hpp | 11 +- .../adapted/std_tuple/std_tuple_iterator.hpp | 9 + .../struct/detail/define_struct_inline.hpp | 8 +- .../adapted/struct/detail/proxy_type.hpp | 7 +- .../iteration/detail/segmented_fold.hpp | 7 + .../iteration/detail/segmented_for_each.hpp | 9 + .../algorithm/transformation/pop_back.hpp | 9 + .../fusion/container/deque/deque_iterator.hpp | 12 +- .../fusion/container/list/cons_iterator.hpp | 10 +- .../fusion/container/map/map_iterator.hpp | 13 +- .../boost/fusion/container/vector/vector.hpp | 21 +- .../container/vector/vector_iterator.hpp | 16 +- .../boost/fusion/include/identity_view.hpp | 12 + .../iterator/detail/segment_sequence.hpp | 9 + .../fusion/iterator/iterator_adapter.hpp | 9 + .../boost/fusion/sequence/io/detail/manip.hpp | 10 +- include/boost/fusion/support/config.hpp | 10 + include/boost/fusion/support/deduce.hpp | 2 +- .../support/detail/as_fusion_element.hpp | 2 +- include/boost/fusion/view.hpp | 1 + .../fusion/view/filter_view/filter_view.hpp | 17 +- .../view/filter_view/filter_view_iterator.hpp | 16 +- .../fusion/view/flatten_view/flatten_view.hpp | 8 + .../flatten_view/flatten_view_iterator.hpp | 8 + include/boost/fusion/view/identity_view.hpp | 14 + .../view/identity_view/identity_view.hpp | 50 ++ .../fusion/view/joint_view/joint_view.hpp | 12 +- .../view/joint_view/joint_view_iterator.hpp | 12 +- .../fusion/view/nview/nview_iterator.hpp | 12 +- .../view/repetitive_view/repetitive_view.hpp | 11 +- .../repetitive_view_iterator.hpp | 12 +- .../reverse_view/detail/deref_data_impl.hpp | 10 +- .../view/reverse_view/detail/key_of_impl.hpp | 13 +- .../detail/value_of_data_impl.hpp | 13 +- .../fusion/view/reverse_view/reverse_view.hpp | 12 +- .../reverse_view/reverse_view_iterator.hpp | 12 +- .../view/single_view/single_view_iterator.hpp | 11 +- .../transform_view/detail/deref_data_impl.hpp | 71 +++ .../transform_view/detail/key_of_impl.hpp | 47 ++ .../detail/value_of_data_impl.hpp | 47 ++ .../view/transform_view/transform_view.hpp | 15 +- .../transform_view_iterator.hpp | 18 +- test/Jamfile | 1 + test/functional/fused.cpp | 2 +- test/functional/fused_function_object.cpp | 2 +- test/functional/fused_procedure.cpp | 2 +- test/functional/invoke.cpp | 2 +- test/functional/invoke_function_object.cpp | 2 +- test/functional/invoke_procedure.cpp | 2 +- test/functional/make_fused.cpp | 2 +- .../functional/make_fused_function_object.cpp | 2 +- test/functional/make_fused_procedure.cpp | 2 +- test/functional/make_unfused.cpp | 4 +- test/functional/unfused.cpp | 2 +- test/functional/unfused_typed.cpp | 2 +- test/sequence/deduce_sequence.cpp | 2 +- test/sequence/identity_view.cpp | 193 ++++++++ test/sequence/reverse_view.cpp | 19 + test/sequence/segmented_iterator_range.cpp | 7 + test/sequence/transform_view.cpp | 273 ++++++++++ 73 files changed, 1610 insertions(+), 139 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 include/boost/fusion/include/identity_view.hpp create mode 100644 include/boost/fusion/view/identity_view.hpp create mode 100644 include/boost/fusion/view/identity_view/identity_view.hpp create mode 100644 include/boost/fusion/view/transform_view/detail/deref_data_impl.hpp create mode 100644 include/boost/fusion/view/transform_view/detail/key_of_impl.hpp create mode 100644 include/boost/fusion/view/transform_view/detail/value_of_data_impl.hpp create mode 100644 test/sequence/identity_view.cpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..884233ce --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 707b4f89..9dd1d3ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,4 +23,5 @@ target_link_libraries(boost_fusion Boost::type_traits Boost::typeof Boost::utility + Boost::functional ) diff --git a/appveyor.yml b/appveyor.yml index 13dc44a7..debd336b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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% diff --git a/doc/container.qbk b/doc/container.qbk index fccd2102..618ceab9 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -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__ @@ -2005,7 +2005,7 @@ __fusion_pair__s. There may be no duplicate __fusion_pair__ key types. as_map(__make_vector__( __fusion_make_pair__('X') , __fusion_make_pair__("Men"))) - + // from associative sequence namespace ns { @@ -2222,7 +2222,7 @@ __fusion_pair__s. There may be no duplicate __fusion_pair__ key types. result_of::as_map<__vector__< __fusion_pair__ , __fusion_pair__ > >::type - + // from associative sequence namespace ns { diff --git a/doc/fusion.qbk b/doc/fusion.qbk index 6d6987d5..f7a5bf76 100644 --- a/doc/fusion.qbk +++ b/doc/fusion.qbk @@ -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`]] diff --git a/doc/html/index.html b/doc/html/index.html index 957609a9..9f0f14da 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -163,6 +163,7 @@
zip_view
transform_view
reverse_view
+
identity_view
nview
repetitive_view
flatten_view
diff --git a/doc/iterator.qbk b/doc/iterator.qbk index ef33240a..51640450 100644 --- a/doc/iterator.qbk +++ b/doc/iterator.qbk @@ -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] diff --git a/doc/organization.qbk b/doc/organization.qbk index b7166f5d..b062e6ed 100644 --- a/doc/organization.qbk +++ b/doc/organization.qbk @@ -60,6 +60,7 @@ link against. * single_view * transform_view * zip_view + * identity_view * container * deque * list diff --git a/doc/sequence.qbk b/doc/sequence.qbk index 4625f8a5..554d951f 100644 --- a/doc/sequence.qbk +++ b/doc/sequence.qbk @@ -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__(s)`] [Any type] [] [Constant]] [[`__at_c__(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__(s)`] [Any type] [] [Constant]] [[`__at__(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__(s)`] [Any type] [] [Constant]] [[`__at_key__(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__`.] * __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 __result_of_at__::type + typename __result_of_at__::type at(Sequence& seq); template - typename __result_of_at__::type + typename __result_of_at__::type at(Sequence const& seq); [heading Parameters] diff --git a/doc/view.qbk b/doc/view.qbk index f39fb7fa..a3ad4d09 100644 --- a/doc/view.qbk +++ b/doc/view.qbk @@ -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 + #include + +[heading Synopsis] + + template + 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__ vector_type; + vector_type vec(2, 5, 3.3); + + __identity_view__ identity(vec); + std::cout << identity << std::endl; // (2 5 3.3) + +[endsect] + [endsect] diff --git a/example/cookbook/do_the_bind.cpp b/example/cookbook/do_the_bind.cpp index ac5baee4..8458e64b 100644 --- a/example/cookbook/do_the_bind.cpp +++ b/example/cookbook/do_the_bind.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include #include #include diff --git a/include/boost/fusion/adapted/boost_array/array_iterator.hpp b/include/boost/fusion/adapted/boost_array/array_iterator.hpp index 540cbfed..546d16f0 100644 --- a/include/boost/fusion/adapted/boost_array/array_iterator.hpp +++ b/include/boost/fusion/adapted/boost_array/array_iterator.hpp @@ -18,6 +18,11 @@ #include #include +#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 { diff --git a/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp b/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp index ea30cb55..024d8720 100644 --- a/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp +++ b/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp @@ -45,6 +45,10 @@ namespace boost { namespace fusion template struct boost_tuple_iterator_identity; +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif template struct boost_tuple_iterator : iterator_facade, forward_traversal_tag> @@ -143,10 +147,10 @@ namespace boost { namespace fusion struct equal_to : is_same {}; - - // 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 struct boost_tuple_null_iterator diff --git a/include/boost/fusion/adapted/std_array/std_array_iterator.hpp b/include/boost/fusion/adapted/std_array/std_array_iterator.hpp index 4fac5707..eaf45116 100644 --- a/include/boost/fusion/adapted/std_array/std_array_iterator.hpp +++ b/include/boost/fusion/adapted/std_array/std_array_iterator.hpp @@ -19,6 +19,11 @@ #include #include +#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 diff --git a/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp b/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp index a3421e0f..c84c8470 100644 --- a/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp +++ b/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp @@ -17,6 +17,11 @@ #include #include +#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 { diff --git a/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp b/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp index 1db1a2ef..af711015 100644 --- a/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp +++ b/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp @@ -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 \ 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( \ diff --git a/include/boost/fusion/adapted/struct/detail/proxy_type.hpp b/include/boost/fusion/adapted/struct/detail/proxy_type.hpp index 1679561b..e0645173 100644 --- a/include/boost/fusion/adapted/struct/detail/proxy_type.hpp +++ b/include/boost/fusion/adapted/struct/detail/proxy_type.hpp @@ -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( \ diff --git a/include/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp b/include/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp index 350bff75..663c6fed 100644 --- a/include/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp @@ -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 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 diff --git a/include/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp b/include/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp index 7b299f86..404ba2a0 100644 --- a/include/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp @@ -13,6 +13,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { namespace detail { template @@ -49,4 +54,8 @@ namespace boost { namespace fusion { namespace detail } }}} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/fusion/algorithm/transformation/pop_back.hpp b/include/boost/fusion/algorithm/transformation/pop_back.hpp index 2f55fa5e..9a7e7547 100644 --- a/include/boost/fusion/algorithm/transformation/pop_back.hpp +++ b/include/boost/fusion/algorithm/transformation/pop_back.hpp @@ -18,6 +18,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { template @@ -168,5 +173,9 @@ namespace boost { namespace fusion } }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/fusion/container/deque/deque_iterator.hpp b/include/boost/fusion/container/deque/deque_iterator.hpp index b0335e5f..66fd635d 100644 --- a/include/boost/fusion/container/deque/deque_iterator.hpp +++ b/include/boost/fusion/container/deque/deque_iterator.hpp @@ -20,6 +20,11 @@ #include #include +#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 { diff --git a/include/boost/fusion/container/list/cons_iterator.hpp b/include/boost/fusion/container/list/cons_iterator.hpp index 5c0491db..f6655a70 100644 --- a/include/boost/fusion/container/list/cons_iterator.hpp +++ b/include/boost/fusion/container/list/cons_iterator.hpp @@ -26,6 +26,10 @@ namespace boost { namespace fusion template struct cons_iterator_identity; +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif template struct cons_iterator : iterator_base > { @@ -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 { diff --git a/include/boost/fusion/container/map/map_iterator.hpp b/include/boost/fusion/container/map/map_iterator.hpp index 3db7344b..3ae0decd 100644 --- a/include/boost/fusion/container/map/map_iterator.hpp +++ b/include/boost/fusion/container/map/map_iterator.hpp @@ -17,6 +17,11 @@ #include #include +#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 { diff --git a/include/boost/fusion/container/vector/vector.hpp b/include/boost/fusion/container/vector/vector.hpp index 02ffe514..f20e1de0 100644 --- a/include/boost/fusion/container/vector/vector.hpp +++ b/include/boost/fusion/container/vector/vector.hpp @@ -220,21 +220,12 @@ namespace boost { namespace fusion void assign_sequence(Sequence&& seq) { - assign(std::forward(seq), detail::index_sequence()); - } - - template - BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED - void - assign(Sequence&&, detail::index_sequence<>) {} - - template - BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED - void - assign(Sequence&& seq, detail::index_sequence) - { - at_impl(mpl::int_()) = vector_detail::forward_at_c(seq); - assign(std::forward(seq), detail::index_sequence()); +#ifndef BOOST_NO_CXX17_FOLD_EXPRESSIONS + (void(store::elem = vector_detail::forward_at_c(static_cast(seq))), ...); +#else + int nofold[] = { (void(store::elem = vector_detail::forward_at_c(static_cast(seq))), 0)..., 0 }; + (void)nofold; +#endif } private: diff --git a/include/boost/fusion/container/vector/vector_iterator.hpp b/include/boost/fusion/container/vector/vector_iterator.hpp index 0e04b345..62219766 100644 --- a/include/boost/fusion/container/vector/vector_iterator.hpp +++ b/include/boost/fusion/container/vector/vector_iterator.hpp @@ -19,6 +19,11 @@ #include #include +#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 { diff --git a/include/boost/fusion/include/identity_view.hpp b/include/boost/fusion/include/identity_view.hpp new file mode 100644 index 00000000..bb27d27b --- /dev/null +++ b/include/boost/fusion/include/identity_view.hpp @@ -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 +#include + +#endif \ No newline at end of file diff --git a/include/boost/fusion/iterator/detail/segment_sequence.hpp b/include/boost/fusion/iterator/detail/segment_sequence.hpp index 8b8d5c13..8b45cc13 100644 --- a/include/boost/fusion/iterator/detail/segment_sequence.hpp +++ b/include/boost/fusion/iterator/detail/segment_sequence.hpp @@ -13,6 +13,11 @@ #include #include +#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 diff --git a/include/boost/fusion/iterator/iterator_adapter.hpp b/include/boost/fusion/iterator/iterator_adapter.hpp index de8938f6..999d57b2 100644 --- a/include/boost/fusion/iterator/iterator_adapter.hpp +++ b/include/boost/fusion/iterator/iterator_adapter.hpp @@ -19,6 +19,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { template 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 diff --git a/include/boost/fusion/support/config.hpp b/include/boost/fusion/support/config.hpp index dc614d9d..7c87adeb 100644 --- a/include/boost/fusion/support/config.hpp +++ b/include/boost/fusion/support/config.hpp @@ -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 diff --git a/include/boost/fusion/support/deduce.hpp b/include/boost/fusion/support/deduce.hpp index b75381c5..ee7e3dc9 100644 --- a/include/boost/fusion/support/deduce.hpp +++ b/include/boost/fusion/support/deduce.hpp @@ -10,7 +10,7 @@ #define BOOST_FUSION_SUPPORT_DEDUCE_HPP_INCLUDED #include -#include +#include #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL #include diff --git a/include/boost/fusion/support/detail/as_fusion_element.hpp b/include/boost/fusion/support/detail/as_fusion_element.hpp index 2af960ee..08f4db92 100644 --- a/include/boost/fusion/support/detail/as_fusion_element.hpp +++ b/include/boost/fusion/support/detail/as_fusion_element.hpp @@ -9,7 +9,7 @@ #define FUSION_AS_FUSION_ELEMENT_05052005_0338 #include -#include +#include #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL #include diff --git a/include/boost/fusion/view.hpp b/include/boost/fusion/view.hpp index 4cb49122..0d8ded42 100644 --- a/include/boost/fusion/view.hpp +++ b/include/boost/fusion/view.hpp @@ -17,5 +17,6 @@ #include #include #include +#include #endif diff --git a/include/boost/fusion/view/filter_view/filter_view.hpp b/include/boost/fusion/view/filter_view/filter_view.hpp index b9b7e7fc..c4e05e8d 100644 --- a/include/boost/fusion/view/filter_view/filter_view.hpp +++ b/include/boost/fusion/view/filter_view/filter_view.hpp @@ -22,6 +22,11 @@ #include #include +#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_, 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 diff --git a/include/boost/fusion/view/filter_view/filter_view_iterator.hpp b/include/boost/fusion/view/filter_view/filter_view_iterator.hpp index 05eda69b..7a907f50 100644 --- a/include/boost/fusion/view/filter_view/filter_view_iterator.hpp +++ b/include/boost/fusion/view/filter_view/filter_view_iterator.hpp @@ -26,6 +26,11 @@ #include #include +#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 { diff --git a/include/boost/fusion/view/flatten_view/flatten_view.hpp b/include/boost/fusion/view/flatten_view/flatten_view.hpp index 401f65dc..4512a137 100644 --- a/include/boost/fusion/view/flatten_view/flatten_view.hpp +++ b/include/boost/fusion/view/flatten_view/flatten_view.hpp @@ -19,6 +19,10 @@ #include #include +#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<> diff --git a/include/boost/fusion/view/flatten_view/flatten_view_iterator.hpp b/include/boost/fusion/view/flatten_view/flatten_view_iterator.hpp index be115d91..73d2490b 100644 --- a/include/boost/fusion/view/flatten_view/flatten_view_iterator.hpp +++ b/include/boost/fusion/view/flatten_view/flatten_view_iterator.hpp @@ -19,6 +19,10 @@ #include #include +#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 diff --git a/include/boost/fusion/view/identity_view.hpp b/include/boost/fusion/view/identity_view.hpp new file mode 100644 index 00000000..72414cbe --- /dev/null +++ b/include/boost/fusion/view/identity_view.hpp @@ -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 +#include + + +#endif \ No newline at end of file diff --git a/include/boost/fusion/view/identity_view/identity_view.hpp b/include/boost/fusion/view/identity_view/identity_view.hpp new file mode 100644 index 00000000..4cd0c093 --- /dev/null +++ b/include/boost/fusion/view/identity_view/identity_view.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion { + namespace detail { + struct identity : boost::identity + { + }; + } +}} + +namespace boost { + template + struct result_of + { + 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 struct identity_view + : transform_view + { + typedef transform_view 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 diff --git a/include/boost/fusion/view/joint_view/joint_view.hpp b/include/boost/fusion/view/joint_view/joint_view.hpp index 03e38d69..1cf6d0d5 100644 --- a/include/boost/fusion/view/joint_view/joint_view.hpp +++ b/include/boost/fusion/view/joint_view/joint_view.hpp @@ -25,6 +25,11 @@ #include #include +#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_, Sequence1, Sequence1&>::type seq1; typename mpl::if_, Sequence2, Sequence2&>::type seq2; }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/fusion/view/joint_view/joint_view_iterator.hpp b/include/boost/fusion/view/joint_view/joint_view_iterator.hpp index f6db3091..1b446189 100644 --- a/include/boost/fusion/view/joint_view/joint_view_iterator.hpp +++ b/include/boost/fusion/view/joint_view/joint_view_iterator.hpp @@ -20,6 +20,11 @@ #include #include +#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 { diff --git a/include/boost/fusion/view/nview/nview_iterator.hpp b/include/boost/fusion/view/nview/nview_iterator.hpp index 79c82dd9..5e5cea27 100644 --- a/include/boost/fusion/view/nview/nview_iterator.hpp +++ b/include/boost/fusion/view/nview/nview_iterator.hpp @@ -26,6 +26,11 @@ #include #include +#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 { diff --git a/include/boost/fusion/view/repetitive_view/repetitive_view.hpp b/include/boost/fusion/view/repetitive_view/repetitive_view.hpp index 71dc51bc..615fa581 100644 --- a/include/boost/fusion/view/repetitive_view/repetitive_view.hpp +++ b/include/boost/fusion/view/repetitive_view/repetitive_view.hpp @@ -18,6 +18,10 @@ #include #include +#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 diff --git a/include/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp b/include/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp index 775249ff..842d3fb1 100644 --- a/include/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp +++ b/include/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp @@ -19,6 +19,11 @@ #include #include +#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 { diff --git a/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp b/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp index e93b8fba..db64d32b 100644 --- a/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp +++ b/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp @@ -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 #include +#include namespace boost { namespace fusion { namespace extension { @@ -23,14 +25,18 @@ namespace boost { namespace fusion { namespace extension struct apply { typedef typename - result_of::deref_data::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)); } }; }; diff --git a/include/boost/fusion/view/reverse_view/detail/key_of_impl.hpp b/include/boost/fusion/view/reverse_view/detail/key_of_impl.hpp index 985e5fa9..0b8fc3bc 100644 --- a/include/boost/fusion/view/reverse_view/detail/key_of_impl.hpp +++ b/include/boost/fusion/view/reverse_view/detail/key_of_impl.hpp @@ -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 #include +#include namespace boost { namespace fusion { namespace extension { @@ -21,8 +23,15 @@ namespace boost { namespace fusion { namespace extension { template struct apply - : result_of::key_of - {}; + { + typedef typename + result_of::key_of< + typename result_of::prior< + typename It::first_type + >::type + >::type + type; + }; }; }}} diff --git a/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp b/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp index a96d1ce3..03cb753f 100644 --- a/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp +++ b/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp @@ -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 #include +#include namespace boost { namespace fusion { namespace extension { @@ -21,8 +23,15 @@ namespace boost { namespace fusion { namespace extension { template struct apply - : result_of::value_of_data - {}; + { + typedef typename + result_of::value_of_data< + typename result_of::prior< + typename It::first_type + >::type + >::type + type; + }; }; }}} diff --git a/include/boost/fusion/view/reverse_view/reverse_view.hpp b/include/boost/fusion/view/reverse_view/reverse_view.hpp index 0aa3d106..cde4206f 100644 --- a/include/boost/fusion/view/reverse_view/reverse_view.hpp +++ b/include/boost/fusion/view/reverse_view/reverse_view.hpp @@ -27,6 +27,11 @@ #include #include +#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_, 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 diff --git a/include/boost/fusion/view/reverse_view/reverse_view_iterator.hpp b/include/boost/fusion/view/reverse_view/reverse_view_iterator.hpp index 0a582f40..02307f5a 100644 --- a/include/boost/fusion/view/reverse_view/reverse_view_iterator.hpp +++ b/include/boost/fusion/view/reverse_view/reverse_view_iterator.hpp @@ -24,6 +24,11 @@ #include #include +#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 { diff --git a/include/boost/fusion/view/single_view/single_view_iterator.hpp b/include/boost/fusion/view/single_view/single_view_iterator.hpp index 0de6c842..38c25ed5 100644 --- a/include/boost/fusion/view/single_view/single_view_iterator.hpp +++ b/include/boost/fusion/view/single_view/single_view_iterator.hpp @@ -20,6 +20,11 @@ #include #include +#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 { diff --git a/include/boost/fusion/view/transform_view/detail/deref_data_impl.hpp b/include/boost/fusion/view/transform_view/detail/deref_data_impl.hpp new file mode 100644 index 00000000..83ea236a --- /dev/null +++ b/include/boost/fusion/view/transform_view/detail/deref_data_impl.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct transform_view_iterator_tag; + struct transform_view_iterator2_tag; + + namespace extension + { + template + struct deref_data_impl; + + // Unary Version + template<> + struct deref_data_impl + { + template + struct apply + { + typedef typename + result_of::deref::type + value_type; + + typedef typename Iterator::transform_type F; + typedef typename boost::result_of::type transformed_type; + typedef typename boost::remove_reference::type transformed_type_unref; + typedef typename boost::remove_const::type transformed_type_unconst; + + typedef typename transformed_type_unconst::second_type raw_type; + typedef typename + boost::mpl::if_< + is_reference + , typename boost::mpl::if_< + is_const + , typename boost::add_reference::type>::type + , typename boost::add_reference::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 diff --git a/include/boost/fusion/view/transform_view/detail/key_of_impl.hpp b/include/boost/fusion/view/transform_view/detail/key_of_impl.hpp new file mode 100644 index 00000000..226814f1 --- /dev/null +++ b/include/boost/fusion/view/transform_view/detail/key_of_impl.hpp @@ -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 +#include +#include + +namespace boost { namespace fusion +{ + struct transform_view_iterator_tag; + struct transform_view_iterator2_tag; + + namespace extension + { + template + struct key_of_impl; + + // Unary Version + template<> + struct key_of_impl + { + template + struct apply + { + typedef typename + result_of::deref::type + value_type; + + typedef typename Iterator::transform_type F; + typedef typename boost::result_of::type transformed_type; + typedef typename boost::remove_reference::type transformed_type_unref; + typedef typename boost::remove_const::type transformed_type_unconst; + + typedef typename transformed_type_unconst::first_type type; + }; + }; + + // Binary Version is not supported with Associative Sequence + } +}} +#endif diff --git a/include/boost/fusion/view/transform_view/detail/value_of_data_impl.hpp b/include/boost/fusion/view/transform_view/detail/value_of_data_impl.hpp new file mode 100644 index 00000000..e350db49 --- /dev/null +++ b/include/boost/fusion/view/transform_view/detail/value_of_data_impl.hpp @@ -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 +#include +#include + +namespace boost { namespace fusion +{ + struct transform_view_iterator_tag; + struct transform_view_iterator2_tag; + + namespace extension + { + template + struct value_of_data_impl; + + // Unary Version + template<> + struct value_of_data_impl + { + template + struct apply + { + typedef typename + result_of::deref::type + value_type; + + typedef typename Iterator::transform_type F; + typedef typename boost::result_of::type transformed_type; + typedef typename boost::remove_reference::type transformed_type_unref; + typedef typename boost::remove_const::type transformed_type_unconst; + + typedef typename transformed_type_unconst::second_type type; + }; + }; + + // Binary Version is not supported with Associative Sequence + } +}} +#endif diff --git a/include/boost/fusion/view/transform_view/transform_view.hpp b/include/boost/fusion/view/transform_view/transform_view.hpp index f0633018..901fe362 100644 --- a/include/boost/fusion/view/transform_view/transform_view.hpp +++ b/include/boost/fusion/view/transform_view/transform_view.hpp @@ -27,6 +27,11 @@ #include #include +#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_, Sequence1, Sequence1&>::type seq1; typename mpl::if_, 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_, 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 diff --git a/include/boost/fusion/view/transform_view/transform_view_iterator.hpp b/include/boost/fusion/view/transform_view/transform_view_iterator.hpp index 2689ae8a..ba5b7c9b 100644 --- a/include/boost/fusion/view/transform_view/transform_view_iterator.hpp +++ b/include/boost/fusion/view/transform_view/transform_view_iterator.hpp @@ -19,6 +19,14 @@ #include #include #include +#include +#include +#include + +#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 { diff --git a/test/Jamfile b/test/Jamfile index e55b15ad..13dd35c5 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -156,6 +156,7 @@ project : 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 ] diff --git a/test/functional/fused.cpp b/test/functional/fused.cpp index b2ce8dde..63a47348 100644 --- a/test/functional/fused.cpp +++ b/test/functional/fused.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/fused_function_object.cpp b/test/functional/fused_function_object.cpp index 399745a0..cd3e2ea9 100644 --- a/test/functional/fused_function_object.cpp +++ b/test/functional/fused_function_object.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/fused_procedure.cpp b/test/functional/fused_procedure.cpp index 1ed0ddf7..07b84e43 100644 --- a/test/functional/fused_procedure.cpp +++ b/test/functional/fused_procedure.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/invoke.cpp b/test/functional/invoke.cpp index 3117eb3f..af3b813f 100644 --- a/test/functional/invoke.cpp +++ b/test/functional/invoke.cpp @@ -16,7 +16,7 @@ #endif #include -#include +#include #include diff --git a/test/functional/invoke_function_object.cpp b/test/functional/invoke_function_object.cpp index 7c75f06d..54cefc38 100644 --- a/test/functional/invoke_function_object.cpp +++ b/test/functional/invoke_function_object.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include diff --git a/test/functional/invoke_procedure.cpp b/test/functional/invoke_procedure.cpp index 3877ca30..a608e304 100644 --- a/test/functional/invoke_procedure.cpp +++ b/test/functional/invoke_procedure.cpp @@ -16,7 +16,7 @@ #endif #include -#include +#include #include diff --git a/test/functional/make_fused.cpp b/test/functional/make_fused.cpp index ceb82063..6503ee28 100644 --- a/test/functional/make_fused.cpp +++ b/test/functional/make_fused.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/make_fused_function_object.cpp b/test/functional/make_fused_function_object.cpp index 79ea517b..9f803c4d 100644 --- a/test/functional/make_fused_function_object.cpp +++ b/test/functional/make_fused_function_object.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/make_fused_procedure.cpp b/test/functional/make_fused_procedure.cpp index 2fa2762c..51a82f78 100644 --- a/test/functional/make_fused_procedure.cpp +++ b/test/functional/make_fused_procedure.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/make_unfused.cpp b/test/functional/make_unfused.cpp index 73be142b..b8ee9938 100644 --- a/test/functional/make_unfused.cpp +++ b/test/functional/make_unfused.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include @@ -19,11 +19,11 @@ #include #include +#include #include #include -#include namespace fusion = boost::fusion; namespace mpl = boost::mpl; diff --git a/test/functional/unfused.cpp b/test/functional/unfused.cpp index 1e30eabd..21c0d42e 100644 --- a/test/functional/unfused.cpp +++ b/test/functional/unfused.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/unfused_typed.cpp b/test/functional/unfused_typed.cpp index eaa03425..a0f76d49 100644 --- a/test/functional/unfused_typed.cpp +++ b/test/functional/unfused_typed.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/sequence/deduce_sequence.cpp b/test/sequence/deduce_sequence.cpp index a1569f46..3bccc20a 100644 --- a/test/sequence/deduce_sequence.cpp +++ b/test/sequence/deduce_sequence.cpp @@ -13,7 +13,7 @@ #include -#include +#include #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL #include #endif diff --git a/test/sequence/identity_view.cpp b/test/sequence/identity_view.cpp new file mode 100644 index 00000000..e74f9294 --- /dev/null +++ b/test/sequence/identity_view.cpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +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 sequence_type; + sequence_type sequence; + typedef identity_view 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::type first_type; + first_type first_it(boost::fusion::begin(xform)); + + typedef boost::fusion::result_of::next::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::type, boost::mpl::integral_c >)); + } + + { + typedef vector sequence_type; + sequence_type seq; + identity_view 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 + , pair + , pair > + map_type; + typedef identity_view transformed_type; + + BOOST_MPL_ASSERT((traits::is_associative)); + BOOST_MPL_ASSERT((traits::is_random_access)); + + map_type m( + make_pair('X') + , make_pair("Men") + , make_pair(2)); + transformed_type t(m); + + std::cout << at_key(t) << std::endl; + std::cout << at_key(t) << std::endl; + std::cout << at_key(t) << std::endl; + + BOOST_TEST(at_key(t) == 'X'); + BOOST_TEST(at_key(t) == "Men"); + BOOST_TEST(at_key(t) == 2); + + BOOST_STATIC_ASSERT(( + boost::is_same::type, char>::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::type, std::string>::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::type, int>::value)); + + std::cout << t << std::endl; + + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key::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::type>::type, int>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, double>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type>::type, abstract>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type, char>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, std::string>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type>::type, int>::value)); + + // Test random access interface. + pair a = at_c<0>(t); (void) a; + pair b = at_c<1>(t); + pair c = at_c<2>(t); + (void)c; + + typedef boost::fusion::result_of::begin::type first; + typedef boost::fusion::result_of::next::type second; + typedef boost::fusion::result_of::next::type third; + + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + } + + { + // compile test only + // make sure result_of::deref_data returns a reference + typedef map > map_type; + typedef identity_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + { + // compile test only + // make sure result_of::deref_data is const correct + typedef map > const map_type; + typedef identity_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + { + // compile test only + // make sure result_of::deref_data will not const for non-constant references + typedef map > const map_type; + typedef identity_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + return boost::report_errors(); +} + diff --git a/test/sequence/reverse_view.cpp b/test/sequence/reverse_view.cpp index fb96275d..356b9b0b 100644 --- a/test/sequence/reverse_view.cpp +++ b/test/sequence/reverse_view.cpp @@ -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 #include #include +#include +#include +#include #include #include #include @@ -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_ > + , boost::mpl::not_ > > >)); + BOOST_MPL_ASSERT((boost::is_same >::type, std::string&>)); + BOOST_MPL_ASSERT((boost::is_same >::type, std::string>)); } return boost::report_errors(); diff --git a/test/sequence/segmented_iterator_range.cpp b/test/sequence/segmented_iterator_range.cpp index df49407a..236a7e27 100644 --- a/test/sequence/segmented_iterator_range.cpp +++ b/test/sequence/segmented_iterator_range.cpp @@ -21,6 +21,10 @@ #include #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 void diff --git a/test/sequence/transform_view.cpp b/test/sequence/transform_view.cpp index b9e3f943..4f11e6b7 100644 --- a/test/sequence/transform_view.cpp +++ b/test/sequence/transform_view.cpp @@ -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 #include +#include +#include #include #include #include @@ -14,15 +17,29 @@ #include #include #include +#include +#include +#include +#include #include #include #include #include #include +#include +#include +#include +#include +#include #include #include +#include +#include #include +#include +#include +#include struct square { @@ -60,6 +77,85 @@ struct add } }; +struct abstract +{ + virtual void foo() = 0; +}; + +struct functor +{ + typedef boost::fusion::pair pair_0; + typedef boost::fusion::pair pair_1; + typedef boost::fusion::pair pair_2; + + typedef boost::mpl::map< + boost::mpl::pair< boost::fusion::pair , pair_0> + , boost::mpl::pair< pair_1 , pair_1> + , boost::mpl::pair< boost::fusion::pair , pair_2> + > m; + + template + struct result; + + template + struct result + : boost::mpl::at< + m, + typename boost::remove_reference::type + > + {}; + + pair_0 operator() (const boost::fusion::pair& 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& arg) const + { + return pair_2(arg.second); + } +}; + +struct simple_identity +{ + template + struct result; + + template + struct result + { + typedef U type; + }; + + template + T& operator() (T& arg) const + { + return arg; + } +}; + +struct simple_identity_nonref +{ + template + struct result; + + template + struct result + : boost::remove_reference + {}; + + template + T operator() (T arg) const + { + return arg; + } +}; + int main() { @@ -110,6 +206,183 @@ main() BOOST_MPL_ASSERT((boost::is_same::type, int>)); } + /// Associative + { + typedef map< + pair + , pair + , pair > + map_type; + typedef transform_view transformed_type; + + BOOST_MPL_ASSERT((traits::is_associative)); + BOOST_MPL_ASSERT((traits::is_random_access)); + + map_type m( + make_pair('X') + , make_pair("Men") + , make_pair(2)); + transformed_type t(m, functor()); + + std::cout << at_key(t) << std::endl; + std::cout << at_key(t) << std::endl; + std::cout << at_key(t) << std::endl; + + BOOST_TEST(at_key(t) == 'X'); + BOOST_TEST(at_key(t) == "Men_transformed"); + BOOST_TEST(at_key(t) == 2); + + BOOST_STATIC_ASSERT(( + boost::is_same::type, char>::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::type, std::string>::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::type, long>::value)); + + std::cout << t << std::endl; + + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key::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::type>::type, short>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, double>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type>::type, abstract>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type, char>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, std::string>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type>::type, long>::value)); + + // Test random access interface. + pair a = at_c<0>(t); (void) a; + pair b = at_c<1>(t); + pair c = at_c<2>(t); + (void)c; + + typedef boost::fusion::result_of::begin::type first; + typedef boost::fusion::result_of::next::type second; + typedef boost::fusion::result_of::next::type third; + + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + } + + { + typedef map< + pair + , pair + , pair > + map_type; + typedef transform_view transformed_type; + + BOOST_MPL_ASSERT((traits::is_associative)); + BOOST_MPL_ASSERT((traits::is_random_access)); + + map_type m( + make_pair('X') + , make_pair("Men") + , make_pair(2)); + transformed_type t(m, simple_identity()); + + std::cout << at_key(t) << std::endl; + std::cout << at_key(t) << std::endl; + std::cout << at_key(t) << std::endl; + + BOOST_TEST(at_key(t) == 'X'); + BOOST_TEST(at_key(t) == "Men"); + BOOST_TEST(at_key(t) == 2); + + BOOST_STATIC_ASSERT(( + boost::is_same::type, char>::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::type, std::string>::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::type, int>::value)); + + std::cout << t << std::endl; + + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key::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::type>::type, int>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, double>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type>::type, abstract>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type, char>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, std::string>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type>::type, int>::value)); + + // Test random access interface. + pair a = at_c<0>(t); (void) a; + pair b = at_c<1>(t); + pair c = at_c<2>(t); + (void)c; + + typedef boost::fusion::result_of::begin::type first; + typedef boost::fusion::result_of::next::type second; + typedef boost::fusion::result_of::next::type third; + + // BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + // BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + // BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + } + + { + // compile test only + // make sure result_of::deref_data returns a reference + typedef map > map_type; + typedef transform_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + { + // compile test only + // make sure result_of::deref_data is const correct + typedef map > const map_type; + typedef transform_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + { + // compile test only + // make sure result_of::deref_data will not return a reference to temp object + typedef map > const map_type; + typedef transform_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + { + // compile test only + // make sure result_of::deref_data will not const for non-constant references + typedef map > const map_type; + typedef transform_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + return boost::report_errors(); }