├── .drone.star ├── .drone └── drone.sh ├── .gitattributes ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── build.jam ├── doc ├── Jamfile.v2 └── move.qbk ├── example ├── Jamfile.v2 ├── copymovable.hpp ├── doc_clone_ptr.cpp ├── doc_construct_forward.cpp ├── doc_file_descriptor.cpp ├── doc_how_works.cpp ├── doc_move_algorithms.cpp ├── doc_move_inserter.cpp ├── doc_move_iterator.cpp ├── doc_move_return.cpp ├── doc_template_assign.cpp └── movable.hpp ├── include └── boost │ └── move │ ├── adl_move_swap.hpp │ ├── algo │ ├── adaptive_merge.hpp │ ├── adaptive_sort.hpp │ ├── detail │ │ ├── adaptive_sort_merge.hpp │ │ ├── basic_op.hpp │ │ ├── heap_sort.hpp │ │ ├── insertion_sort.hpp │ │ ├── is_sorted.hpp │ │ ├── merge.hpp │ │ ├── merge_sort.hpp │ │ ├── pdqsort.hpp │ │ ├── search.hpp │ │ └── set_difference.hpp │ ├── move.hpp │ ├── predicate.hpp │ └── unique.hpp │ ├── algorithm.hpp │ ├── core.hpp │ ├── default_delete.hpp │ ├── detail │ ├── addressof.hpp │ ├── config_begin.hpp │ ├── config_end.hpp │ ├── destruct_n.hpp │ ├── force_ptr.hpp │ ├── fwd_macros.hpp │ ├── iterator_to_raw_pointer.hpp │ ├── iterator_traits.hpp │ ├── launder.hpp │ ├── meta_utils.hpp │ ├── meta_utils_core.hpp │ ├── move_helpers.hpp │ ├── nsec_clock.hpp │ ├── placement_new.hpp │ ├── pointer_element.hpp │ ├── reverse_iterator.hpp │ ├── std_ns_begin.hpp │ ├── std_ns_end.hpp │ ├── to_raw_pointer.hpp │ ├── type_traits.hpp │ ├── unique_ptr_meta_utils.hpp │ └── workaround.hpp │ ├── iterator.hpp │ ├── make_unique.hpp │ ├── move.hpp │ ├── traits.hpp │ ├── unique_ptr.hpp │ ├── utility.hpp │ └── utility_core.hpp ├── index.html ├── meta └── libraries.json └── test ├── CMakeLists.txt ├── Jamfile.v2 ├── adaptive_merge_test.cpp ├── adaptive_sort_test.cpp ├── adl_move_swap.cpp ├── algo_test.cpp ├── back_move_inserter.cpp ├── bench_merge.cpp ├── bench_sort.cpp ├── construct_forward.cpp ├── conversion_test.cpp ├── copy_elision_test.cpp ├── copy_move_optimization.cpp ├── inplace_merge_test.cpp ├── move.cpp ├── move_algorithm.cpp ├── move_core.cpp ├── move_if_noexcept.cpp ├── move_iterator.cpp ├── order_type.hpp ├── random_shuffle.hpp ├── type_traits.cpp ├── unique_ptr_assign.cpp ├── unique_ptr_ctordtor.cpp ├── unique_ptr_default_deleter.cpp ├── unique_ptr_functions.cpp ├── unique_ptr_modifiers.cpp ├── unique_ptr_movector.cpp ├── unique_ptr_nullptr.cpp ├── unique_ptr_observers.cpp ├── unique_ptr_std_move.cpp ├── unique_ptr_test_utils_beg.hpp ├── unique_ptr_test_utils_end.hpp └── unique_ptr_types.cpp /.drone.star: -------------------------------------------------------------------------------- 1 | # Use, modification, and distribution are 2 | # subject to the Boost Software License, Version 1.0. (See accompanying 3 | # file LICENSE.txt) 4 | # 5 | # Copyright Rene Rivera 2020. 6 | 7 | # For Drone CI we use the Starlark scripting language to reduce duplication. 8 | # As the yaml syntax for Drone CI is rather limited. 9 | # 10 | # 11 | globalenv={'B2_VARIANT': 'variant=release,debug'} 12 | linuxglobalimage="cppalliance/droneubuntu1604:1" 13 | windowsglobalimage="cppalliance/dronevs2019" 14 | 15 | def main(ctx): 16 | return [ 17 | linux_cxx("B2_TOOLSET=gcc-4.8 B2_CXXSTD=03,11 Job 0", "g++-4.8", packages="g++-4.8", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1404:1", environment={'B2_TOOLSET': 'gcc-4.8', 'B2_CXXSTD': '03,11', 'DRONE_JOB_UUID': 'b6589fc6ab'}, globalenv=globalenv), 18 | linux_cxx("B2_TOOLSET=gcc-4.9 B2_CXXSTD=03,11 Job 1", "g++-4.9", packages="g++-4.9", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1404:1", environment={'B2_TOOLSET': 'gcc-4.9', 'B2_CXXSTD': '03,11', 'DRONE_JOB_UUID': '356a192b79'}, globalenv=globalenv), 19 | linux_cxx("B2_TOOLSET=gcc-5 B2_CXXSTD=11 Job 2", "g++-5", packages="g++-5", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-5', 'B2_CXXSTD': '11', 'DRONE_JOB_UUID': 'da4b9237ba'}, globalenv=globalenv), 20 | linux_cxx("B2_TOOLSET=gcc-6 B2_CXXSTD=11,14 Job 3", "g++-6", packages="g++-6", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-6', 'B2_CXXSTD': '11,14', 'DRONE_JOB_UUID': '77de68daec'}, globalenv=globalenv), 21 | linux_cxx("B2_TOOLSET=gcc-7 B2_CXXSTD=11,14,17 Job 4", "g++-7", packages="g++-7", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-7', 'B2_CXXSTD': '11,14,17', 'DRONE_JOB_UUID': '1b64538924'}, globalenv=globalenv), 22 | linux_cxx("B2_TOOLSET=gcc-8 B2_CXXSTD=14,17,2a Job 5", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '14,17,2a', 'DRONE_JOB_UUID': 'ac3478d69a'}, globalenv=globalenv), 23 | linux_cxx("B2_TOOLSET=clang-3.8 B2_CXXSTD=03,11,14 Job 6", "clang++-3.8", packages="clang-3.8 libstdc++-6-dev", llvm_os="xenial", llvm_ver="3.8", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1404:1", environment={'B2_TOOLSET': 'clang-3.8', 'B2_CXXSTD': '03,11,14', 'DRONE_JOB_UUID': 'c1dfd96eea'}, globalenv=globalenv), 24 | linux_cxx("B2_TOOLSET=clang-4.0 B2_CXXSTD=11,14 Job 7", "clang++-4.0", packages="clang-4.0 libstdc++-6-dev", llvm_os="xenial", llvm_ver="4.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-4.0', 'B2_CXXSTD': '11,14', 'DRONE_JOB_UUID': '902ba3cda1'}, globalenv=globalenv), 25 | linux_cxx("B2_TOOLSET=clang-5.0 B2_CXXSTD=11,14,17 Job 8", "clang++-5.0", packages="clang-5.0 libstdc++-7-dev", llvm_os="xenial", llvm_ver="5.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-5.0', 'B2_CXXSTD': '11,14,17', 'DRONE_JOB_UUID': 'fe5dbbcea5'}, globalenv=globalenv), 26 | linux_cxx("B2_TOOLSET=clang-6.0 B2_CXXSTD=14,17,2a Job 9", "clang++-6.0", packages="clang-6.0 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="xenial", llvm_ver="6.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-6.0', 'B2_CXXSTD': '14,17,2a', 'DRONE_JOB_UUID': '0ade7c2cf9'}, globalenv=globalenv), 27 | linux_cxx("B2_TOOLSET=clang-7 B2_CXXSTD=14,17,2a Job 10", "clang++-7", packages="clang-7 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="xenial", llvm_ver="7", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-7', 'B2_CXXSTD': '14,17,2a', 'DRONE_JOB_UUID': 'b1d5781111'}, globalenv=globalenv), 28 | linux_cxx("B2_TOOLSET=clang-8 B2_CXXSTD=14,17,2a Job 11", "clang++-8", packages="clang-8 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="xenial", llvm_ver="8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-8', 'B2_CXXSTD': '14,17,2a', 'DRONE_JOB_UUID': '17ba079149'}, globalenv=globalenv), 29 | linux_cxx("B2_TOOLSET=clang-6.0 B2_CXXSTD=03,11,14,17,2a Job 12", "clang++-6.0", packages="clang-6.0 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="xenial", llvm_ver="6.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-6.0', 'B2_CXXSTD': '03,11,14,17,2a', 'B2_CXXFLAGS': '-stdlib=libc++', 'DRONE_JOB_UUID': '7b52009b64'}, globalenv=globalenv), 30 | # Not building # 31 | # osx_cxx("B2_TOOLSET=clang B2_CXXSTD=03,11,17 Job 13", "g++", packages="", buildtype="boost", buildscript="drone", environment={'B2_TOOLSET': 'clang', 'B2_CXXSTD': '03,11,17', 'DRONE_JOB_UUID': 'bd307a3ec3'}, globalenv=globalenv), 32 | linux_cxx("COMMENT=codecov.io B2_CXXSTD=03,11 B2_TOOLSET Job 14", "g++-8", packages="g++-8", buildtype="b5847f804b-bbb3de2b00", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'codecov.io', 'B2_CXXSTD': '03,11', 'B2_TOOLSET': 'gcc-8', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1', 'DRONE_JOB_UUID': 'fa35e19212'}, globalenv=globalenv), 33 | linux_cxx("COMMENT=cppcheck Job 15", "g++", packages="binutils-gold gdb libc6-dbg", buildtype="b5847f804b-ed45733e6c", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'cppcheck', 'DRONE_JOB_UUID': 'f1abd67035'}, globalenv=globalenv), 34 | linux_cxx("COMMENT=ubsan B2_VARIANT=variant=debug B2_TOO Job 16", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'ubsan', 'B2_VARIANT': 'variant=debug', 'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '03,11,14,17,2a', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1', 'B2_CXXFLAGS': 'cxxflags=-fno-omit-frame-pointer cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=all', 'B2_LINKFLAGS': 'linkflags=-fsanitize=undefined linkflags=-fno-sanitize-recover=all linkflags=-fuse-ld=gold', 'UBSAN_OPTIONS': 'print_stacktrace=1', 'DRONE_JOB_UUID': '1574bddb75'}, globalenv=globalenv), 35 | linux_cxx("COMMENT=valgrind B2_TOOLSET=clang-6.0 B2_CXXS Job 17", "clang++-6.0", packages="clang-6.0 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="xenial", llvm_ver="6.0", buildtype="b5847f804b-db180b7bd2", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'valgrind', 'B2_TOOLSET': 'clang-6.0', 'B2_CXXSTD': '03,11,14,17,2a', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1', 'B2_VARIANT': 'variant=debug', 'B2_TESTFLAGS': 'testing.launcher=valgrind', 'VALGRIND_OPTS': '--error-exitcode=1', 'DRONE_JOB_UUID': '0716d9708d'}, globalenv=globalenv), 36 | # Not building # 37 | # linux_cxx("COMMENT=cmake Job 18", "g++", packages="binutils-gold gdb libc6-dbg", buildtype="b5847f804b-e70eed6a8b", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'cmake', 'DRONE_JOB_UUID': '9e6a55b6b4'}, globalenv=globalenv), 38 | linux_cxx("COMMENT=Coverity Scan B2_TOOLSET=clang Job 19", "g++", packages="binutils-gold gdb libc6-dbg", buildtype="b5847f804b-cce9827eb5", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'Coverity Scan', 'B2_TOOLSET': 'clang', 'DRONE_JOB_UUID': 'b3f0c7f6bb'}, globalenv=globalenv), 39 | ] 40 | 41 | # from https://github.com/boostorg/boost-ci 42 | load("@boost_ci//ci/drone/:functions.star", "linux_cxx","windows_cxx","osx_cxx","freebsd_cxx") 43 | -------------------------------------------------------------------------------- /.drone/drone.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2020 Rene Rivera, Sam Darwin 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt) 6 | 7 | set -e 8 | export TRAVIS_BUILD_DIR=$(pwd) 9 | export DRONE_BUILD_DIR=$(pwd) 10 | export TRAVIS_BRANCH=$DRONE_BRANCH 11 | export VCS_COMMIT_ID=$DRONE_COMMIT 12 | export GIT_COMMIT=$DRONE_COMMIT 13 | export REPO_NAME=$DRONE_REPO 14 | export PATH=~/.local/bin:/usr/local/bin:$PATH 15 | 16 | if [ "$DRONE_JOB_BUILDTYPE" == "boost" ]; then 17 | 18 | echo '==================================> INSTALL' 19 | 20 | git clone https://github.com/boostorg/boost-ci.git boost-ci 21 | cp -pr boost-ci/ci boost-ci/.codecov.yml . 22 | 23 | if [ "$TRAVIS_OS_NAME" == "osx" ]; then 24 | unset -f cd 25 | fi 26 | 27 | export SELF=`basename $REPO_NAME` 28 | export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" 29 | export BOOST_CI_SRC_FOLDER=$(pwd) 30 | 31 | . ./ci/common_install.sh 32 | 33 | echo '==================================> SCRIPT' 34 | 35 | cd $BOOST_ROOT/libs/$SELF 36 | ci/travis/build.sh 37 | 38 | elif [ "$DRONE_JOB_BUILDTYPE" == "b5847f804b-bbb3de2b00" ]; then 39 | 40 | echo '==================================> INSTALL' 41 | 42 | git clone https://github.com/boostorg/boost-ci.git boost-ci 43 | cp -pr boost-ci/ci boost-ci/.codecov.yml . 44 | 45 | if [ "$TRAVIS_OS_NAME" == "osx" ]; then 46 | unset -f cd 47 | fi 48 | 49 | export SELF=`basename $REPO_NAME` 50 | export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" 51 | export BOOST_CI_SRC_FOLDER=$(pwd) 52 | 53 | . ./ci/common_install.sh 54 | 55 | echo '==================================> SCRIPT' 56 | 57 | pushd /tmp && git clone https://github.com/linux-test-project/lcov.git && export PATH=/tmp/lcov/bin:$PATH && which lcov && lcov --version && popd 58 | cd $BOOST_ROOT/libs/$SELF 59 | ci/travis/codecov.sh 60 | 61 | elif [ "$DRONE_JOB_BUILDTYPE" == "b5847f804b-ed45733e6c" ]; then 62 | 63 | echo '==================================> INSTALL' 64 | 65 | git clone https://github.com/boostorg/boost-ci.git boost-ci 66 | cp -pr boost-ci/ci boost-ci/.codecov.yml . 67 | 68 | if [ "$TRAVIS_OS_NAME" == "osx" ]; then 69 | unset -f cd 70 | fi 71 | 72 | export SELF=`basename $REPO_NAME` 73 | export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" 74 | export BOOST_CI_SRC_FOLDER=$(pwd) 75 | 76 | . ./ci/common_install.sh 77 | 78 | echo '==================================> SCRIPT' 79 | 80 | cd $BOOST_ROOT/libs/$SELF 81 | ci/travis/cppcheck.sh 82 | 83 | elif [ "$DRONE_JOB_BUILDTYPE" == "b5847f804b-db180b7bd2" ]; then 84 | 85 | echo '==================================> INSTALL' 86 | 87 | git clone https://github.com/boostorg/boost-ci.git boost-ci 88 | cp -pr boost-ci/ci boost-ci/.codecov.yml . 89 | 90 | if [ "$TRAVIS_OS_NAME" == "osx" ]; then 91 | unset -f cd 92 | fi 93 | 94 | export SELF=`basename $REPO_NAME` 95 | export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" 96 | export BOOST_CI_SRC_FOLDER=$(pwd) 97 | 98 | . ./ci/common_install.sh 99 | 100 | echo '==================================> SCRIPT' 101 | 102 | cd $BOOST_ROOT/libs/$SELF 103 | ci/travis/valgrind.sh 104 | 105 | elif [ "$DRONE_JOB_BUILDTYPE" == "b5847f804b-e70eed6a8b" ]; then 106 | 107 | echo '==================================> INSTALL' 108 | 109 | git clone https://github.com/boostorg/boost-ci.git boost-ci 110 | cp -pr boost-ci/ci boost-ci/.codecov.yml . 111 | 112 | if [ "$TRAVIS_OS_NAME" == "osx" ]; then 113 | unset -f cd 114 | fi 115 | 116 | export SELF=`basename $REPO_NAME` 117 | export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" 118 | export BOOST_CI_SRC_FOLDER=$(pwd) 119 | 120 | . ./ci/common_install.sh 121 | 122 | echo '==================================> SCRIPT' 123 | 124 | cd $BOOST_ROOT 125 | mkdir __build__ && cd __build__ 126 | cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=move .. 127 | ctest --output-on-failure -R boost_move 128 | 129 | elif [ "$DRONE_JOB_BUILDTYPE" == "b5847f804b-cce9827eb5" ]; then 130 | 131 | echo '==================================> INSTALL' 132 | 133 | git clone https://github.com/boostorg/boost-ci.git boost-ci 134 | cp -pr boost-ci/ci boost-ci/.codecov.yml . 135 | 136 | if [ "$TRAVIS_OS_NAME" == "osx" ]; then 137 | unset -f cd 138 | fi 139 | 140 | export SELF=`basename $REPO_NAME` 141 | export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" 142 | export BOOST_CI_SRC_FOLDER=$(pwd) 143 | 144 | . ./ci/common_install.sh 145 | 146 | echo '==================================> SCRIPT' 147 | 148 | if [ -n "${COVERITY_SCAN_NOTIFICATION_EMAIL}" -a \( "$DRONE_BRANCH" = "develop" -o "$DRONE_BRANCH" = "master" \) -a "$DRONE_BUILD_EVENT" = "push" ] ; then 149 | cd $BOOST_ROOT/libs/$SELF 150 | ci/travis/coverity.sh 151 | fi 152 | 153 | fi 154 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto !eol svneol=native#text/plain 2 | *.gitattributes text svneol=native#text/plain 3 | 4 | # Scriptish formats 5 | *.bat text svneol=native#text/plain 6 | *.bsh text svneol=native#text/x-beanshell 7 | *.cgi text svneol=native#text/plain 8 | *.cmd text svneol=native#text/plain 9 | *.js text svneol=native#text/javascript 10 | *.php text svneol=native#text/x-php 11 | *.pl text svneol=native#text/x-perl 12 | *.pm text svneol=native#text/x-perl 13 | *.py text svneol=native#text/x-python 14 | *.sh eol=lf svneol=LF#text/x-sh 15 | configure eol=lf svneol=LF#text/x-sh 16 | 17 | # Image formats 18 | *.bmp binary svneol=unset#image/bmp 19 | *.gif binary svneol=unset#image/gif 20 | *.ico binary svneol=unset#image/ico 21 | *.jpeg binary svneol=unset#image/jpeg 22 | *.jpg binary svneol=unset#image/jpeg 23 | *.png binary svneol=unset#image/png 24 | *.tif binary svneol=unset#image/tiff 25 | *.tiff binary svneol=unset#image/tiff 26 | *.svg text svneol=native#image/svg%2Bxml 27 | 28 | # Data formats 29 | *.pdf binary svneol=unset#application/pdf 30 | *.avi binary svneol=unset#video/avi 31 | *.doc binary svneol=unset#application/msword 32 | *.dsp text svneol=crlf#text/plain 33 | *.dsw text svneol=crlf#text/plain 34 | *.eps binary svneol=unset#application/postscript 35 | *.gz binary svneol=unset#application/gzip 36 | *.mov binary svneol=unset#video/quicktime 37 | *.mp3 binary svneol=unset#audio/mpeg 38 | *.ppt binary svneol=unset#application/vnd.ms-powerpoint 39 | *.ps binary svneol=unset#application/postscript 40 | *.psd binary svneol=unset#application/photoshop 41 | *.rdf binary svneol=unset#text/rdf 42 | *.rss text svneol=unset#text/xml 43 | *.rtf binary svneol=unset#text/rtf 44 | *.sln text svneol=native#text/plain 45 | *.swf binary svneol=unset#application/x-shockwave-flash 46 | *.tgz binary svneol=unset#application/gzip 47 | *.vcproj text svneol=native#text/xml 48 | *.vcxproj text svneol=native#text/xml 49 | *.vsprops text svneol=native#text/xml 50 | *.wav binary svneol=unset#audio/wav 51 | *.xls binary svneol=unset#application/vnd.ms-excel 52 | *.zip binary svneol=unset#application/zip 53 | 54 | # Text formats 55 | .htaccess text svneol=native#text/plain 56 | *.bbk text svneol=native#text/xml 57 | *.cmake text svneol=native#text/plain 58 | *.css text svneol=native#text/css 59 | *.dtd text svneol=native#text/xml 60 | *.htm text svneol=native#text/html 61 | *.html text svneol=native#text/html 62 | *.ini text svneol=native#text/plain 63 | *.log text svneol=native#text/plain 64 | *.mak text svneol=native#text/plain 65 | *.qbk text svneol=native#text/plain 66 | *.rst text svneol=native#text/plain 67 | *.sql text svneol=native#text/x-sql 68 | *.txt text svneol=native#text/plain 69 | *.xhtml text svneol=native#text/xhtml%2Bxml 70 | *.xml text svneol=native#text/xml 71 | *.xsd text svneol=native#text/xml 72 | *.xsl text svneol=native#text/xml 73 | *.xslt text svneol=native#text/xml 74 | *.xul text svneol=native#text/xul 75 | *.yml text svneol=native#text/plain 76 | boost-no-inspect text svneol=native#text/plain 77 | CHANGES text svneol=native#text/plain 78 | COPYING text svneol=native#text/plain 79 | INSTALL text svneol=native#text/plain 80 | Jamfile text svneol=native#text/plain 81 | Jamroot text svneol=native#text/plain 82 | Jamfile.v2 text svneol=native#text/plain 83 | Jamrules text svneol=native#text/plain 84 | Makefile* text svneol=native#text/plain 85 | README text svneol=native#text/plain 86 | TODO text svneol=native#text/plain 87 | 88 | # Code formats 89 | *.c text svneol=native#text/plain 90 | *.cpp text svneol=native#text/plain 91 | *.h text svneol=native#text/plain 92 | *.hpp text svneol=native#text/plain 93 | *.ipp text svneol=native#text/plain 94 | *.tpp text svneol=native#text/plain 95 | *.jam text svneol=native#text/plain 96 | *.java text svneol=native#text/plain 97 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # This .gitignore file was automatically created by Microsoft(R) Visual Studio. 3 | ################################################################################ 4 | 5 | /Bin/Win32 6 | /doc/html 7 | /doc/autodoc.xml 8 | /proj/vs 9 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Mike Dev 2 | # Copyright 2019 Peter Dimov 3 | # Copyright 2023 Ion Gaztanaga 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt 6 | 7 | cmake_minimum_required(VERSION 3.5...3.16) 8 | 9 | project(boost_move VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) 10 | 11 | add_library(boost_move INTERFACE) 12 | add_library(Boost::move ALIAS boost_move) 13 | 14 | target_include_directories(boost_move INTERFACE include) 15 | 16 | target_link_libraries(boost_move 17 | INTERFACE 18 | Boost::config 19 | ) 20 | 21 | if(BUILD_TESTING) 22 | 23 | add_subdirectory(test) 24 | 25 | endif() 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Move, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), provides C++0x move semantics in C++03 compilers and allows writing portable code that works optimally in C++03 and C++0x compilers. 2 | 3 | ### License 4 | 5 | Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). 6 | 7 | ### Properties 8 | 9 | * C++03 10 | * Header-Only 11 | 12 | ### Build Status 13 | 14 | Branch | Deps | Docs | Tests | 15 | :-------------: | ---- | ---- | ----- | 16 | [`master`](https://github.com/boostorg/move/tree/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/move.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/move.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/move.html) 17 | [`develop`](https://github.com/boostorg/move/tree/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/move.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/move.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/move.html) 18 | 19 | ### Directories 20 | 21 | | Name | Purpose | 22 | | ----------- | ------------------------------ | 23 | | `doc` | documentation | 24 | | `example` | examples | 25 | | `include` | headers | 26 | | `proj` | ide projects | 27 | | `test` | unit tests | 28 | 29 | ### More information 30 | 31 | * [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-move) 32 | * [Report bugs](https://github.com/boostorg/move/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. 33 | * Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). 34 | * Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[move]` tag at the beginning of the subject line. 35 | 36 | -------------------------------------------------------------------------------- /build.jam: -------------------------------------------------------------------------------- 1 | # Copyright René Ferdinand Rivera Morell 2023-2024 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE_1_0.txt or copy at 4 | # http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | require-b2 5.2 ; 7 | 8 | constant boost_dependencies : 9 | /boost/config//boost_config ; 10 | 11 | project /boost/move 12 | : common-requirements 13 | include 14 | ; 15 | 16 | explicit 17 | [ alias boost_move : : : : $(boost_dependencies) ] 18 | [ alias all : boost_move example test ] 19 | ; 20 | 21 | call-if : boost-library move 22 | ; 23 | 24 | -------------------------------------------------------------------------------- /doc/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Move library documentation Jamfile 2 | # 3 | # Copyright Ion Gaztanaga 2009. 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # See http://www.boost.org/libs/move for documentation. 9 | 10 | 11 | import doxygen ; 12 | import quickbook ; 13 | 14 | doxygen autodoc 15 | : 16 | [ glob ../include/boost/move/*.hpp ] 17 | [ glob ../include/boost/move/algo/*.hpp ] 18 | : 19 | HIDE_UNDOC_MEMBERS=YES 20 | HIDE_UNDOC_MEMBERS=YES 21 | HIDE_UNDOC_CLASSES=YES 22 | EXTRACT_PRIVATE=NO 23 | ENABLE_PREPROCESSING=YES 24 | MACRO_EXPANSION=YES 25 | "PREDEFINED=\"BOOST_MOVE_DOXYGEN_INVOKED\" \\ 26 | \"BOOST_NOEXCEPT_OR_NOTHROW=noexcept\" \\ 27 | \"BOOST_NOEXCEPT_IF(T)=noexcept(T)\" \\ 28 | \"BOOST_NOEXCEPT=noexcept\" \\ 29 | \"BOOST_MOVE_SEEDOC(T)=see_documentation\" \\ 30 | \"BOOST_RV_REF(T)=T&&\" \\ 31 | \"BOOST_RV_REF_BEG=\" \\ 32 | \"BOOST_RV_REF_END=&&\" \\ 33 | \"BOOST_FWD_REF(T)=T&&\" \\ 34 | \"BOOST_MOVE_DOC0PTR(T)=std::nullptr_t\" \\ 35 | \"BOOST_MOVE_DOC1ST(T1, T2)=T1\" \\ 36 | \"BOOST_MOVE_DOCIGN(T1) \"\\ 37 | \"BOOST_MOVE_FORCEINLINE=inline\" \\ 38 | " 39 | ; 40 | 41 | xml move : move.qbk ; 42 | 43 | boostbook standalone 44 | : 45 | move 46 | : 47 | html:boost.root=../../../.. 48 | html:boost.libraries=../../../../libs/libraries.htm 49 | generate.section.toc.level=3 50 | chunk.first.sections=1 51 | autodoc 52 | ; 53 | 54 | ############################################################################### 55 | alias boostdoc 56 | : move 57 | : 58 | : autodoc 59 | : ; 60 | explicit boostdoc ; 61 | alias boostrelease ; 62 | explicit boostrelease ; 63 | -------------------------------------------------------------------------------- /example/Jamfile.v2: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | ## 3 | ## (C) Copyright Ion Gaztanaga 2008-2009 Distributed under the Boost 4 | ## Software License, Version 1.0. (See accompanying file 5 | ## LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | ## 7 | ## 8 | ############################################################################## 9 | # 10 | import testing ; 11 | 12 | project : requirements 13 | /boost/container//boost_container 14 | /boost/type_traits//boost_type_traits 15 | ; 16 | 17 | rule test_all 18 | { 19 | local all_rules = ; 20 | 21 | for local fileb in [ glob *.cpp ] 22 | { 23 | all_rules += [ run $(fileb) 24 | : # additional args 25 | : # test-files 26 | : # requirements 27 | ] ; 28 | } 29 | 30 | return $(all_rules) ; 31 | } 32 | 33 | test-suite move_example : [ test_all r ] 34 | : static 35 | ; 36 | 37 | -------------------------------------------------------------------------------- /example/copymovable.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2009. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | #ifndef BOOST_MOVE_TEST_COPYMOVABLE_HPP 12 | #define BOOST_MOVE_TEST_COPYMOVABLE_HPP 13 | 14 | //[copy_movable_definition 15 | //header file "copymovable.hpp" 16 | #include 17 | 18 | //A copy_movable class 19 | class copy_movable 20 | { 21 | BOOST_COPYABLE_AND_MOVABLE(copy_movable) 22 | int value_; 23 | 24 | public: 25 | copy_movable() : value_(1){} 26 | 27 | //Move constructor and assignment 28 | copy_movable(BOOST_RV_REF(copy_movable) m) 29 | { value_ = m.value_; m.value_ = 0; } 30 | 31 | copy_movable(const copy_movable &m) 32 | { value_ = m.value_; } 33 | 34 | copy_movable & operator=(BOOST_RV_REF(copy_movable) m) 35 | { value_ = m.value_; m.value_ = 0; return *this; } 36 | 37 | copy_movable & operator=(BOOST_COPY_ASSIGN_REF(copy_movable) m) 38 | { value_ = m.value_; return *this; } 39 | 40 | bool moved() const //Observer 41 | { return value_ == 0; } 42 | }; 43 | 44 | //A copyable-only class 45 | class copyable 46 | {}; 47 | 48 | //A copyable-only class 49 | class non_copy_movable 50 | { 51 | public: 52 | non_copy_movable(){} 53 | private: 54 | non_copy_movable(const non_copy_movable&); 55 | non_copy_movable& operator=(const non_copy_movable&); 56 | }; 57 | 58 | //] 59 | 60 | #endif //BOOST_MOVE_TEST_COPYMOVABLE_HPP 61 | -------------------------------------------------------------------------------- /example/doc_clone_ptr.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2009. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | #include 12 | 13 | //[clone_ptr_base_derived 14 | class Base 15 | { 16 | BOOST_COPYABLE_AND_MOVABLE(Base) 17 | 18 | public: 19 | Base(){} 20 | 21 | Base(const Base &/*x*/) {/**/} // Copy ctor 22 | 23 | Base(BOOST_RV_REF(Base) /*x*/) {/**/} // Move ctor 24 | 25 | Base& operator=(BOOST_RV_REF(Base) /*x*/) 26 | {/**/ return *this;} // Move assign 27 | 28 | Base& operator=(BOOST_COPY_ASSIGN_REF(Base) /*x*/) 29 | {/**/ return *this;} // Copy assign 30 | 31 | virtual Base *clone() const 32 | { return new Base(*this); } 33 | 34 | virtual ~Base(){} 35 | }; 36 | 37 | class Member 38 | { 39 | BOOST_COPYABLE_AND_MOVABLE(Member) 40 | 41 | public: 42 | Member(){} 43 | 44 | // Compiler-generated copy constructor... 45 | 46 | Member(BOOST_RV_REF(Member)) {/**/} // Move ctor 47 | 48 | Member &operator=(BOOST_RV_REF(Member)) // Move assign 49 | {/**/ return *this; } 50 | 51 | Member &operator=(BOOST_COPY_ASSIGN_REF(Member)) // Copy assign 52 | {/**/ return *this; } 53 | }; 54 | 55 | class Derived : public Base 56 | { 57 | BOOST_COPYABLE_AND_MOVABLE(Derived) 58 | Member mem_; 59 | 60 | public: 61 | Derived(){} 62 | 63 | // Compiler-generated copy constructor... 64 | 65 | Derived(BOOST_RV_REF(Derived) x) // Move ctor 66 | : Base(BOOST_MOVE_BASE(Base, x)), 67 | mem_(boost::move(x.mem_)) { } 68 | 69 | Derived& operator=(BOOST_RV_REF(Derived) x) // Move assign 70 | { 71 | Base::operator=(BOOST_MOVE_BASE(Base, x)); 72 | mem_ = boost::move(x.mem_); 73 | return *this; 74 | } 75 | 76 | Derived& operator=(BOOST_COPY_ASSIGN_REF(Derived) x) // Copy assign 77 | { 78 | Base::operator=(x); 79 | mem_ = x.mem_; 80 | return *this; 81 | } 82 | // ... 83 | }; 84 | //] 85 | 86 | //[clone_ptr_def 87 | template 88 | class clone_ptr 89 | { 90 | private: 91 | // Mark this class copyable and movable 92 | BOOST_COPYABLE_AND_MOVABLE(clone_ptr) 93 | T* ptr; 94 | 95 | public: 96 | // Construction 97 | explicit clone_ptr(T* p = 0) : ptr(p) {} 98 | 99 | // Destruction 100 | ~clone_ptr() { delete ptr; } 101 | 102 | clone_ptr(const clone_ptr& p) // Copy constructor (as usual) 103 | : ptr(p.ptr ? p.ptr->clone() : 0) {} 104 | 105 | clone_ptr& operator=(BOOST_COPY_ASSIGN_REF(clone_ptr) p) // Copy assignment 106 | { 107 | if (this != &p){ 108 | T *tmp_p = p.ptr ? p.ptr->clone() : 0; 109 | delete ptr; 110 | ptr = tmp_p; 111 | } 112 | return *this; 113 | } 114 | 115 | //Move semantics... 116 | clone_ptr(BOOST_RV_REF(clone_ptr) p) //Move constructor 117 | : ptr(p.ptr) { p.ptr = 0; } 118 | 119 | clone_ptr& operator=(BOOST_RV_REF(clone_ptr) p) //Move assignment 120 | { 121 | if (this != &p){ 122 | delete ptr; 123 | ptr = p.ptr; 124 | p.ptr = 0; 125 | } 126 | return *this; 127 | } 128 | }; 129 | //] 130 | 131 | int main() 132 | { 133 | { 134 | //[copy_clone_ptr 135 | clone_ptr p1(new Derived()); 136 | // ... 137 | clone_ptr p2 = p1; // p2 and p1 each own their own pointer 138 | //] 139 | } 140 | { 141 | //[move_clone_ptr 142 | clone_ptr p1(new Derived()); 143 | // ... 144 | clone_ptr p2 = boost::move(p1); // p2 now owns the pointer instead of p1 145 | p2 = clone_ptr(new Derived()); // temporary is moved to p2 146 | } 147 | //] 148 | //[clone_ptr_move_derived 149 | Derived d; 150 | Derived d2(boost::move(d)); 151 | d2 = boost::move(d); 152 | //] 153 | return 0; 154 | } 155 | -------------------------------------------------------------------------------- /example/doc_construct_forward.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright David Abrahams, Vicente Botet, Ion Gaztanaga 2009. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //[construct_forward_example 13 | #include 14 | #include 15 | 16 | class copyable_only_tester 17 | { 18 | public: 19 | copyable_only_tester() 20 | { std::cout << "copyable_only_tester()" << std::endl; } 21 | 22 | copyable_only_tester(const copyable_only_tester&) 23 | { std::cout << "copyable_only_tester(const copyable_only_tester&)" << std::endl; } 24 | 25 | copyable_only_tester(int) 26 | { std::cout << "copyable_only_tester(int)" << std::endl; } 27 | 28 | copyable_only_tester(int, double) 29 | { std::cout << "copyable_only_tester(int, double)" << std::endl; } 30 | }; 31 | 32 | class copyable_movable_tester 33 | { 34 | // move semantics 35 | BOOST_COPYABLE_AND_MOVABLE(copyable_movable_tester) 36 | public: 37 | 38 | copyable_movable_tester() 39 | { std::cout << "copyable_movable_tester()" << std::endl; } 40 | 41 | copyable_movable_tester(int) 42 | { std::cout << "copyable_movable_tester(int)" << std::endl; } 43 | 44 | copyable_movable_tester(BOOST_RV_REF(copyable_movable_tester)) 45 | { std::cout << "copyable_movable_tester(BOOST_RV_REF(copyable_movable_tester))" << std::endl; } 46 | 47 | copyable_movable_tester(const copyable_movable_tester &) 48 | { std::cout << "copyable_movable_tester(const copyable_movable_tester &)" << std::endl; } 49 | 50 | copyable_movable_tester(BOOST_RV_REF(copyable_movable_tester), BOOST_RV_REF(copyable_movable_tester)) 51 | { std::cout << "copyable_movable_tester(BOOST_RV_REF(copyable_movable_tester), BOOST_RV_REF(copyable_movable_tester))" << std::endl; } 52 | 53 | copyable_movable_tester &operator=(BOOST_RV_REF(copyable_movable_tester)) 54 | { std::cout << "copyable_movable_tester & operator=(BOOST_RV_REF(copyable_movable_tester))" << std::endl; 55 | return *this; } 56 | 57 | copyable_movable_tester &operator=(BOOST_COPY_ASSIGN_REF(copyable_movable_tester)) 58 | { std::cout << "copyable_movable_tester & operator=(BOOST_COPY_ASSIGN_REF(copyable_movable_tester))" << std::endl; 59 | return *this; } 60 | }; 61 | 62 | //1 argument 63 | template 64 | void function_construct(BOOST_FWD_REF(MaybeRv) x) 65 | { MaybeMovable m(boost::forward(x)); } 66 | 67 | //2 argument 68 | template 69 | void function_construct(BOOST_FWD_REF(MaybeRv) x, BOOST_FWD_REF(MaybeRv2) x2) 70 | { MaybeMovable m(boost::forward(x), boost::forward(x2)); } 71 | 72 | int main() 73 | { 74 | copyable_movable_tester m; 75 | //move constructor 76 | function_construct(boost::move(m)); 77 | //copy constructor 78 | function_construct(copyable_movable_tester()); 79 | //two rvalue constructor 80 | function_construct(boost::move(m), boost::move(m)); 81 | 82 | copyable_only_tester nm; 83 | //copy constructor (copyable_only_tester has no move ctor.) 84 | function_construct(boost::move(nm)); 85 | //copy constructor 86 | function_construct(nm); 87 | //int constructor 88 | function_construct(int(0)); 89 | //int, double constructor 90 | function_construct(int(0), double(0.0)); 91 | 92 | //Output is: 93 | //copyable_movable_tester() 94 | //copyable_movable_tester(BOOST_RV_REF(copyable_movable_tester)) 95 | //copyable_movable_tester() 96 | //copyable_movable_tester(const copyable_movable_tester &) 97 | //copyable_movable_tester(BOOST_RV_REF(copyable_movable_tester), BOOST_RV_REF(copyable_movable_tester)) 98 | //copyable_only_tester() 99 | //copyable_only_tester(const copyable_only_tester&) 100 | //copyable_only_tester(const copyable_only_tester&) 101 | //copyable_only_tester(int) 102 | //copyable_only_tester(int, double) 103 | return 0; 104 | } 105 | //] 106 | -------------------------------------------------------------------------------- /example/doc_file_descriptor.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2008-2012. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //[file_descriptor_def 13 | 14 | #include 15 | #include 16 | 17 | class file_descriptor 18 | { 19 | //<- 20 | int operating_system_open_file(const char *) 21 | { 22 | return 1; 23 | } 24 | 25 | void operating_system_close_file(int) 26 | {} 27 | //-> 28 | int os_descr_; 29 | 30 | private: 31 | BOOST_MOVABLE_BUT_NOT_COPYABLE(file_descriptor) 32 | 33 | public: 34 | explicit file_descriptor(const char *filename) //Constructor 35 | : os_descr_(operating_system_open_file(filename)) 36 | { 37 | //=if(!os_descr_) 38 | //=throw std::runtime_error("file not found"); 39 | } 40 | 41 | ~file_descriptor() //Destructor 42 | { if(os_descr_) operating_system_close_file(os_descr_); } 43 | 44 | file_descriptor(BOOST_RV_REF(file_descriptor) x) // Move ctor 45 | : os_descr_(x.os_descr_) 46 | { x.os_descr_ = 0; } 47 | 48 | file_descriptor& operator=(BOOST_RV_REF(file_descriptor) x) // Move assign 49 | { 50 | if(os_descr_) operating_system_close_file(os_descr_); 51 | os_descr_ = x.os_descr_; 52 | x.os_descr_ = 0; 53 | return *this; 54 | } 55 | 56 | bool empty() const { return os_descr_ == 0; } 57 | }; 58 | 59 | //] 60 | 61 | //[file_descriptor_example 62 | #include 63 | #include 64 | 65 | //Remember: 'file_descriptor' is NOT copyable, but it 66 | //can be returned from functions thanks to move semantics 67 | file_descriptor create_file_descriptor(const char *filename) 68 | { return file_descriptor(filename); } 69 | 70 | int main() 71 | { 72 | //Open a file obtaining its descriptor, the temporary 73 | //returned from 'create_file_descriptor' is moved to 'fd'. 74 | file_descriptor fd = create_file_descriptor("filename"); 75 | assert(!fd.empty()); 76 | 77 | //Now move fd into a vector 78 | boost::container::vector v; 79 | v.push_back(boost::move(fd)); 80 | 81 | //Check ownership has been transferred 82 | assert(fd.empty()); 83 | assert(!v[0].empty()); 84 | 85 | //Compilation error if uncommented since file_descriptor is not copyable 86 | //and vector copy construction requires value_type's copy constructor: 87 | //boost::container::vector v2(v); 88 | return 0; 89 | } 90 | //] 91 | -------------------------------------------------------------------------------- /example/doc_how_works.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2009. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | #include 13 | 14 | #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 15 | 16 | int main() 17 | { 18 | return 0; 19 | } 20 | 21 | #else 22 | 23 | //[how_works_example 24 | #include 25 | #include 26 | 27 | class sink_tester 28 | { 29 | public: //conversions provided by BOOST_COPYABLE_AND_MOVABLE 30 | operator ::boost::rv&() 31 | { return *static_cast< ::boost::rv* >(this); } 32 | operator const ::boost::rv&() const 33 | { return *static_cast* >(this); } 34 | }; 35 | 36 | //Functions returning different r/lvalue types 37 | sink_tester rvalue() { return sink_tester(); } 38 | const sink_tester const_rvalue() { return sink_tester(); } 39 | sink_tester & lvalue() { static sink_tester lv; return lv; } 40 | const sink_tester & const_lvalue() { static const sink_tester clv = sink_tester(); return clv; } 41 | 42 | //BOOST_RV_REF overload 43 | void sink(::boost::rv &) { std::cout << "non-const rvalue catched" << std::endl; } 44 | //BOOST_COPY_ASSIGN_REF overload 45 | void sink(const ::boost::rv &){ std::cout << "const (r-l)value catched" << std::endl; } 46 | //Overload provided by BOOST_COPYABLE_AND_MOVABLE 47 | void sink(sink_tester &) { std::cout << "non-const lvalue catched" << std::endl; } 48 | 49 | int main() 50 | { 51 | sink(const_rvalue()); //"const (r-l)value catched" 52 | sink(const_lvalue()); //"const (r-l)value catched" 53 | sink(lvalue()); //"non-const lvalue catched" 54 | sink(rvalue()); //"non-const rvalue catched" 55 | return 0; 56 | } 57 | //] 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /example/doc_move_algorithms.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2009. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //[move_algorithms_example 13 | #include "movable.hpp" 14 | #include 15 | #include 16 | #include 17 | 18 | int main() 19 | { 20 | const std::size_t ArraySize = 10; 21 | movable movable_array[ArraySize]; 22 | movable movable_array2[ArraySize]; 23 | //move 24 | boost::move(&movable_array2[0], &movable_array2[ArraySize], &movable_array[0]); 25 | assert(movable_array2[0].moved()); 26 | assert(!movable_array[0].moved()); 27 | 28 | //move backward 29 | boost::move_backward(&movable_array[0], &movable_array[ArraySize], &movable_array2[ArraySize]); 30 | assert(movable_array[0].moved()); 31 | assert(!movable_array2[0].moved()); 32 | 33 | //uninitialized_move 34 | boost::aligned_storage< sizeof(movable)*ArraySize 35 | , boost::alignment_of::value>::type storage; 36 | movable *raw_movable = static_cast(static_cast(&storage)); 37 | boost::uninitialized_move(&movable_array2[0], &movable_array2[ArraySize], raw_movable); 38 | assert(movable_array2[0].moved()); 39 | assert(!raw_movable[0].moved()); 40 | return 0; 41 | } 42 | //] 43 | 44 | -------------------------------------------------------------------------------- /example/doc_move_inserter.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2009. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //[move_inserter_example 13 | #include 14 | #include 15 | #include "movable.hpp" 16 | #include 17 | #include 18 | 19 | using namespace ::boost::container; 20 | 21 | typedef list list_t; 22 | typedef list_t::iterator l_iterator; 23 | 24 | template 25 | void test_move_inserter(list_t &l2, MoveInsertIterator mit) 26 | { 27 | //Create a list with 10 default constructed objects 28 | list l(10); 29 | assert(!l.begin()->moved()); 30 | l2.clear(); 31 | 32 | //Move insert into l2 containers 33 | std::copy(l.begin(), l.end(), mit); 34 | 35 | //Check size and status 36 | assert(l2.size() == l.size()); 37 | assert(l.begin()->moved()); 38 | assert(!l2.begin()->moved()); 39 | } 40 | 41 | int main() 42 | { 43 | list_t l2; 44 | test_move_inserter(l2, boost::back_move_inserter(l2)); 45 | test_move_inserter(l2, boost::front_move_inserter(l2)); 46 | test_move_inserter(l2, boost::move_inserter(l2, l2.end())); 47 | return 0; 48 | } 49 | //] 50 | -------------------------------------------------------------------------------- /example/doc_move_iterator.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2009. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //[move_iterator_example 13 | #include 14 | #include "movable.hpp" 15 | #include 16 | 17 | int main() 18 | { 19 | using namespace ::boost::container; 20 | 21 | //Create a vector with 10 default constructed objects 22 | vector v(10); 23 | assert(!v[0].moved()); 24 | 25 | //Move construct all elements in v into v2 26 | vector v2( boost::make_move_iterator(v.begin()) 27 | , boost::make_move_iterator(v.end())); 28 | assert(v[0].moved()); 29 | assert(!v2[0].moved()); 30 | 31 | //Now move assign all elements from in v2 back into v 32 | v.assign( boost::make_move_iterator(v2.begin()) 33 | , boost::make_move_iterator(v2.end())); 34 | assert(v2[0].moved()); 35 | assert(!v[0].moved()); 36 | 37 | return 0; 38 | } 39 | //] 40 | -------------------------------------------------------------------------------- /example/doc_move_return.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2014-2014. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //[move_return_example 13 | #include "movable.hpp" 14 | #include "copymovable.hpp" 15 | #include 16 | 17 | template 18 | struct factory_functor 19 | { 20 | typedef Type return_type; 21 | 22 | Type operator()() const 23 | { Type t; return BOOST_MOVE_RET(Type, t); } 24 | }; 25 | 26 | struct return_reference 27 | { 28 | typedef non_copy_movable &return_type; 29 | 30 | non_copy_movable &operator()() const 31 | { return ncm; } 32 | 33 | static non_copy_movable ncm; 34 | }; 35 | 36 | non_copy_movable return_reference::ncm; 37 | 38 | //A wrapper that locks a mutex while the 39 | //factory creates a new value. 40 | //It must generically move the return value 41 | //if possible both in C++03 and C++11 42 | template 43 | typename Factory::return_type lock_wrapper(Factory f) 44 | { 45 | typedef typename Factory::return_type return_type; 46 | //LOCK(); 47 | return_type r = f(); 48 | //UNLOCK(); 49 | 50 | //In C++03: boost::move() if R is not a reference and 51 | //has move emulation enabled. In C++11: just return r. 52 | return BOOST_MOVE_RET(return_type, r); 53 | } 54 | 55 | int main() 56 | { 57 | movable m = lock_wrapper(factory_functor ()); 58 | copy_movable cm = lock_wrapper(factory_functor()); 59 | copyable c = lock_wrapper(factory_functor ()); 60 | non_copy_movable &mr = lock_wrapper(return_reference ()); 61 | //<- 62 | boost::movelib::ignore(m); boost::movelib::ignore(cm); boost::movelib::ignore(c); boost::movelib::ignore(mr); 63 | //-> 64 | return 0; 65 | } 66 | //] 67 | -------------------------------------------------------------------------------- /example/doc_template_assign.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2014-2014. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | #include 13 | 14 | #include 15 | 16 | //[template_assign_example_foo_bar 17 | 18 | class Foo 19 | { 20 | BOOST_COPYABLE_AND_MOVABLE(Foo) 21 | 22 | public: 23 | int i; 24 | explicit Foo(int val) : i(val) {} 25 | 26 | Foo(BOOST_RV_REF(Foo) obj) : i(obj.i) {} 27 | 28 | Foo& operator=(BOOST_RV_REF(Foo) rhs) 29 | { i = rhs.i; rhs.i = 0; return *this; } 30 | 31 | Foo& operator=(BOOST_COPY_ASSIGN_REF(Foo) rhs) 32 | { i = rhs.i; return *this; } //(1) 33 | 34 | template //(*) TEMPLATED ASSIGNMENT, potential problem 35 | //<- 36 | #if 1 37 | typename ::boost::move_detail::disable_if_same::type 38 | operator=(const U& rhs) 39 | #else 40 | //-> 41 | Foo& operator=(const U& rhs) 42 | //<- 43 | #endif 44 | //-> 45 | { i = -rhs.i; return *this; } //(2) 46 | }; 47 | //] 48 | 49 | struct Bar 50 | { 51 | int i; 52 | explicit Bar(int val) : i(val) {} 53 | }; 54 | 55 | 56 | //<- 57 | #ifdef NDEBUG 58 | #undef NDEBUG 59 | #endif 60 | //-> 61 | #include 62 | 63 | int main() 64 | { 65 | //[template_assign_example_main 66 | Foo foo1(1); 67 | //<- 68 | assert(foo1.i == 1); 69 | //-> 70 | Foo foo2(2); 71 | //<- 72 | assert(foo2.i == 2); 73 | Bar bar(3); 74 | assert(bar.i == 3); 75 | //-> 76 | foo2 = foo1; // Calls (1) in C++11 but (2) in C++98 77 | //<- 78 | assert(foo2.i == 1); 79 | assert(foo1.i == 1); //Fails in C++98 unless workaround is applied 80 | foo1 = bar; 81 | assert(foo1.i == -3); 82 | foo2 = boost::move(foo1); 83 | assert(foo1.i == 0); 84 | assert(foo2.i == -3); 85 | //-> 86 | const Foo foo5(5); 87 | foo2 = foo5; // Calls (1) in C++11 but (2) in C++98 88 | //<- 89 | assert(foo2.i == 5); //Fails in C++98 unless workaround is applied 90 | assert(foo5.i == 5); 91 | //-> 92 | //] 93 | return 0; 94 | } 95 | 96 | -------------------------------------------------------------------------------- /example/movable.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2009. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | #ifndef BOOST_MOVE_TEST_MOVABLE_HPP 12 | #define BOOST_MOVE_TEST_MOVABLE_HPP 13 | 14 | //[movable_definition 15 | //header file "movable.hpp" 16 | 17 | //This devinition should only include a single, minimal move header 18 | #include 19 | 20 | //Forward declaration of 21 | namespace boost{ 22 | 23 | template 24 | struct has_nothrow_move; 25 | 26 | } //namespace boost{ 27 | 28 | //A movable class 29 | class movable 30 | { 31 | BOOST_MOVABLE_BUT_NOT_COPYABLE(movable) 32 | int value_; 33 | 34 | public: 35 | movable() : value_(1){} 36 | 37 | //Move constructor and assignment 38 | movable(BOOST_RV_REF(movable) m) 39 | { value_ = m.value_; m.value_ = 0; } 40 | 41 | movable & operator=(BOOST_RV_REF(movable) m) 42 | { value_ = m.value_; m.value_ = 0; return *this; } 43 | 44 | bool moved() const //Observer 45 | { return !value_; } 46 | 47 | int value() const //Observer 48 | { return value_; } 49 | }; 50 | 51 | namespace boost{ 52 | 53 | template<> 54 | struct has_nothrow_move 55 | { 56 | static const bool value = true; 57 | }; 58 | 59 | } //namespace boost{ 60 | //] 61 | 62 | #endif //BOOST_MOVE_TEST_MOVABLE_HPP 63 | -------------------------------------------------------------------------------- /include/boost/move/algo/detail/basic_op.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2015-2016. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | #ifndef BOOST_MOVE_ALGO_BASIC_OP 12 | #define BOOST_MOVE_ALGO_BASIC_OP 13 | 14 | #ifndef BOOST_CONFIG_HPP 15 | # include 16 | #endif 17 | # 18 | #if defined(BOOST_HAS_PRAGMA_ONCE) 19 | # pragma once 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace boost { 28 | namespace movelib { 29 | 30 | struct forward_t{}; 31 | struct backward_t{}; 32 | struct three_way_t{}; 33 | struct three_way_forward_t{}; 34 | struct four_way_t{}; 35 | 36 | struct move_op 37 | { 38 | template 39 | inline void operator()(SourceIt source, DestinationIt dest) 40 | { *dest = ::boost::move(*source); } 41 | 42 | template 43 | inline DestinationIt operator()(forward_t, SourceIt first, SourceIt last, DestinationIt dest_begin) 44 | { return ::boost::move(first, last, dest_begin); } 45 | 46 | template 47 | inline DestinationIt operator()(backward_t, SourceIt first, SourceIt last, DestinationIt dest_last) 48 | { return ::boost::move_backward(first, last, dest_last); } 49 | 50 | template 51 | inline void operator()(three_way_t, SourceIt srcit, DestinationIt1 dest1it, DestinationIt2 dest2it) 52 | { 53 | *dest2it = boost::move(*dest1it); 54 | *dest1it = boost::move(*srcit); 55 | } 56 | 57 | template 58 | DestinationIt2 operator()(three_way_forward_t, SourceIt srcit, SourceIt srcitend, DestinationIt1 dest1it, DestinationIt2 dest2it) 59 | { 60 | //Destination2 range can overlap SourceIt range so avoid boost::move 61 | while(srcit != srcitend){ 62 | this->operator()(three_way_t(), srcit++, dest1it++, dest2it++); 63 | } 64 | return dest2it; 65 | } 66 | 67 | template 68 | inline void operator()(four_way_t, SourceIt srcit, DestinationIt1 dest1it, DestinationIt2 dest2it, DestinationIt3 dest3it) 69 | { 70 | *dest3it = boost::move(*dest2it); 71 | *dest2it = boost::move(*dest1it); 72 | *dest1it = boost::move(*srcit); 73 | } 74 | }; 75 | 76 | struct swap_op 77 | { 78 | template 79 | inline void operator()(SourceIt source, DestinationIt dest) 80 | { boost::adl_move_swap(*dest, *source); } 81 | 82 | template 83 | inline DestinationIt operator()(forward_t, SourceIt first, SourceIt last, DestinationIt dest_begin) 84 | { return boost::adl_move_swap_ranges(first, last, dest_begin); } 85 | 86 | template 87 | inline DestinationIt operator()(backward_t, SourceIt first, SourceIt last, DestinationIt dest_begin) 88 | { return boost::adl_move_swap_ranges_backward(first, last, dest_begin); } 89 | 90 | template 91 | inline void operator()(three_way_t, SourceIt srcit, DestinationIt1 dest1it, DestinationIt2 dest2it) 92 | { 93 | typename ::boost::movelib::iterator_traits::value_type tmp(boost::move(*dest2it)); 94 | *dest2it = boost::move(*dest1it); 95 | *dest1it = boost::move(*srcit); 96 | *srcit = boost::move(tmp); 97 | } 98 | 99 | template 100 | DestinationIt2 operator()(three_way_forward_t, SourceIt srcit, SourceIt srcitend, DestinationIt1 dest1it, DestinationIt2 dest2it) 101 | { 102 | while(srcit != srcitend){ 103 | this->operator()(three_way_t(), srcit++, dest1it++, dest2it++); 104 | } 105 | return dest2it; 106 | } 107 | 108 | template 109 | inline void operator()(four_way_t, SourceIt srcit, DestinationIt1 dest1it, DestinationIt2 dest2it, DestinationIt3 dest3it) 110 | { 111 | typename ::boost::movelib::iterator_traits::value_type tmp(boost::move(*dest3it)); 112 | *dest3it = boost::move(*dest2it); 113 | *dest2it = boost::move(*dest1it); 114 | *dest1it = boost::move(*srcit); 115 | *srcit = boost::move(tmp); 116 | } 117 | }; 118 | 119 | 120 | }} //namespace boost::movelib 121 | 122 | #endif //BOOST_MOVE_ALGO_BASIC_OP 123 | -------------------------------------------------------------------------------- /include/boost/move/algo/detail/heap_sort.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2017-2018. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //! \file 13 | 14 | #ifndef BOOST_MOVE_DETAIL_HEAP_SORT_HPP 15 | #define BOOST_MOVE_DETAIL_HEAP_SORT_HPP 16 | 17 | #ifndef BOOST_CONFIG_HPP 18 | # include 19 | #endif 20 | # 21 | #if defined(BOOST_HAS_PRAGMA_ONCE) 22 | # pragma once 23 | #endif 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600)) 34 | #pragma GCC diagnostic push 35 | #pragma GCC diagnostic ignored "-Wsign-conversion" 36 | #endif 37 | 38 | namespace boost { namespace movelib{ 39 | 40 | template 41 | class heap_sort_helper 42 | { 43 | typedef typename boost::movelib::iter_size::type size_type; 44 | typedef typename boost::movelib::iterator_traits::value_type value_type; 45 | 46 | static void adjust_heap(RandomAccessIterator first, size_type hole_index, size_type const len, value_type &value, Compare comp) 47 | { 48 | size_type const top_index = hole_index; 49 | size_type second_child = size_type(2u*(hole_index + 1u)); 50 | 51 | while (second_child < len) { 52 | if (comp(*(first + second_child), *(first + size_type(second_child - 1u)))) 53 | second_child--; 54 | *(first + hole_index) = boost::move(*(first + second_child)); 55 | hole_index = second_child; 56 | second_child = size_type(2u * (second_child + 1u)); 57 | } 58 | if (second_child == len) { 59 | *(first + hole_index) = boost::move(*(first + size_type(second_child - 1u))); 60 | hole_index = size_type(second_child - 1); 61 | } 62 | 63 | { //push_heap-like ending 64 | size_type parent = size_type((hole_index - 1u) / 2u); 65 | while (hole_index > top_index && comp(*(first + parent), value)) { 66 | *(first + hole_index) = boost::move(*(first + parent)); 67 | hole_index = parent; 68 | parent = size_type((hole_index - 1u) / 2u); 69 | } 70 | *(first + hole_index) = boost::move(value); 71 | } 72 | } 73 | 74 | static void make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp) 75 | { 76 | size_type const len = size_type(last - first); 77 | if (len > 1) { 78 | size_type parent = size_type(len/2u - 1u); 79 | 80 | do { 81 | value_type v(boost::move(*(first + parent))); 82 | adjust_heap(first, parent, len, v, comp); 83 | }while (parent--); 84 | } 85 | } 86 | 87 | static void sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp) 88 | { 89 | size_type len = size_type(last - first); 90 | while (len > 1) { 91 | //move biggest to the safe zone 92 | --last; 93 | value_type v(boost::move(*last)); 94 | *last = boost::move(*first); 95 | adjust_heap(first, size_type(0), --len, v, comp); 96 | } 97 | } 98 | 99 | public: 100 | static void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp) 101 | { 102 | make_heap(first, last, comp); 103 | sort_heap(first, last, comp); 104 | assert(boost::movelib::is_sorted(first, last, comp)); 105 | } 106 | }; 107 | 108 | template 109 | inline void heap_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp) 110 | { 111 | heap_sort_helper::sort(first, last, comp); 112 | } 113 | 114 | }} //namespace boost { namespace movelib{ 115 | 116 | #if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600)) 117 | #pragma GCC diagnostic pop 118 | #endif 119 | 120 | #include 121 | 122 | #endif //#ifndef BOOST_MOVE_DETAIL_HEAP_SORT_HPP 123 | -------------------------------------------------------------------------------- /include/boost/move/algo/detail/insertion_sort.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2014-2014. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //! \file 13 | 14 | #ifndef BOOST_MOVE_DETAIL_INSERT_SORT_HPP 15 | #define BOOST_MOVE_DETAIL_INSERT_SORT_HPP 16 | 17 | #ifndef BOOST_CONFIG_HPP 18 | # include 19 | #endif 20 | # 21 | #if defined(BOOST_HAS_PRAGMA_ONCE) 22 | # pragma once 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600)) 37 | #pragma GCC diagnostic push 38 | #pragma GCC diagnostic ignored "-Wsign-conversion" 39 | #endif 40 | 41 | namespace boost { namespace movelib{ 42 | 43 | // @cond 44 | 45 | template 46 | void insertion_sort_op(ForwardIterator first1, ForwardIterator last1, BirdirectionalIterator first2, Compare comp, Op op) 47 | { 48 | if (first1 != last1){ 49 | BirdirectionalIterator last2 = first2; 50 | op(first1, last2); 51 | for (++last2; ++first1 != last1; ++last2){ 52 | BirdirectionalIterator j2 = last2; 53 | BirdirectionalIterator i2 = j2; 54 | if (comp(*first1, *--i2)){ 55 | op(i2, j2); 56 | for (--j2; i2 != first2 && comp(*first1, *--i2); --j2) { 57 | op(i2, j2); 58 | } 59 | } 60 | op(first1, j2); 61 | } 62 | } 63 | } 64 | 65 | template 66 | void insertion_sort_swap(ForwardIterator first1, ForwardIterator last1, BirdirectionalIterator first2, Compare comp) 67 | { 68 | insertion_sort_op(first1, last1, first2, comp, swap_op()); 69 | } 70 | 71 | 72 | template 73 | void insertion_sort_copy(ForwardIterator first1, ForwardIterator last1, BirdirectionalIterator first2, Compare comp) 74 | { 75 | insertion_sort_op(first1, last1, first2, comp, move_op()); 76 | } 77 | 78 | // @endcond 79 | 80 | template 81 | void insertion_sort(BirdirectionalIterator first, BirdirectionalIterator last, Compare comp) 82 | { 83 | typedef typename boost::movelib::iterator_traits::value_type value_type; 84 | if (first != last){ 85 | BirdirectionalIterator i = first; 86 | for (++i; i != last; ++i){ 87 | BirdirectionalIterator j = i; 88 | if (comp(*i, *--j)) { 89 | value_type tmp(::boost::move(*i)); 90 | *i = ::boost::move(*j); 91 | for (BirdirectionalIterator k = j; k != first && comp(tmp, *--k); --j) { 92 | *j = ::boost::move(*k); 93 | } 94 | *j = ::boost::move(tmp); 95 | } 96 | } 97 | } 98 | } 99 | 100 | template 101 | void insertion_sort_uninitialized_copy 102 | (BirdirectionalIterator first1, BirdirectionalIterator const last1 103 | , BirdirectionalRawIterator const first2 104 | , Compare comp) 105 | { 106 | typedef typename iterator_traits::value_type value_type; 107 | if (first1 != last1){ 108 | BirdirectionalRawIterator last2 = first2; 109 | ::new((iterator_to_raw_pointer)(last2), boost_move_new_t()) value_type(::boost::move(*first1)); 110 | destruct_n d(first2); 111 | d.incr(); 112 | for (++last2; ++first1 != last1; ++last2){ 113 | BirdirectionalRawIterator j2 = last2; 114 | BirdirectionalRawIterator k2 = j2; 115 | if (comp(*first1, *--k2)){ 116 | ::new((iterator_to_raw_pointer)(j2), boost_move_new_t()) value_type(::boost::move(*k2)); 117 | d.incr(); 118 | for (--j2; k2 != first2 && comp(*first1, *--k2); --j2) 119 | *j2 = ::boost::move(*k2); 120 | *j2 = ::boost::move(*first1); 121 | } 122 | else{ 123 | ::new((iterator_to_raw_pointer)(j2), boost_move_new_t()) value_type(::boost::move(*first1)); 124 | d.incr(); 125 | } 126 | } 127 | d.release(); 128 | } 129 | } 130 | 131 | }} //namespace boost { namespace movelib{ 132 | 133 | #if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600)) 134 | #pragma GCC diagnostic pop 135 | #endif 136 | 137 | #endif //#ifndef BOOST_MOVE_DETAIL_INSERT_SORT_HPP 138 | -------------------------------------------------------------------------------- /include/boost/move/algo/detail/is_sorted.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_MOVE_DETAIL_IS_SORTED_HPP 2 | #define BOOST_MOVE_DETAIL_IS_SORTED_HPP 3 | /////////////////////////////////////////////////////////////////////////////// 4 | // 5 | // (C) Copyright Ion Gaztanaga 2017-2018. Distributed under the Boost 6 | // Software License, Version 1.0. (See accompanying file 7 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | // 9 | // See http://www.boost.org/libs/container for documentation. 10 | // 11 | /////////////////////////////////////////////////////////////////////////////// 12 | 13 | #ifndef BOOST_CONFIG_HPP 14 | # include 15 | #endif 16 | 17 | #if defined(BOOST_HAS_PRAGMA_ONCE) 18 | # pragma once 19 | #endif 20 | 21 | namespace boost { 22 | namespace movelib { 23 | 24 | template 25 | bool is_sorted(ForwardIt const first, ForwardIt last, Pred pred) 26 | { 27 | if (first != last) { 28 | ForwardIt next = first, cur(first); 29 | while (++next != last) { 30 | if (pred(*next, *cur)) 31 | return false; 32 | cur = next; 33 | } 34 | } 35 | return true; 36 | } 37 | 38 | template 39 | bool is_sorted_and_unique(ForwardIt first, ForwardIt last, Pred pred) 40 | { 41 | if (first != last) { 42 | ForwardIt next = first; 43 | while (++next != last) { 44 | if (!pred(*first, *next)) 45 | return false; 46 | first = next; 47 | } 48 | } 49 | return true; 50 | } 51 | 52 | } //namespace movelib { 53 | } //namespace boost { 54 | 55 | #endif //BOOST_MOVE_DETAIL_IS_SORTED_HPP 56 | -------------------------------------------------------------------------------- /include/boost/move/algo/detail/search.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2022-2022. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | #ifndef BOOST_MOVE_DETAIL_SEARCH_HPP 12 | #define BOOST_MOVE_DETAIL_SEARCH_HPP 13 | 14 | #include 15 | 16 | #if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600)) 17 | #pragma GCC diagnostic push 18 | #pragma GCC diagnostic ignored "-Wsign-conversion" 19 | #endif 20 | 21 | namespace boost { 22 | namespace movelib { 23 | 24 | template 25 | RandIt lower_bound 26 | (RandIt first, const RandIt last, const T& key, Compare comp) 27 | { 28 | typedef typename iter_size::type size_type; 29 | size_type len = size_type(last - first); 30 | RandIt middle; 31 | 32 | while (len) { 33 | size_type step = size_type(len >> 1); 34 | middle = first; 35 | middle += step; 36 | 37 | if (comp(*middle, key)) { 38 | first = ++middle; 39 | len = size_type(len - (step + 1)); 40 | } 41 | else{ 42 | len = step; 43 | } 44 | } 45 | return first; 46 | } 47 | 48 | template 49 | RandIt upper_bound 50 | (RandIt first, const RandIt last, const T& key, Compare comp) 51 | { 52 | typedef typename iter_size::type size_type; 53 | size_type len = size_type(last - first); 54 | RandIt middle; 55 | 56 | while (len) { 57 | size_type step = size_type(len >> 1); 58 | middle = first; 59 | middle += step; 60 | 61 | if (!comp(key, *middle)) { 62 | first = ++middle; 63 | len = size_type(len - (step + 1)); 64 | } 65 | else{ 66 | len = step; 67 | } 68 | } 69 | return first; 70 | } 71 | 72 | } //namespace movelib { 73 | } //namespace boost { 74 | 75 | #if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600)) 76 | #pragma GCC diagnostic pop 77 | #endif 78 | 79 | #endif //#define BOOST_MOVE_DETAIL_SEARCH_HPP 80 | -------------------------------------------------------------------------------- /include/boost/move/algo/move.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2012-2016. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //! \file 13 | 14 | #ifndef BOOST_MOVE_ALGO_MOVE_HPP 15 | #define BOOST_MOVE_ALGO_MOVE_HPP 16 | 17 | #ifndef BOOST_CONFIG_HPP 18 | # include 19 | #endif 20 | # 21 | #if defined(BOOST_HAS_PRAGMA_ONCE) 22 | # pragma once 23 | #endif 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) 32 | #include 33 | #endif 34 | 35 | namespace boost { 36 | 37 | ////////////////////////////////////////////////////////////////////////////// 38 | // 39 | // move 40 | // 41 | ////////////////////////////////////////////////////////////////////////////// 42 | 43 | #if !defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) 44 | 45 | //! Effects: Moves elements in the range [first,last) into the range [result,result + (last - 46 | //! first)) starting from first and proceeding to last. For each non-negative integer n < (last-first), 47 | //! performs *(result + n) = ::boost::move (*(first + n)). 48 | //! 49 | //! Effects: result + (last - first). 50 | //! 51 | //! Requires: result shall not be in the range [first,last). 52 | //! 53 | //! Complexity: Exactly last - first move assignments. 54 | template // O models OutputIterator 56 | O move(I f, I l, O result) 57 | { 58 | while (f != l) { 59 | *result = ::boost::move(*f); 60 | ++f; ++result; 61 | } 62 | return result; 63 | } 64 | 65 | ////////////////////////////////////////////////////////////////////////////// 66 | // 67 | // move_backward 68 | // 69 | ////////////////////////////////////////////////////////////////////////////// 70 | 71 | //! Effects: Moves elements in the range [first,last) into the range 72 | //! [result - (last-first),result) starting from last - 1 and proceeding to 73 | //! first. For each positive integer n <= (last - first), 74 | //! performs *(result - n) = ::boost::move(*(last - n)). 75 | //! 76 | //! Requires: result shall not be in the range [first,last). 77 | //! 78 | //! Returns: result - (last - first). 79 | //! 80 | //! Complexity: Exactly last - first assignments. 81 | template // O models BidirectionalIterator 83 | O move_backward(I f, I l, O result) 84 | { 85 | while (f != l) { 86 | --l; --result; 87 | *result = ::boost::move(*l); 88 | } 89 | return result; 90 | } 91 | 92 | #else 93 | 94 | using ::std::move_backward; 95 | 96 | #endif //!defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) 97 | 98 | ////////////////////////////////////////////////////////////////////////////// 99 | // 100 | // uninitialized_move 101 | // 102 | ////////////////////////////////////////////////////////////////////////////// 103 | 104 | //! Effects: 105 | //! \code 106 | //! for (; first != last; ++result, ++first) 107 | //! new (static_cast(&*result)) 108 | //! typename iterator_traits::value_type(boost::move(*first)); 109 | //! \endcode 110 | //! 111 | //! Returns: result 112 | template 113 | // F models ForwardIterator 115 | F uninitialized_move(I f, I l, F r 116 | /// @cond 117 | // ,typename ::boost::move_detail::enable_if::value_type> >::type* = 0 118 | /// @endcond 119 | ) 120 | { 121 | typedef typename boost::movelib::iterator_traits::value_type input_value_type; 122 | 123 | F back = r; 124 | BOOST_MOVE_TRY{ 125 | while (f != l) { 126 | void * const addr = static_cast(::boost::move_detail::addressof(*r)); 127 | ::new(addr) input_value_type(::boost::move(*f)); 128 | ++f; ++r; 129 | } 130 | } 131 | BOOST_MOVE_CATCH(...){ 132 | for (; back != r; ++back){ 133 | boost::movelib::iterator_to_raw_pointer(back)->~input_value_type(); 134 | } 135 | BOOST_MOVE_RETHROW; 136 | } 137 | BOOST_MOVE_CATCH_END 138 | return r; 139 | } 140 | 141 | /// @cond 142 | /* 143 | template 144 | // F models ForwardIterator 146 | F uninitialized_move(I f, I l, F r, 147 | typename ::boost::move_detail::disable_if::value_type> >::type* = 0) 148 | { 149 | return std::uninitialized_copy(f, l, r); 150 | } 151 | */ 152 | 153 | /// @endcond 154 | 155 | } //namespace boost { 156 | 157 | #include 158 | 159 | #endif //#ifndef BOOST_MOVE_ALGO_MOVE_HPP 160 | -------------------------------------------------------------------------------- /include/boost/move/algo/predicate.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2015-2016. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | #ifndef BOOST_MOVE_ALGO_PREDICATE_HPP 12 | #define BOOST_MOVE_ALGO_PREDICATE_HPP 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | namespace boost { 22 | namespace movelib { 23 | 24 | template 25 | struct antistable 26 | { 27 | inline explicit antistable(Comp &comp) 28 | : m_comp(comp) 29 | {} 30 | 31 | inline antistable(const antistable & other) 32 | : m_comp(other.m_comp) 33 | {} 34 | 35 | template 36 | inline bool operator()(const U &u, const V & v) 37 | { return !m_comp(v, u); } 38 | 39 | inline const Comp &get() const 40 | { return m_comp; } 41 | 42 | private: 43 | antistable & operator=(const antistable &); 44 | Comp &m_comp; 45 | }; 46 | 47 | template 48 | Comp unantistable(Comp comp) 49 | { return comp; } 50 | 51 | template 52 | Comp unantistable(antistable comp) 53 | { return comp.get(); } 54 | 55 | template 56 | class negate 57 | { 58 | public: 59 | inline negate() 60 | {} 61 | 62 | inline explicit negate(Comp comp) 63 | : m_comp(comp) 64 | {} 65 | 66 | template 67 | inline bool operator()(const T1& l, const T2& r) 68 | { 69 | return !m_comp(l, r); 70 | } 71 | 72 | private: 73 | Comp m_comp; 74 | }; 75 | 76 | 77 | template 78 | class inverse 79 | { 80 | public: 81 | inline inverse() 82 | {} 83 | 84 | inline explicit inverse(Comp comp) 85 | : m_comp(comp) 86 | {} 87 | 88 | template 89 | inline bool operator()(const T1& l, const T2& r) 90 | { 91 | return m_comp(r, l); 92 | } 93 | 94 | private: 95 | Comp m_comp; 96 | }; 97 | 98 | } //namespace movelib { 99 | } //namespace boost { 100 | 101 | #endif //#define BOOST_MOVE_ALGO_PREDICATE_HPP 102 | -------------------------------------------------------------------------------- /include/boost/move/algo/unique.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2017-2017. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | #ifndef BOOST_MOVE_ALGO_UNIQUE_HPP 13 | #define BOOST_MOVE_ALGO_UNIQUE_HPP 14 | 15 | #include 16 | #include 17 | 18 | namespace boost { 19 | namespace movelib { 20 | 21 | //! Requires: The comparison function shall be an equivalence relation. The type of *first shall satisfy 22 | //! the MoveAssignable requirements 23 | //! 24 | //! Effects: For a nonempty range, eliminates all but the first element from every consecutive group 25 | //! of equivalent elements referred to by the iterator i in the range [first + 1, last) for which the 26 | //! following conditions hold: pred(*(i - 1), *i) != false. 27 | //! 28 | //! Returns: The end of the resulting range. 29 | //! 30 | //! Complexity: For nonempty ranges, exactly (last - first) - 1 applications of the corresponding predicate. 31 | template 32 | ForwardIterator unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred) 33 | { 34 | if (first != last) { 35 | ForwardIterator next(first); 36 | ++next; 37 | for (; next != last; ++next, ++first) { 38 | if (pred(*first, *next)) { //Find first equal element 39 | while (++next != last) 40 | if (!pred(*first, *next)) 41 | *++first = ::boost::move(*next); 42 | break; 43 | } 44 | } 45 | ++first; 46 | } 47 | return first; 48 | } 49 | 50 | } //namespace movelib { 51 | } //namespace boost { 52 | 53 | #include 54 | 55 | #endif //#define BOOST_MOVE_ALGO_UNIQUE_HPP 56 | -------------------------------------------------------------------------------- /include/boost/move/algorithm.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2012-2012. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //! \file 13 | 14 | #ifndef BOOST_MOVE_ALGORITHM_HPP 15 | #define BOOST_MOVE_ALGORITHM_HPP 16 | 17 | #ifndef BOOST_CONFIG_HPP 18 | # include 19 | #endif 20 | # 21 | #if defined(BOOST_HAS_PRAGMA_ONCE) 22 | # pragma once 23 | #endif 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include //copy, copy_backward 32 | #include //uninitialized_copy 33 | 34 | namespace boost { 35 | 36 | ////////////////////////////////////////////////////////////////////////////// 37 | // 38 | // uninitialized_copy_or_move 39 | // 40 | ////////////////////////////////////////////////////////////////////////////// 41 | 42 | namespace move_detail { 43 | 44 | template 45 | // F models ForwardIterator 47 | inline F uninitialized_move_move_iterator(I f, I l, F r 48 | // ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled >::type* = 0 49 | ) 50 | { 51 | return ::boost::uninitialized_move(f, l, r); 52 | } 53 | /* 54 | template 55 | // F models ForwardIterator 57 | F uninitialized_move_move_iterator(I f, I l, F r, 58 | typename ::boost::move_detail::disable_if< has_move_emulation_enabled >::type* = 0) 59 | { 60 | return std::uninitialized_copy(f.base(), l.base(), r); 61 | } 62 | */ 63 | } //namespace move_detail { 64 | 65 | template 66 | // F models ForwardIterator 68 | inline F uninitialized_copy_or_move(I f, I l, F r, 69 | typename ::boost::move_detail::enable_if< move_detail::is_move_iterator >::type* = 0) 70 | { 71 | return ::boost::move_detail::uninitialized_move_move_iterator(f, l, r); 72 | } 73 | 74 | ////////////////////////////////////////////////////////////////////////////// 75 | // 76 | // copy_or_move 77 | // 78 | ////////////////////////////////////////////////////////////////////////////// 79 | 80 | namespace move_detail { 81 | 82 | template 83 | // F models ForwardIterator 85 | inline F move_move_iterator(I f, I l, F r 86 | // ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled >::type* = 0 87 | ) 88 | { 89 | return ::boost::move(f, l, r); 90 | } 91 | /* 92 | template 93 | // F models ForwardIterator 95 | F move_move_iterator(I f, I l, F r, 96 | typename ::boost::move_detail::disable_if< has_move_emulation_enabled >::type* = 0) 97 | { 98 | return std::copy(f.base(), l.base(), r); 99 | } 100 | */ 101 | 102 | } //namespace move_detail { 103 | 104 | template 105 | // F models ForwardIterator 107 | inline F copy_or_move(I f, I l, F r, 108 | typename ::boost::move_detail::enable_if< move_detail::is_move_iterator >::type* = 0) 109 | { 110 | return ::boost::move_detail::move_move_iterator(f, l, r); 111 | } 112 | 113 | /// @endcond 114 | 115 | //! Effects: 116 | //! \code 117 | //! for (; first != last; ++result, ++first) 118 | //! new (static_cast(&*result)) 119 | //! typename iterator_traits::value_type(*first); 120 | //! \endcode 121 | //! 122 | //! Returns: result 123 | //! 124 | //! Note: This function is provided because 125 | //! std::uninitialized_copy from some STL implementations 126 | //! is not compatible with move_iterator 127 | template 128 | // F models ForwardIterator 130 | inline F uninitialized_copy_or_move(I f, I l, F r 131 | /// @cond 132 | ,typename ::boost::move_detail::disable_if< move_detail::is_move_iterator >::type* = 0 133 | /// @endcond 134 | ) 135 | { 136 | return std::uninitialized_copy(f, l, r); 137 | } 138 | 139 | //! Effects: 140 | //! \code 141 | //! for (; first != last; ++result, ++first) 142 | //! *result = *first; 143 | //! \endcode 144 | //! 145 | //! Returns: result 146 | //! 147 | //! Note: This function is provided because 148 | //! std::uninitialized_copy from some STL implementations 149 | //! is not compatible with move_iterator 150 | template 151 | // F models ForwardIterator 153 | inline F copy_or_move(I f, I l, F r 154 | /// @cond 155 | ,typename ::boost::move_detail::disable_if< move_detail::is_move_iterator >::type* = 0 156 | /// @endcond 157 | ) 158 | { 159 | return std::copy(f, l, r); 160 | } 161 | 162 | } //namespace boost { 163 | 164 | #include 165 | 166 | #endif //#ifndef BOOST_MOVE_ALGORITHM_HPP 167 | -------------------------------------------------------------------------------- /include/boost/move/detail/addressof.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost 4 | // Software License, Version 1.0. (See accompanying file 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | // 7 | // See http://www.boost.org/libs/container for documentation. 8 | // 9 | ////////////////////////////////////////////////////////////////////////////// 10 | #ifndef BOOST_MOVE_DETAIL_ADDRESSOF_HPP 11 | #define BOOST_MOVE_DETAIL_ADDRESSOF_HPP 12 | 13 | #ifndef BOOST_CONFIG_HPP 14 | # include 15 | #endif 16 | 17 | #if defined(BOOST_HAS_PRAGMA_ONCE) 18 | # pragma once 19 | #endif 20 | 21 | #include 22 | 23 | namespace boost { 24 | namespace move_detail { 25 | 26 | #if defined(BOOST_MSVC_FULL_VER) && BOOST_MSVC_FULL_VER >= 190024215 27 | #define BOOST_MOVE_HAS_BUILTIN_ADDRESSOF 28 | #elif defined(BOOST_GCC) && BOOST_GCC >= 70000 29 | #define BOOST_MOVE_HAS_BUILTIN_ADDRESSOF 30 | #elif defined(__has_builtin) 31 | #if __has_builtin(__builtin_addressof) 32 | #define BOOST_MOVE_HAS_BUILTIN_ADDRESSOF 33 | #endif 34 | #endif 35 | 36 | #ifdef BOOST_MOVE_HAS_BUILTIN_ADDRESSOF 37 | 38 | template 39 | BOOST_MOVE_FORCEINLINE T *addressof( T & v ) BOOST_NOEXCEPT 40 | { 41 | return __builtin_addressof(v); 42 | } 43 | 44 | #else //BOOST_MOVE_HAS_BUILTIN_ADDRESSOF 45 | 46 | template 47 | BOOST_MOVE_FORCEINLINE T* addressof(T& obj) 48 | { 49 | return static_cast( 50 | static_cast( 51 | const_cast( 52 | &reinterpret_cast(obj) 53 | ))); 54 | } 55 | 56 | #endif //BOOST_MOVE_HAS_BUILTIN_ADDRESSOF 57 | 58 | } //namespace move_detail { 59 | } //namespace boost { 60 | 61 | #endif //#ifndef BOOST_MOVE_DETAIL_ADDRESSOF_HPP 62 | -------------------------------------------------------------------------------- /include/boost/move/detail/config_begin.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost 4 | // Software License, Version 1.0. (See accompanying file 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | // 7 | // See http://www.boost.org/libs/move for documentation. 8 | // 9 | ////////////////////////////////////////////////////////////////////////////// 10 | #ifndef BOOST_CONFIG_HPP 11 | #include 12 | #endif 13 | 14 | #ifdef BOOST_MSVC 15 | # pragma warning (push) 16 | # pragma warning (disable : 4619) // there is no warning number 'XXXX' 17 | # pragma warning (disable : 4324) // structure was padded due to __declspec(align()) 18 | # pragma warning (disable : 4675) // "function": resolved overload was found by argument-dependent lookup 19 | # pragma warning (disable : 4714) // "function": marked as __forceinline not inlined 20 | # pragma warning (disable : 4127) // conditional expression is constant 21 | #endif 22 | -------------------------------------------------------------------------------- /include/boost/move/detail/config_end.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost 4 | // Software License, Version 1.0. (See accompanying file 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | // 7 | // See http://www.boost.org/libs/move for documentation. 8 | // 9 | ////////////////////////////////////////////////////////////////////////////// 10 | #if defined BOOST_MSVC 11 | # pragma warning (pop) 12 | #endif 13 | -------------------------------------------------------------------------------- /include/boost/move/detail/destruct_n.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2015-2016. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //! \file 13 | 14 | #ifndef BOOST_MOVE_DETAIL_DESTRUCT_N_HPP 15 | #define BOOST_MOVE_DETAIL_DESTRUCT_N_HPP 16 | 17 | #ifndef BOOST_CONFIG_HPP 18 | # include 19 | #endif 20 | # 21 | #if defined(BOOST_HAS_PRAGMA_ONCE) 22 | # pragma once 23 | #endif 24 | 25 | #include 26 | 27 | namespace boost { 28 | namespace movelib{ 29 | 30 | template 31 | class destruct_n 32 | { 33 | public: 34 | explicit destruct_n(RandItUninit raw) 35 | : m_ptr(raw), m_size() 36 | {} 37 | 38 | void incr() 39 | { 40 | ++m_size; 41 | } 42 | 43 | void incr(std::size_t n) 44 | { 45 | m_size += n; 46 | } 47 | 48 | void release() 49 | { 50 | m_size = 0u; 51 | } 52 | 53 | ~destruct_n() 54 | { 55 | while(m_size--){ 56 | m_ptr[m_size].~T(); 57 | } 58 | } 59 | private: 60 | RandItUninit m_ptr; 61 | std::size_t m_size; 62 | }; 63 | 64 | }} //namespace boost { namespace movelib{ 65 | 66 | #endif //#ifndef BOOST_MOVE_DETAIL_DESTRUCT_N_HPP 67 | -------------------------------------------------------------------------------- /include/boost/move/detail/force_ptr.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost 4 | // Software License, Version 1.0. (See accompanying file 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | // 7 | // See http://www.boost.org/libs/container for documentation. 8 | // 9 | ////////////////////////////////////////////////////////////////////////////// 10 | #ifndef BOOST_MOVE_DETAIL_FORCE_CAST_HPP 11 | #define BOOST_MOVE_DETAIL_FORCE_CAST_HPP 12 | 13 | #ifndef BOOST_CONFIG_HPP 14 | # include 15 | #endif 16 | 17 | #if defined(BOOST_HAS_PRAGMA_ONCE) 18 | # pragma once 19 | #endif 20 | 21 | #include 22 | 23 | namespace boost { 24 | namespace move_detail { 25 | 26 | 27 | template 28 | BOOST_MOVE_FORCEINLINE T force_ptr(const volatile void *p) 29 | { 30 | return static_cast(const_cast(p)); 31 | } 32 | 33 | } //namespace move_detail { 34 | } //namespace boost { 35 | 36 | #endif //#ifndef BOOST_MOVE_DETAIL_FORCE_CAST_HPP 37 | -------------------------------------------------------------------------------- /include/boost/move/detail/iterator_to_raw_pointer.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost 4 | // Software License, Version 1.0. (See accompanying file 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | // 7 | // See http://www.boost.org/libs/container for documentation. 8 | // 9 | ////////////////////////////////////////////////////////////////////////////// 10 | #ifndef BOOST_MOVE_DETAIL_ITERATOR_TO_RAW_POINTER_HPP 11 | #define BOOST_MOVE_DETAIL_ITERATOR_TO_RAW_POINTER_HPP 12 | 13 | #ifndef BOOST_CONFIG_HPP 14 | # include 15 | #endif 16 | 17 | #if defined(BOOST_HAS_PRAGMA_ONCE) 18 | # pragma once 19 | #endif 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace boost { 26 | namespace movelib { 27 | namespace detail { 28 | 29 | template 30 | inline T* iterator_to_pointer(T* i) 31 | { return i; } 32 | 33 | template 34 | inline typename boost::movelib::iterator_traits::pointer 35 | iterator_to_pointer(const Iterator &i) 36 | { return i.operator->(); } 37 | 38 | template 39 | struct iterator_to_element_ptr 40 | { 41 | typedef typename boost::movelib::iterator_traits::pointer pointer; 42 | typedef typename boost::movelib::pointer_element::type element_type; 43 | typedef element_type* type; 44 | }; 45 | 46 | } //namespace detail { 47 | 48 | template 49 | inline typename boost::movelib::detail::iterator_to_element_ptr::type 50 | iterator_to_raw_pointer(const Iterator &i) 51 | { 52 | return ::boost::movelib::to_raw_pointer 53 | ( ::boost::movelib::detail::iterator_to_pointer(i) ); 54 | } 55 | 56 | } //namespace movelib { 57 | } //namespace boost { 58 | 59 | #endif //#ifndef BOOST_MOVE_DETAIL_ITERATOR_TO_RAW_POINTER_HPP 60 | -------------------------------------------------------------------------------- /include/boost/move/detail/iterator_traits.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2014-2014. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //! \file 13 | 14 | #ifndef BOOST_MOVE_DETAIL_ITERATOR_TRAITS_HPP 15 | #define BOOST_MOVE_DETAIL_ITERATOR_TRAITS_HPP 16 | 17 | #ifndef BOOST_CONFIG_HPP 18 | # include 19 | #endif 20 | # 21 | #if defined(BOOST_HAS_PRAGMA_ONCE) 22 | # pragma once 23 | #endif 24 | 25 | #if (BOOST_CXX_VERSION > 201703L) && defined(__cpp_lib_concepts) 26 | 27 | #include 28 | 29 | #define BOOST_MOVE_CONTIGUOUS_ITERATOR_TAG 30 | 31 | namespace boost { 32 | namespace movelib { 33 | 34 | using std::iterator_traits; 35 | 36 | template 37 | struct iter_difference 38 | { 39 | typedef typename std::iterator_traits::difference_type type; 40 | }; 41 | 42 | template 43 | struct iter_value 44 | { 45 | typedef typename std::iterator_traits::value_type type; 46 | }; 47 | 48 | template 49 | struct iter_category 50 | { 51 | typedef typename std::iterator_traits::iterator_category type; 52 | }; 53 | 54 | }} //namespace boost::movelib 55 | 56 | #else 57 | 58 | #include 59 | #include 60 | 61 | #include 62 | 63 | BOOST_MOVE_STD_NS_BEG 64 | 65 | struct input_iterator_tag; 66 | struct forward_iterator_tag; 67 | struct bidirectional_iterator_tag; 68 | struct random_access_iterator_tag; 69 | struct output_iterator_tag; 70 | 71 | #if ( (defined(BOOST_GNU_STDLIB) && (__cplusplus > 201703L))\ 72 | || (defined(_LIBCPP_VERSION) && (_LIBCPP_STD_VER > 17))\ 73 | || (defined(_YVALS) && defined(_CPPLIB_VER) && defined(__cpp_lib_concepts))\ 74 | || (__cplusplus >= 202002L)\ 75 | ) 76 | # define BOOST_MOVE_CONTIGUOUS_ITERATOR_TAG 77 | struct contiguous_iterator_tag; 78 | 79 | #endif 80 | 81 | BOOST_MOVE_STD_NS_END 82 | 83 | #include 84 | 85 | namespace boost{ namespace movelib{ 86 | 87 | template 88 | struct iter_difference 89 | { 90 | typedef typename T::difference_type type; 91 | }; 92 | 93 | template 94 | struct iter_difference 95 | { 96 | typedef std::ptrdiff_t type; 97 | }; 98 | 99 | template 100 | struct iter_value 101 | { 102 | typedef typename T::value_type type; 103 | }; 104 | 105 | template 106 | struct iter_value 107 | { 108 | typedef T type; 109 | }; 110 | 111 | template 112 | struct iter_value 113 | { 114 | typedef T type; 115 | }; 116 | 117 | template 118 | struct iter_category 119 | { 120 | typedef typename T::iterator_category type; 121 | }; 122 | 123 | 124 | template 125 | struct iter_category 126 | { 127 | typedef std::random_access_iterator_tag type; 128 | }; 129 | 130 | template 131 | struct iterator_traits 132 | { 133 | typedef typename iter_difference::type difference_type; 134 | typedef typename iter_value::type value_type; 135 | typedef typename Iterator::pointer pointer; 136 | typedef typename Iterator::reference reference; 137 | typedef typename iter_category::type iterator_category; 138 | }; 139 | 140 | template 141 | struct iterator_traits 142 | { 143 | typedef std::ptrdiff_t difference_type; 144 | typedef T value_type; 145 | typedef T* pointer; 146 | typedef T& reference; 147 | typedef std::random_access_iterator_tag iterator_category; 148 | }; 149 | 150 | template 151 | struct iterator_traits 152 | { 153 | typedef std::ptrdiff_t difference_type; 154 | typedef T value_type; 155 | typedef const T* pointer; 156 | typedef const T& reference; 157 | typedef std::random_access_iterator_tag iterator_category; 158 | }; 159 | 160 | }} //namespace boost::movelib 161 | 162 | #endif // 163 | 164 | #include 165 | 166 | namespace boost { 167 | namespace movelib { 168 | 169 | template 170 | struct iter_size 171 | : boost::move_detail:: 172 | make_unsigned::type > 173 | {}; 174 | 175 | }} //namespace boost move_detail { 176 | 177 | #endif //#ifndef BOOST_MOVE_DETAIL_ITERATOR_TRAITS_HPP 178 | -------------------------------------------------------------------------------- /include/boost/move/detail/launder.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost 4 | // Software License, Version 1.0. (See accompanying file 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | // 7 | // See http://www.boost.org/libs/container for documentation. 8 | // 9 | ////////////////////////////////////////////////////////////////////////////// 10 | #ifndef BOOST_MOVE_DETAIL_LAUNDER_HPP 11 | #define BOOST_MOVE_DETAIL_LAUNDER_HPP 12 | 13 | #ifndef BOOST_CONFIG_HPP 14 | # include 15 | #endif 16 | 17 | #if defined(BOOST_HAS_PRAGMA_ONCE) 18 | # pragma once 19 | #endif 20 | 21 | #include 22 | 23 | namespace boost { 24 | namespace move_detail { 25 | 26 | #if defined(BOOST_MOVE_HAS_BUILTIN_LAUNDER) 27 | 28 | template 29 | BOOST_MOVE_FORCEINLINE T* launder(T* p) 30 | { 31 | return __builtin_launder( p ); 32 | } 33 | 34 | #else 35 | 36 | template 37 | BOOST_MOVE_FORCEINLINE T* launder(T* p) 38 | { 39 | return p; 40 | } 41 | 42 | #endif 43 | 44 | template 45 | BOOST_MOVE_FORCEINLINE T launder_cast(const volatile void* p) 46 | { 47 | return (launder)((T)p); 48 | } 49 | 50 | } //namespace move_detail { 51 | } //namespace boost { 52 | 53 | #endif //#ifndef BOOST_MOVE_DETAIL_LAUNDER_HPP 54 | -------------------------------------------------------------------------------- /include/boost/move/detail/meta_utils_core.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2015-2015. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | // See http://www.boost.org/libs/move for documentation. 9 | // 10 | ////////////////////////////////////////////////////////////////////////////// 11 | 12 | //! \file 13 | 14 | #ifndef BOOST_MOVE_DETAIL_META_UTILS_CORE_HPP 15 | #define BOOST_MOVE_DETAIL_META_UTILS_CORE_HPP 16 | 17 | #ifndef BOOST_CONFIG_HPP 18 | # include 19 | #endif 20 | # 21 | #if defined(BOOST_HAS_PRAGMA_ONCE) 22 | # pragma once 23 | #endif 24 | 25 | //Small meta-typetraits to support move 26 | 27 | namespace boost { 28 | namespace move_detail { 29 | 30 | template 31 | struct voider { typedef void type; }; 32 | 33 | ////////////////////////////////////// 34 | // if_c 35 | ////////////////////////////////////// 36 | template 37 | struct if_c 38 | { 39 | typedef T1 type; 40 | }; 41 | 42 | template 43 | struct if_c 44 | { 45 | typedef T2 type; 46 | }; 47 | 48 | ////////////////////////////////////// 49 | // if_ 50 | ////////////////////////////////////// 51 | template 52 | struct if_ : if_c<0 != T1::value, T2, T3> 53 | {}; 54 | 55 | ////////////////////////////////////// 56 | // enable_if_c 57 | ////////////////////////////////////// 58 | struct enable_if_nat{}; 59 | 60 | template 61 | struct enable_if_c 62 | { 63 | typedef T type; 64 | }; 65 | 66 | template 67 | struct enable_if_c {}; 68 | 69 | ////////////////////////////////////// 70 | // enable_if 71 | ////////////////////////////////////// 72 | template 73 | struct enable_if : enable_if_c {}; 74 | 75 | ////////////////////////////////////// 76 | // disable_if_c 77 | ////////////////////////////////////// 78 | template 79 | struct disable_if_c 80 | : enable_if_c 81 | {}; 82 | 83 | ////////////////////////////////////// 84 | // disable_if 85 | ////////////////////////////////////// 86 | template 87 | struct disable_if : enable_if_c {}; 88 | 89 | ////////////////////////////////////// 90 | // integral_constant 91 | ////////////////////////////////////// 92 | template 93 | struct integral_constant 94 | { 95 | static const T value = v; 96 | typedef T value_type; 97 | typedef integral_constant type; 98 | 99 | operator T() const { return value; } 100 | T operator()() const { return value; } 101 | }; 102 | 103 | typedef integral_constant true_type; 104 | typedef integral_constant false_type; 105 | 106 | 107 | ////////////////////////////////////// 108 | // is_same 109 | ////////////////////////////////////// 110 | template 111 | struct is_same 112 | { 113 | static const bool value = false; 114 | }; 115 | 116 | template 117 | struct is_same 118 | { 119 | static const bool value = true; 120 | }; 121 | 122 | ////////////////////////////////////// 123 | // enable_if_same 124 | ////////////////////////////////////// 125 | template 126 | struct enable_if_same : enable_if, R> {}; 127 | 128 | ////////////////////////////////////// 129 | // disable_if_same 130 | ////////////////////////////////////// 131 | template 132 | struct disable_if_same : disable_if, R> {}; 133 | 134 | ////////////////////////////////////// 135 | // is_lvalue_reference 136 | ////////////////////////////////////// 137 | template 138 | struct is_lvalue_reference 139 | { 140 | static const bool value = false; 141 | }; 142 | 143 | template 144 | struct is_lvalue_reference 145 | { 146 | static const bool value = true; 147 | }; 148 | 149 | } //namespace move_detail { 150 | } //namespace boost { 151 | 152 | #endif //#ifndef BOOST_MOVE_DETAIL_META_UTILS_CORE_HPP 153 | -------------------------------------------------------------------------------- /include/boost/move/detail/placement_new.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_MOVE_DETAIL_PLACEMENT_NEW_HPP 2 | #define BOOST_MOVE_DETAIL_PLACEMENT_NEW_HPP 3 | /////////////////////////////////////////////////////////////////////////////// 4 | // 5 | // (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost 6 | // Software License, Version 1.0. (See accompanying file 7 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | // 9 | // See http://www.boost.org/libs/container for documentation. 10 | // 11 | /////////////////////////////////////////////////////////////////////////////// 12 | 13 | #ifndef BOOST_CONFIG_HPP 14 | # include 15 | #endif 16 | 17 | #if defined(BOOST_HAS_PRAGMA_ONCE) 18 | # pragma once 19 | #endif 20 | 21 | #include 22 | 23 | struct boost_move_new_t{}; 24 | 25 | //avoid including 26 | inline void *operator new(std::size_t, void *p, boost_move_new_t) 27 | { return p; } 28 | 29 | inline void operator delete(void *, void *, boost_move_new_t) 30 | {} 31 | 32 | #endif //BOOST_MOVE_DETAIL_PLACEMENT_NEW_HPP 33 | -------------------------------------------------------------------------------- /include/boost/move/detail/pointer_element.hpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // (C) Copyright Ion Gaztanaga 2014-2017. Distributed under the Boost 4 | // Software License, Version 1.0. (See accompanying file 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | // 7 | // See http://www.boost.org/libs/move for documentation. 8 | // 9 | ////////////////////////////////////////////////////////////////////////////// 10 | 11 | #ifndef BOOST_MOVE_DETAIL_POINTER_ELEMENT_HPP 12 | #define BOOST_MOVE_DETAIL_POINTER_ELEMENT_HPP 13 | 14 | #ifndef BOOST_CONFIG_HPP 15 | # include 16 | #endif 17 | 18 | #if defined(BOOST_HAS_PRAGMA_ONCE) 19 | # pragma once 20 | #endif 21 | 22 | #ifndef BOOST_MOVE_DETAIL_WORKAROUND_HPP 23 | #include 24 | #endif //BOOST_MOVE_DETAIL_WORKAROUND_HPP 25 | 26 | namespace boost { 27 | namespace movelib { 28 | namespace detail{ 29 | 30 | ////////////////////// 31 | //struct first_param 32 | ////////////////////// 33 | 34 | template struct first_param 35 | { typedef void type; }; 36 | 37 | #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) 38 | 39 | template