summaryrefslogtreecommitdiff
path: root/src/third_party
diff options
context:
space:
mode:
authorRyan Egesdahl <ryan.egesdahl@mongodb.com>2020-06-18 10:51:32 -0700
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-26 17:47:49 +0000
commit307c909b4a7bd574b09cd630701a915d2bc982b9 (patch)
tree619ae601552d2ae85588c20642a3107309abe27b /src/third_party
parent22d98e72ac45cd4e145d6b9b42099c5585727ec7 (diff)
downloadmongo-307c909b4a7bd574b09cd630701a915d2bc982b9.tar.gz
SERVER-40147 Upgrade third-party variant from 1.3.0 to 1.4.0
We use a third-party implementation of std::variant on platforms that do not include it. This change simply upgrades the third-party source to the most recent release and then fixes the way we actually depend on it.
Diffstat (limited to 'src/third_party')
-rw-r--r--src/third_party/SConscript13
-rw-r--r--src/third_party/variant-1.3.0/.appveyor.yml68
-rw-r--r--src/third_party/variant-1.3.0/.travis.yml175
-rw-r--r--src/third_party/variant-1.4.0/.appveyor.yml72
-rw-r--r--src/third_party/variant-1.4.0/.clang-format (renamed from src/third_party/variant-1.3.0/.clang-format)0
-rw-r--r--src/third_party/variant-1.4.0/.gitignore (renamed from src/third_party/variant-1.3.0/.gitignore)1
-rw-r--r--src/third_party/variant-1.4.0/.gitmodules (renamed from src/third_party/variant-1.3.0/.gitmodules)2
-rw-r--r--src/third_party/variant-1.4.0/.travis.yml186
-rw-r--r--src/third_party/variant-1.4.0/LICENSE.md (renamed from src/third_party/variant-1.3.0/LICENSE.md)0
-rw-r--r--src/third_party/variant-1.4.0/README.md (renamed from src/third_party/variant-1.3.0/README.md)44
-rw-r--r--src/third_party/variant-1.4.0/cmake/mpark_variant-config.cmake.in (renamed from src/third_party/variant-1.3.0/cmake/mpark_variant-config.cmake.in)0
-rw-r--r--src/third_party/variant-1.4.0/include/mpark/config.hpp (renamed from src/third_party/variant-1.3.0/include/mpark/config.hpp)24
-rw-r--r--src/third_party/variant-1.4.0/include/mpark/in_place.hpp (renamed from src/third_party/variant-1.3.0/include/mpark/in_place.hpp)0
-rw-r--r--src/third_party/variant-1.4.0/include/mpark/lib.hpp (renamed from src/third_party/variant-1.3.0/include/mpark/lib.hpp)169
-rw-r--r--src/third_party/variant-1.4.0/include/mpark/variant.hpp (renamed from src/third_party/variant-1.3.0/include/mpark/variant.hpp)577
-rw-r--r--src/third_party/variant-1.4.0/support/ninja.py46
-rwxr-xr-xsrc/third_party/variant-1.4.0/support/single-header.py (renamed from src/third_party/variant-1.3.0/support/single-header.py)0
-rw-r--r--src/third_party/variant-1.4.0/support/vs.py51
-rw-r--r--src/third_party/variant-1.4.0/support/wandbox.cpp (renamed from src/third_party/variant-1.3.0/support/wandbox.cpp)0
-rwxr-xr-xsrc/third_party/variant-1.4.0/support/wandbox.py (renamed from src/third_party/variant-1.3.0/support/wandbox.py)0
-rw-r--r--src/third_party/variant-1.4.0/test/README.md (renamed from src/third_party/variant-1.3.0/test/README.md)0
-rw-r--r--src/third_party/variant-1.4.0/test/assign.copy.cpp (renamed from src/third_party/variant-1.3.0/test/assign.copy.cpp)0
-rw-r--r--src/third_party/variant-1.4.0/test/assign.fwd.cpp (renamed from src/third_party/variant-1.3.0/test/assign.fwd.cpp)3
-rw-r--r--src/third_party/variant-1.4.0/test/assign.move.cpp (renamed from src/third_party/variant-1.3.0/test/assign.move.cpp)0
-rw-r--r--src/third_party/variant-1.4.0/test/ctor.copy.cpp (renamed from src/third_party/variant-1.3.0/test/ctor.copy.cpp)0
-rw-r--r--src/third_party/variant-1.4.0/test/ctor.default.cpp (renamed from src/third_party/variant-1.3.0/test/ctor.default.cpp)0
-rw-r--r--src/third_party/variant-1.4.0/test/ctor.fwd.cpp (renamed from src/third_party/variant-1.3.0/test/ctor.fwd.cpp)0
-rw-r--r--src/third_party/variant-1.4.0/test/ctor.in_place.cpp (renamed from src/third_party/variant-1.3.0/test/ctor.in_place.cpp)0
-rw-r--r--src/third_party/variant-1.4.0/test/ctor.move.cpp (renamed from src/third_party/variant-1.3.0/test/ctor.move.cpp)2
-rw-r--r--src/third_party/variant-1.4.0/test/dtor.cpp (renamed from src/third_party/variant-1.3.0/test/dtor.cpp)0
-rw-r--r--src/third_party/variant-1.4.0/test/get.cpp (renamed from src/third_party/variant-1.3.0/test/get.cpp)0
-rw-r--r--src/third_party/variant-1.4.0/test/hash.cpp (renamed from src/third_party/variant-1.3.0/test/hash.cpp)0
-rw-r--r--src/third_party/variant-1.4.0/test/intro.cpp (renamed from src/third_party/variant-1.3.0/test/intro.cpp)14
-rw-r--r--src/third_party/variant-1.4.0/test/issue.cpp34
-rw-r--r--src/third_party/variant-1.4.0/test/json.cpp (renamed from src/third_party/variant-1.3.0/test/json.cpp)0
-rwxr-xr-xsrc/third_party/variant-1.4.0/test/libcxx.sh (renamed from src/third_party/variant-1.3.0/test/libcxx.sh)3
-rw-r--r--src/third_party/variant-1.4.0/test/mod.cpp (renamed from src/third_party/variant-1.3.0/test/mod.cpp)0
-rw-r--r--src/third_party/variant-1.4.0/test/relops.cpp (renamed from src/third_party/variant-1.3.0/test/relops.cpp)12
-rw-r--r--src/third_party/variant-1.4.0/test/swap.cpp (renamed from src/third_party/variant-1.3.0/test/swap.cpp)4
-rw-r--r--src/third_party/variant-1.4.0/test/util.hpp (renamed from src/third_party/variant-1.3.0/test/util.hpp)71
-rw-r--r--src/third_party/variant-1.4.0/test/visit.cpp (renamed from src/third_party/variant-1.3.0/test/visit.cpp)42
41 files changed, 1090 insertions, 523 deletions
diff --git a/src/third_party/SConscript b/src/third_party/SConscript
index 7d39e4a40a5..fb8aeb0da52 100644
--- a/src/third_party/SConscript
+++ b/src/third_party/SConscript
@@ -22,6 +22,7 @@ icuSuffix = '-57.1'
gperftoolsSuffix = '-2.7'
timelibSuffix = '-2018.03'
tomcryptSuffix = '-1.18.2'
+variantSuffix = '-1.4.0'
thirdPartyEnvironmentModifications = {
'fmt' : {
@@ -40,6 +41,9 @@ thirdPartyEnvironmentModifications = {
},
'unwind' : {
},
+ 'variant' : {
+ 'CPPPATH' : ['#src/third_party/variant' + variantSuffix + '/include'],
+ },
}
def injectMozJS(thisEnv):
@@ -248,7 +252,14 @@ murmurEnv.SConscript('murmurhash3/SConscript', exports={ 'env' : murmurEnv })
s2Env = env.Clone()
-s2Env.InjectThirdParty(libraries=['s2', 'boost', 'abseil-cpp', 'fmt', 'safeint'])
+s2Env.InjectThirdParty(libraries=[
+ 's2',
+ 'boost',
+ 'abseil-cpp',
+ 'fmt',
+ 'safeint',
+ 'variant',
+])
s2Env.InjectMongoIncludePaths()
s2Env.SConscript('s2/SConscript', exports={'env' : s2Env})
diff --git a/src/third_party/variant-1.3.0/.appveyor.yml b/src/third_party/variant-1.3.0/.appveyor.yml
deleted file mode 100644
index c0c41e06876..00000000000
--- a/src/third_party/variant-1.3.0/.appveyor.yml
+++ /dev/null
@@ -1,68 +0,0 @@
-build:
- verbosity: detailed
-
-clone_depth: 1
-
-install:
- - cmd: git submodule -q update --init
-
-environment:
- matrix:
- - GENERATOR: Visual Studio 14 2015 Win64
- EXCEPTIONS: ON
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- - GENERATOR: Visual Studio 14 2015 Win64
- EXCEPTIONS: OFF
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
-
- # /std:c++14
- - GENERATOR: Visual Studio 15 2017 Win64
- CXXFLAGS: /std:c++14 /permissive-
- EXCEPTIONS: ON
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- - GENERATOR: Visual Studio 15 2017 Win64
- CXXFLAGS: /std:c++14 /permissive-
- EXCEPTIONS: OFF
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
-
- # /std:c++latest
- - GENERATOR: Visual Studio 15 2017 Win64
- CXXFLAGS: /std:c++latest /permissive-
- EXCEPTIONS: ON
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- - GENERATOR: Visual Studio 15 2017 Win64
- CXXFLAGS: /std:c++latest /permissive-
- EXCEPTIONS: OFF
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
-
- # Clang/LLVM
- - GENERATOR: Visual Studio 14 2015 Win64
- TOOLSET: LLVM-vs2014
- EXCEPTIONS: ON
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- - GENERATOR: Visual Studio 14 2015 Win64
- TOOLSET: LLVM-vs2014
- EXCEPTIONS: OFF
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
-
-platform: x64
-
-configuration:
- - Debug
- - Release
-
-branches:
- only:
- - master
-
-build_script:
- - mkdir build
- - cd build
- - ps: |
- if (Test-Path env:TOOLSET) {
- cmake -G "$env:GENERATOR" -T "$env:TOOLSET" -DMPARK_VARIANT_EXCEPTIONS="$env:EXCEPTIONS" -DMPARK_VARIANT_INCLUDE_TESTS="mpark" ..
- } else {
- cmake -G "$env:GENERATOR" -DMPARK_VARIANT_EXCEPTIONS="$env:EXCEPTIONS" -DMPARK_VARIANT_INCLUDE_TESTS="mpark" ..
- }
- - cmake --build . --config %CONFIGURATION%
- - ctest -V
diff --git a/src/third_party/variant-1.3.0/.travis.yml b/src/third_party/variant-1.3.0/.travis.yml
deleted file mode 100644
index ce5e9df13d6..00000000000
--- a/src/third_party/variant-1.3.0/.travis.yml
+++ /dev/null
@@ -1,175 +0,0 @@
-# MPark.Variant
-#
-# Copyright Michael Park, 2015-2017
-#
-# Distributed under the Boost Software License, Version 1.0.
-# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
-
-language: cpp
-sudo: false
-
-branches:
- only:
- - master
-
-git:
- depth: 1
-
-matrix:
- include:
- # ubuntu 14.04, gcc-4.8
- - env: VER=4.8 STDS="11;1y" TESTS="mpark"
- compiler: gcc
- os: linux
- addons: { apt: { packages: ["g++-4.8"], sources: ["ubuntu-toolchain-r-test"] } }
-
- # ubuntu 14.04, gcc-4.9
- - env: VER=4.9 STDS="11;14" TESTS="mpark"
- compiler: gcc
- os: linux
- addons: { apt: { packages: ["g++-4.9"], sources: ["ubuntu-toolchain-r-test"] } }
-
- # ubuntu 14.04, gcc-5
- - env: VER=5 STDS="11;14;1z" TESTS="mpark"
- compiler: gcc
- os: linux
- addons: { apt: { packages: ["g++-5"], sources: ["ubuntu-toolchain-r-test"] } }
-
- # ubuntu 14.04, gcc-6
- - env: VER=6 STDS="11;14;1z" TESTS="mpark"
- compiler: gcc
- os: linux
- addons: { apt: { packages: ["g++-6"], sources: ["ubuntu-toolchain-r-test"] } }
-
- # ubuntu 14.04, gcc-7
- - env: VER=7 STDS="11;14;17" TESTS="mpark;libc++"
- compiler: gcc
- os: linux
- addons: { apt: { packages: ["g++-7"], sources: ["ubuntu-toolchain-r-test"] } }
-
- # ubuntu 14.04, clang-3.5
- - env: VER=3.5 STDS="11;14" TESTS="mpark"
- compiler: clang
- os: linux
- addons: { apt: { packages: ["clang-3.5", "libstdc++-5-dev"], sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.5"] } }
-
- # ubuntu 14.04, clang-3.6
- - env: VER=3.6 STDS="11;14" TESTS="mpark"
- compiler: clang
- os: linux
- addons: { apt: { packages: ["clang-3.6", "libstdc++-5-dev"], sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.6"] } }
-
- # ubuntu 14.04, clang-3.7
- - env: VER=3.7 STDS="11;14" TESTS="mpark"
- compiler: clang
- os: linux
- addons: { apt: { packages: ["clang-3.7", "libstdc++-5-dev"], sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.7"] } }
-
- # ubuntu 14.04, clang-3.8
- - env: VER=3.8 STDS="11;14" TESTS="mpark"
- compiler: clang
- os: linux
- addons: { apt: { packages: ["clang-3.8", "libstdc++-5-dev"], sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.8"] } }
-
- # ubuntu 14.04, clang-3.9
- - env: VER=3.9 STDS="11;14;1z" TESTS="mpark"
- compiler: clang
- os: linux
- addons: { apt: { packages: ["clang-3.9", "libstdc++-6-dev"], sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-trusty-3.9"] } }
-
- # ubuntu 14.04, clang-4.0
- - env: VER=4.0 STDS="11;14;1z" TESTS="mpark"
- compiler: clang
- os: linux
- addons: { apt: { packages: ["clang-4.0", "libstdc++-6-dev"], sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-trusty-4.0"] } }
-
- # ubuntu 14.04, clang-5.0
- - env: VER=5.0 STDS="11;14;17" TESTS="mpark;libc++"
- compiler: clang
- os: linux
- addons: { apt: { packages: ["clang-5.0", "libstdc++-7-dev"], sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-trusty-5.0"] } }
-
- # OS X Yosemite 10.10, Apple Clang 6
- - env: STDS="11;14" TESTS="mpark"
- compiler: clang
- os: osx
- osx_image: xcode6.4
-
- # OS X El Capitan 10.11, Apple Clang 7
- - env: STDS="11;14;1z" TESTS="mpark"
- compiler: clang
- os: osx
- osx_image: xcode7.3
-
- # OS X Sierra 10.12, Apple Clang 8
- - env: STDS="11;14;1z" TESTS="mpark"
- compiler: clang
- os: osx
- osx_image: xcode8.3
-
-before_install:
- # Set the correct `CC` and `CXX` environment variables.
- - |
- if [ -n "${VER}" ]; then
- export CC="${CC}-${VER}"
- export CXX="${CXX}-${VER}"
- fi
- - ${CXX} --version
- # Directory for dependency installation.
- - DEPS="${TRAVIS_BUILD_DIR}/deps"
- - mkdir -p ${DEPS}
- # Install newer cmake.
- - |
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
- brew update
- brew upgrade cmake
- elif [ "${TRAVIS_OS_NAME}" = "linux" ]; then
- travis_retry wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.sh
- bash cmake-3.8.2-Linux-x86_64.sh --skip-license --prefix="${DEPS}"
- export PATH="${DEPS}/bin:${PATH}"
- fi
- - export CXXFLAGS="-Wall -Wextra -Werror -pedantic-errors"
- - STDS=(${STDS//;/ })
- - BUILDS=(Debug Release)
- - EXS=(ON OFF)
-
-install:
- - |
- for STD in "${STDS[@]}"; do
- for BUILD in "${BUILDS[@]}"; do
- for EX in "${EXS[@]}"; do
- BUILD_DIR="build-${STD}-${BUILD}-${EX}"
- mkdir "${BUILD_DIR}"
- pushd "${BUILD_DIR}"
- (
- set -ex
- export CXXFLAGS="${CXXFLAGS} -std=c++${STD}"
- cmake -DCMAKE_BUILD_TYPE="${BUILD}" \
- -DMPARK_VARIANT_EXCEPTIONS="${EX}" \
- -DMPARK_VARIANT_INCLUDE_TESTS="${TESTS}" ..
- )
- popd
- done
- done
- done
-
-script:
- - |
- for STD in "${STDS[@]}"; do
- for BUILD in "${BUILDS[@]}"; do
- for EX in "${EXS[@]}"; do
- BUILD_DIR="build-${STD}-${BUILD}-${EX}"
- mkdir "${BUILD_DIR}"
- pushd "${BUILD_DIR}"
- (
- set -ex
- cmake --build . -- -k -j 2
- ctest --output-on-failure
- )
- popd
- done
- done
- done
-
-notifications:
- email: false
diff --git a/src/third_party/variant-1.4.0/.appveyor.yml b/src/third_party/variant-1.4.0/.appveyor.yml
new file mode 100644
index 00000000000..672663124da
--- /dev/null
+++ b/src/third_party/variant-1.4.0/.appveyor.yml
@@ -0,0 +1,72 @@
+# MPark.Variant
+#
+# Copyright Michael Park, 2015-2017
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+build:
+ verbosity: detailed
+
+branches:
+ only:
+ - master
+ - dev
+
+clone_depth: 1
+
+platform: x64
+
+environment:
+ matrix:
+ # Visual Studio 2015
+ - GENERATOR: Visual Studio 14 2015 Win64
+ TESTS: mpark
+ SCRIPT: support/vs.py
+ APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+
+ # Previous Visual Studio 2017
+ - GENERATOR: Visual Studio 15 2017 Win64
+ STDFLAGS: /std:c++14 /std:c++17 /std:c++latest
+ TESTS: mpark
+ SCRIPT: support/vs.py
+ APPVEYOR_BUILD_WORKER_IMAGE: Previous Visual Studio 2017
+
+ # Visual Studio 2017
+ - GENERATOR: Visual Studio 15 2017 Win64
+ STDFLAGS: /std:c++14 /std:c++17 /std:c++latest
+ TESTS: mpark
+ SCRIPT: support/vs.py
+ APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+
+ # Clang/LLVM
+ - CC: clang-cl
+ CXX: clang-cl
+ STDFLAGS: /std:c++14 /std:c++17 /std:c++latest
+ TESTS: mpark
+ SCRIPT: support/ninja.py
+ APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+
+install:
+ - git submodule -q update --init
+ # Directory for dependency installation.
+ - set DEPS=%APPVEYOR_BUILD_FOLDER%\deps
+ - mkdir %DEPS%
+ # Install Ninja
+ - set NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip"
+ - curl -fsSL %NINJA_URL% -o ninja.zip
+ - 7z x ninja.zip -o%DEPS%\ninja > nul
+ - set PATH=%DEPS%\ninja;%PATH%
+ - ninja --version
+
+before_build:
+ # Enable the Visual C++ toolset for command-line builds.
+ - IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" (
+ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
+ )
+ - IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" (
+ call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
+ )
+
+build_script:
+ - python %SCRIPT%
diff --git a/src/third_party/variant-1.3.0/.clang-format b/src/third_party/variant-1.4.0/.clang-format
index 4d8207f7984..4d8207f7984 100644
--- a/src/third_party/variant-1.3.0/.clang-format
+++ b/src/third_party/variant-1.4.0/.clang-format
diff --git a/src/third_party/variant-1.3.0/.gitignore b/src/third_party/variant-1.4.0/.gitignore
index f294e45c5dc..87b951d38d7 100644
--- a/src/third_party/variant-1.3.0/.gitignore
+++ b/src/third_party/variant-1.4.0/.gitignore
@@ -30,4 +30,5 @@
# build
/build
+3rdparty/benchmark
3rdparty/metabench
diff --git a/src/third_party/variant-1.3.0/.gitmodules b/src/third_party/variant-1.4.0/.gitmodules
index 85675ac0bc0..77393136592 100644
--- a/src/third_party/variant-1.3.0/.gitmodules
+++ b/src/third_party/variant-1.4.0/.gitmodules
@@ -1,3 +1,3 @@
[submodule "3rdparty/googletest"]
path = 3rdparty/googletest
- url = https://github.com/google/googletest.git
+ url = https://github.com/abseil/googletest.git
diff --git a/src/third_party/variant-1.4.0/.travis.yml b/src/third_party/variant-1.4.0/.travis.yml
new file mode 100644
index 00000000000..2343e74f0a6
--- /dev/null
+++ b/src/third_party/variant-1.4.0/.travis.yml
@@ -0,0 +1,186 @@
+# MPark.Variant
+#
+# Copyright Michael Park, 2015-2017
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+language: cpp
+dist: xenial
+sudo: false
+
+branches:
+ only:
+ - master
+ - dev
+
+git:
+ depth: 1
+
+env:
+ global:
+ - secure: jL8hAVoa2B512uGeoh5DL2YXrAznfKPz3GbcaUPzR6mR2Izj2yHFihLLeHrEY8vUdadS8zbn2CwtWnmJjNz5kIT/RxESxJJtgVNruwo0u4piIfxVI/tTRObMXKaGrfquDAHS/hjAhQlPSNNr+89oFSBvSfNpAVECd/ERhhnjIugD+MFFzaxi26qvM6li9toxPNJIxBq9jHRuZzlpWez6d6RcTsaqr30BaCEuJhVcg7J4SiSL8xeW2sokAG65pZ/aig23cCSJkhazbMd7Cy/OFNjQrhc2PQ+E0c2xEwdwCNA8qTnsMrUeo9NXc+lozOf23LWD1EvZtcNNG5arPhSuGGYs90T1GdL2jqyS1E+1Xf0cOWqB4VMho7H+vV55SgZb+TYDrmB63YvgxcUKgsDRvPI9bBv3S3uxgktbE6gwnrfQirKowbscC07X3R1RJiI6hSkVNdrLnQF28BHMRlCpyhDejIWm4qHgOrWCN+I6hZtk+nsRuJF8sCSFPUWuzlG+/kSwaBwm/eEy+ZI66ufJamHUqC8bxa+6kINxtJTMN79ZnbIPwOvey9cfVfzwxefaStwpQbCJuZlMbuo4738HxUQpscxgv6LA5ZEMz8hlKO82cWDZSEDxSrUowueu1Az0u5tfzBUXaU5pZCnGdK6aMGHcTznaeUFebq8uhLR3uc0=
+
+jobs:
+ include:
+ # ubuntu 16.04, gcc-4.8
+ - env: VER=4.8 STDFLAGS="-std=c++11 -std=c++1y" TESTS="mpark"
+ compiler: gcc
+ os: linux
+ addons: { apt: { packages: ["g++-4.8", "ninja-build"],
+ sources: ["ubuntu-toolchain-r-test"] } }
+
+ # ubuntu 16.04, gcc-4.9
+ - env: VER=4.9 STDFLAGS="-std=c++11 -std=c++14" TESTS="mpark"
+ compiler: gcc
+ os: linux
+ addons: { apt: { packages: ["g++-4.9", "ninja-build"],
+ sources: ["ubuntu-toolchain-r-test"] } }
+
+ # ubuntu 16.04, gcc-5
+ - env: VER=5 STDFLAGS="-std=c++11 -std=c++14 -std=c++1z" TESTS="mpark"
+ compiler: gcc
+ os: linux
+ addons: { apt: { packages: ["g++-5", "ninja-build"],
+ sources: ["ubuntu-toolchain-r-test"] } }
+
+ # ubuntu 16.04, gcc-6
+ - env: VER=6 STDFLAGS="-std=c++11 -std=c++14 -std=c++1z" TESTS="mpark"
+ compiler: gcc
+ os: linux
+ addons: { apt: { packages: ["g++-6", "ninja-build"],
+ sources: ["ubuntu-toolchain-r-test"] } }
+
+ # ubuntu 16.04, gcc-7
+ - env: VER=7 STDFLAGS="-std=c++11 -std=c++14 -std=c++17" TESTS="mpark libc++"
+ compiler: gcc
+ os: linux
+ addons: { apt: { packages: ["g++-7", "ninja-build"],
+ sources: ["ubuntu-toolchain-r-test"] } }
+
+ # ubuntu 16.04, gcc-8
+ - env: VER=8 STDFLAGS="-std=c++11 -std=c++14 -std=c++17" TESTS="mpark libc++"
+ compiler: gcc
+ os: linux
+ addons: { apt: { packages: ["g++-8", "ninja-build"],
+ sources: ["ubuntu-toolchain-r-test"] } }
+
+ # ubuntu 16.04, clang-3.6
+ - env: VER=3.6 STDFLAGS="-std=c++11 -std=c++14" TESTS="mpark"
+ compiler: clang
+ os: linux
+ addons: { apt: { packages: ["clang-3.6", "ninja-build"] } }
+
+ # ubuntu 16.04, clang-3.7
+ - env: VER=3.7 STDFLAGS="-std=c++11 -std=c++14" TESTS="mpark"
+ compiler: clang
+ os: linux
+ addons: { apt: { packages: ["clang-3.7", "ninja-build"] } }
+
+ # ubuntu 16.04, clang-3.8
+ - env: VER=3.8 STDFLAGS="-std=c++11 -std=c++14" TESTS="mpark"
+ compiler: clang
+ os: linux
+ addons: { apt: { packages: ["clang-3.8", "ninja-build"] } }
+
+ # ubuntu 16.04, clang-3.9
+ - env: VER=3.9 STDFLAGS="-std=c++11 -std=c++14 -std=c++1z" TESTS="mpark"
+ compiler: clang
+ os: linux
+ addons: { apt: { packages: ["clang-3.9", "ninja-build"] } }
+
+ # ubuntu 16.04, clang-4.0
+ - env: VER=4.0 STDFLAGS="-std=c++11 -std=c++14 -std=c++1z" TESTS="mpark"
+ compiler: clang
+ os: linux
+ addons: { apt: { packages: ["clang-4.0", "ninja-build"] } }
+
+ # ubuntu 16.04, clang-5.0
+ - env: VER=5.0 STDFLAGS="-std=c++11 -std=c++14 -std=c++17" TESTS="mpark libc++"
+ compiler: clang
+ os: linux
+ addons: { apt: { packages: ["clang-5.0", "ninja-build"] } }
+
+ # ubuntu 16.04, clang-6.0
+ - env: VER=6.0 STDFLAGS="-std=c++11 -std=c++14 -std=c++17" TESTS="mpark libc++"
+ compiler: clang
+ os: linux
+ addons: { apt: { packages: ["clang-6.0", "ninja-build"] } }
+
+ # ubuntu 16.04, clang-7
+ - env: VER=7 STDFLAGS="-std=c++11 -std=c++14 -std=c++17" TESTS="mpark libc++"
+ compiler: clang
+ os: linux
+ addons: { apt: { packages: ["clang-7", "ninja-build"],
+ sources: ["llvm-toolchain-xenial-7"] } }
+
+ # OS X El Capitan 10.11
+ - env: STDFLAGS="-std=c++11 -std=c++14 -std=c++1z" TESTS="mpark"
+ compiler: clang
+ os: osx
+ osx_image: xcode7.3
+
+ # OS X Sierra 10.12
+ - env: STDFLAGS="-std=c++11 -std=c++14 -std=c++1z" TESTS="mpark"
+ compiler: clang
+ os: osx
+ osx_image: xcode8.3
+
+ # OS X High Sierra 10.13
+ - env: STDFLAGS="-std=c++11 -std=c++14 -std=c++17" TESTS="mpark"
+ compiler: clang
+ os: osx
+ osx_image: xcode9.4
+
+ # OS X High Sierra 10.13
+ - env: STDFLAGS="-std=c++11 -std=c++14 -std=c++17" TESTS="mpark"
+ compiler: clang
+ os: osx
+ osx_image: xcode10.1
+
+ - stage: deploy
+ name: "Single Header"
+ if: branch = master AND type = push
+ install: skip
+ before_script:
+ - git config --global user.name "Travis CI"
+ - git config --global user.email "<>"
+ - travis_retry git clone https://$GITHUB_TOKEN@github.com/mpark/variant
+ --depth 1 --branch=single-header single-header &>/dev/null
+ script:
+ - SHA=$(git rev-parse --short HEAD)
+ - python support/single-header.py > single-header/master/variant.hpp
+ - pushd single-header
+ - |
+ if git diff-index --quiet HEAD --; then
+ echo "Nothing to do. No changes were made to 'variant.hpp'."
+ else
+ git add --all
+ git commit -m "Updated 'variant.hpp' @${SHA}."
+ travis_retry git pull --rebase && git push origin single-header &>/dev/null
+ fi
+ - popd
+
+install:
+ # Upgrade CMake and install Ninja on OS X.
+ - |
+ if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
+ brew update
+ brew upgrade cmake
+ brew install ninja
+ fi
+ - cmake --version
+ - ninja --version
+ # Set the correct `CC` and `CXX` environment variables.
+ - |
+ if [ -n "${VER}" ]; then
+ export CC="${CC}-${VER}"
+ export CXX="${CXX}-${VER}"
+ fi
+ - ${CXX} --version
+
+script:
+ - python support/ninja.py
+
+notifications:
+ email: false
diff --git a/src/third_party/variant-1.3.0/LICENSE.md b/src/third_party/variant-1.4.0/LICENSE.md
index 36b7cd93cdf..36b7cd93cdf 100644
--- a/src/third_party/variant-1.3.0/LICENSE.md
+++ b/src/third_party/variant-1.4.0/LICENSE.md
diff --git a/src/third_party/variant-1.3.0/README.md b/src/third_party/variant-1.4.0/README.md
index c58bc855112..2e2643786d1 100644
--- a/src/third_party/variant-1.3.0/README.md
+++ b/src/third_party/variant-1.4.0/README.md
@@ -113,26 +113,30 @@ the location (e.g., `cmake .. -DCMAKE_PREFIX_PATH=/opt`).
This library requires a standard conformant __C++11__ compiler.
The following compilers are continously tested:
-| Compiler | Operating System | Version String |
-| -------------------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------ |
-| GCC 4.8.5 | Ubuntu 14.04.5 LTS | g++-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 |
-| GCC 4.9.4 | Ubuntu 14.04.5 LTS | g++-4.9 (Ubuntu 4.9.4-2ubuntu1~14.04.1) 4.9.4 |
-| GCC 5.4.1 | Ubuntu 14.04.5 LTS | g++-5 (Ubuntu 5.4.1-2ubuntu1~14.04) 5.4.1 20160904 |
-| GCC 6.3.0 | Ubuntu 14.04.5 LTS | g++-6 (Ubuntu/Linaro 6.3.0-18ubuntu2~14.04) 6.3.0 20170519 |
-| GCC 7.2.0 | Ubuntu 14.04.5 LTS | g++-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 |
-| Clang 3.5.0 | Ubuntu 14.04.5 LTS | Ubuntu clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) (based on LLVM 3.5.0) |
-| Clang 3.6.2 | Ubuntu 14.04.5 LTS | Ubuntu clang version 3.6.2-svn240577-1~exp1 (branches/release_36) (based on LLVM 3.6.2) |
-| Clang 3.7.1 | Ubuntu 14.04.5 LTS | Ubuntu clang version 3.7.1-svn253571-1~exp1 (branches/release_37) (based on LLVM 3.7.1) |
-| Clang 3.8.0 | Ubuntu 14.04.5 LTS | clang version 3.8.0-2ubuntu3~trusty5 (tags/RELEASE_380/final) |
-| Clang 3.9.1 | Ubuntu 14.04.5 LTS | clang version 3.9.1-4ubuntu3~14.04.2 (tags/RELEASE_391/rc2) |
-| Clang 4.0.1 | Ubuntu 14.04.5 LTS | clang version 4.0.1-svn305264-1~exp1 (branches/release_40) |
-| Clang 5.0.0 | Ubuntu 14.04.5 LTS | clang version 5.0.0-svn312333-1~exp1 (branches/release_50) |
-| Clang Xcode 6.4 | Darwin Kernel Version 14.5.0 (OS X 10.10.3) | Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) |
-| Clang Xcode 7.3 | Darwin Kernel Version 15.6.0 (OS X 10.10.5) | Apple LLVM version 7.3.0 (clang-703.0.31) |
-| Clang Xcode 8.3 | Darwin Kernel Version 16.6.0 (OS X 10.12.5) | Apple LLVM version 8.1.0 (clang-802.0.42) |
-| Visual Studio 14 2015 | Visual Studio 2015 with Update 3 | MSVC 19.0.24215.1 | Microsoft (R) Build Engine version 14.0.25420.1 |
-| Visual Studio 15 2017 | Visual Studio 2017 | MSVC 19.11.25547.0 | Microsoft (R) Build Engine version 15.4.8.50001 |
-| Visual Studio 14 2015 (__Clang/LLVM__) | Visual Studio 2015 with Update 3 | Clang 4.0.0 | Microsoft (R) Build Engine version 14.0.25420.1 |
+| Compiler | Operating System | Version String |
+| -------------------------------------- | ------------------------------------------- | ---------------------------------------------------------------------------------- |
+| GCC 4.8.5 | Ubuntu 16.04.5 LTS | g++-4.8 (Ubuntu 4.8.5-4ubuntu8~16.04.1) 4.8.5 |
+| GCC 4.9.4 | Ubuntu 16.04.5 LTS | g++-4.9 (Ubuntu 4.9.4-2ubuntu1~16.04) 4.9.4 |
+| GCC 5.5.0 | Ubuntu 16.04.5 LTS | g++-5 (Ubuntu 5.5.0-12ubuntu1~16.04) 5.5.0 20171010 |
+| GCC 6.5.0 | Ubuntu 16.04.5 LTS | g++-6 (Ubuntu 6.5.0-2ubuntu1~16.04) 6.5.0 20181026 |
+| GCC 7.4.0 | Ubuntu 16.04.5 LTS | g++-7 (Ubuntu 7.4.0-1ubuntu1\~16.04\~ppa1) 7.4.0 |
+| GCC 8.1.0 | Ubuntu 16.04.5 LTS | g++-8 (Ubuntu 8.1.0-5ubuntu1~16.04) 8.1.0 |
+| Clang 3.6.2 | Ubuntu 16.04.5 LTS | Ubuntu clang version 3.6.2-3ubuntu2 (tags/RELEASE_362/final) (based on LLVM 3.6.2) |
+| Clang 3.7.1 | Ubuntu 16.04.5 LTS | Ubuntu clang version 3.7.1-2ubuntu2 (tags/RELEASE_371/final) (based on LLVM 3.7.1) |
+| Clang 3.8.0 | Ubuntu 16.04.5 LTS | clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) |
+| Clang 3.9.1 | Ubuntu 16.04.5 LTS | clang version 3.9.1-4ubuntu3~16.04.2 (tags/RELEASE_391/rc2) |
+| Clang 4.0.0 | Ubuntu 16.04.5 LTS | clang version 4.0.0-1ubuntu1~16.04.2 (tags/RELEASE_400/rc1) |
+| Clang 5.0.0 | Ubuntu 16.04.5 LTS | clang version 5.0.0-3~16.04.1 (tags/RELEASE_500/final) |
+| Clang 6.0.0 | Ubuntu 16.04.5 LTS | clang version 6.0.0-1ubuntu2~16.04.1 (tags/RELEASE_600/final) |
+| Clang 7.0.1 | Ubuntu 16.04.5 LTS | clang version 7.0.1-svn347285-1\~exp1\~20181124105320.40 (branches/release_70) |
+| Clang Xcode 7.3 | Darwin Kernel Version 15.6.0 (OS X 10.11.6) | Apple LLVM version 7.3.0 (clang-703.0.31) |
+| Clang Xcode 8.3 | Darwin Kernel Version 16.6.0 (OS X 10.12.5) | Apple LLVM version 8.1.0 (clang-802.0.42) |
+| Clang Xcode 9.4 | Darwin Kernel Version 17.4.0 (OS X 10.13.3) | Apple LLVM version 9.1.0 (clang-902.0.39.2) |
+| Clang Xcode 10.1 | Darwin Kernel Version 17.7.0 (OS X 10.13.6) | Apple LLVM version 10.0.0 (clang-1000.11.45.5) |
+| Visual Studio 14 2015 | Visual Studio 2015 with Update 3 | MSVC 19.0.24241.7 |
+| Visual Studio 15 2017 | Visual Studio 2017 with Update 8 | MSVC 19.15.26732.1 |
+| Visual Studio 15 2017 | Visual Studio 2017 with Update 9 | MSVC 19.16.27025.1 |
+| Visual Studio 15 2017 (__Clang/LLVM__) | Visual Studio 2017 | Clang 7.0.0 |
#### NOTES
- __GCC 4.8__/__4.9__: `constexpr` support is not available for `visit` and relational operators.
diff --git a/src/third_party/variant-1.3.0/cmake/mpark_variant-config.cmake.in b/src/third_party/variant-1.4.0/cmake/mpark_variant-config.cmake.in
index 7f5b1c66f98..7f5b1c66f98 100644
--- a/src/third_party/variant-1.3.0/cmake/mpark_variant-config.cmake.in
+++ b/src/third_party/variant-1.4.0/cmake/mpark_variant-config.cmake.in
diff --git a/src/third_party/variant-1.3.0/include/mpark/config.hpp b/src/third_party/variant-1.4.0/include/mpark/config.hpp
index 0d6f4adc3b4..e411d687a00 100644
--- a/src/third_party/variant-1.3.0/include/mpark/config.hpp
+++ b/src/third_party/variant-1.4.0/include/mpark/config.hpp
@@ -13,6 +13,10 @@
#error "MPark.Variant requires C++11 support."
#endif
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
@@ -25,12 +29,24 @@
#define __has_feature(x) 0
#endif
+#if __has_attribute(always_inline) || defined(__GNUC__)
+#define MPARK_ALWAYS_INLINE __attribute__((__always_inline__)) inline
+#elif defined(_MSC_VER)
+#define MPARK_ALWAYS_INLINE __forceinline
+#else
+#define MPARK_ALWAYS_INLINE inline
+#endif
+
#if __has_builtin(__builtin_addressof) || \
(defined(__GNUC__) && __GNUC__ >= 7) || defined(_MSC_VER)
#define MPARK_BUILTIN_ADDRESSOF
#endif
-#if __has_builtin(__builtin_unreachable)
+#if __has_builtin(__builtin_unreachable) || defined(__GNUC__)
+#define MPARK_BUILTIN_UNREACHABLE __builtin_unreachable()
+#elif defined(_MSC_VER)
+#define MPARK_BUILTIN_UNREACHABLE __assume(false)
+#else
#define MPARK_BUILTIN_UNREACHABLE
#endif
@@ -38,6 +54,11 @@
#define MPARK_TYPE_PACK_ELEMENT
#endif
+#if defined(__cpp_constexpr) && __cpp_constexpr >= 200704 && \
+ !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 9)
+#define MPARK_CPP11_CONSTEXPR
+#endif
+
#if defined(__cpp_constexpr) && __cpp_constexpr >= 201304
#define MPARK_CPP14_CONSTEXPR
#endif
@@ -69,6 +90,7 @@
#if !defined(__GLIBCXX__) || __has_include(<codecvt>) // >= libstdc++-5
#define MPARK_TRIVIALITY_TYPE_TRAITS
+#define MPARK_INCOMPLETE_TYPE_TRAITS
#endif
#endif // MPARK_CONFIG_HPP
diff --git a/src/third_party/variant-1.3.0/include/mpark/in_place.hpp b/src/third_party/variant-1.4.0/include/mpark/in_place.hpp
index 56cae131131..56cae131131 100644
--- a/src/third_party/variant-1.3.0/include/mpark/in_place.hpp
+++ b/src/third_party/variant-1.4.0/include/mpark/in_place.hpp
diff --git a/src/third_party/variant-1.3.0/include/mpark/lib.hpp b/src/third_party/variant-1.4.0/include/mpark/lib.hpp
index c3efdd99617..6cb8192bef8 100644
--- a/src/third_party/variant-1.3.0/include/mpark/lib.hpp
+++ b/src/third_party/variant-1.4.0/include/mpark/lib.hpp
@@ -15,10 +15,8 @@
#include "config.hpp"
-#define RETURN(...) \
- noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__) { \
- return __VA_ARGS__; \
- }
+#define MPARK_RETURN(...) \
+ noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__) { return __VA_ARGS__; }
namespace mpark {
namespace lib {
@@ -121,7 +119,7 @@ namespace mpark {
struct equal_to {
template <typename Lhs, typename Rhs>
inline constexpr auto operator()(Lhs &&lhs, Rhs &&rhs) const
- RETURN(lib::forward<Lhs>(lhs) == lib::forward<Rhs>(rhs))
+ MPARK_RETURN(lib::forward<Lhs>(lhs) == lib::forward<Rhs>(rhs))
};
#endif
@@ -131,7 +129,7 @@ namespace mpark {
struct not_equal_to {
template <typename Lhs, typename Rhs>
inline constexpr auto operator()(Lhs &&lhs, Rhs &&rhs) const
- RETURN(lib::forward<Lhs>(lhs) != lib::forward<Rhs>(rhs))
+ MPARK_RETURN(lib::forward<Lhs>(lhs) != lib::forward<Rhs>(rhs))
};
#endif
@@ -141,7 +139,7 @@ namespace mpark {
struct less {
template <typename Lhs, typename Rhs>
inline constexpr auto operator()(Lhs &&lhs, Rhs &&rhs) const
- RETURN(lib::forward<Lhs>(lhs) < lib::forward<Rhs>(rhs))
+ MPARK_RETURN(lib::forward<Lhs>(lhs) < lib::forward<Rhs>(rhs))
};
#endif
@@ -151,7 +149,7 @@ namespace mpark {
struct greater {
template <typename Lhs, typename Rhs>
inline constexpr auto operator()(Lhs &&lhs, Rhs &&rhs) const
- RETURN(lib::forward<Lhs>(lhs) > lib::forward<Rhs>(rhs))
+ MPARK_RETURN(lib::forward<Lhs>(lhs) > lib::forward<Rhs>(rhs))
};
#endif
@@ -161,7 +159,7 @@ namespace mpark {
struct less_equal {
template <typename Lhs, typename Rhs>
inline constexpr auto operator()(Lhs &&lhs, Rhs &&rhs) const
- RETURN(lib::forward<Lhs>(lhs) <= lib::forward<Rhs>(rhs))
+ MPARK_RETURN(lib::forward<Lhs>(lhs) <= lib::forward<Rhs>(rhs))
};
#endif
@@ -171,7 +169,7 @@ namespace mpark {
struct greater_equal {
template <typename Lhs, typename Rhs>
inline constexpr auto operator()(Lhs &&lhs, Rhs &&rhs) const
- RETURN(lib::forward<Lhs>(lhs) >= lib::forward<Rhs>(rhs))
+ MPARK_RETURN(lib::forward<Lhs>(lhs) >= lib::forward<Rhs>(rhs))
};
#endif
} // namespace cpp14
@@ -208,48 +206,107 @@ namespace mpark {
static constexpr bool value = decltype(test<T>(0))::value;
};
- template <typename T, bool = is_swappable<T>::value>
+ template <bool IsSwappable, typename T>
struct is_nothrow_swappable {
static constexpr bool value =
noexcept(swap(std::declval<T &>(), std::declval<T &>()));
};
template <typename T>
- struct is_nothrow_swappable<T, false> : std::false_type {};
+ struct is_nothrow_swappable<false, T> : std::false_type {};
} // namespace swappable
} // namespace detail
using detail::swappable::is_swappable;
- using detail::swappable::is_nothrow_swappable;
+
+ template <typename T>
+ using is_nothrow_swappable =
+ detail::swappable::is_nothrow_swappable<is_swappable<T>::value, T>;
// <functional>
+ namespace detail {
+
+ template <typename T>
+ struct is_reference_wrapper : std::false_type {};
+
+ template <typename T>
+ struct is_reference_wrapper<std::reference_wrapper<T>>
+ : std::true_type {};
+
+ template <bool, int>
+ struct Invoke;
+
+ template <>
+ struct Invoke<true /* pmf */, 0 /* is_base_of */> {
+ template <typename R, typename T, typename Arg, typename... Args>
+ inline static constexpr auto invoke(R T::*pmf, Arg &&arg, Args &&... args)
+ MPARK_RETURN((lib::forward<Arg>(arg).*pmf)(lib::forward<Args>(args)...))
+ };
+
+ template <>
+ struct Invoke<true /* pmf */, 1 /* is_reference_wrapper */> {
+ template <typename R, typename T, typename Arg, typename... Args>
+ inline static constexpr auto invoke(R T::*pmf, Arg &&arg, Args &&... args)
+ MPARK_RETURN((lib::forward<Arg>(arg).get().*pmf)(lib::forward<Args>(args)...))
+ };
+
+ template <>
+ struct Invoke<true /* pmf */, 2 /* otherwise */> {
+ template <typename R, typename T, typename Arg, typename... Args>
+ inline static constexpr auto invoke(R T::*pmf, Arg &&arg, Args &&... args)
+ MPARK_RETURN(((*lib::forward<Arg>(arg)).*pmf)(lib::forward<Args>(args)...))
+ };
+
+ template <>
+ struct Invoke<false /* pmo */, 0 /* is_base_of */> {
+ template <typename R, typename T, typename Arg>
+ inline static constexpr auto invoke(R T::*pmo, Arg &&arg)
+ MPARK_RETURN(lib::forward<Arg>(arg).*pmo)
+ };
+
+ template <>
+ struct Invoke<false /* pmo */, 1 /* is_reference_wrapper */> {
+ template <typename R, typename T, typename Arg>
+ inline static constexpr auto invoke(R T::*pmo, Arg &&arg)
+ MPARK_RETURN(lib::forward<Arg>(arg).get().*pmo)
+ };
+
+ template <>
+ struct Invoke<false /* pmo */, 2 /* otherwise */> {
+ template <typename R, typename T, typename Arg>
+ inline static constexpr auto invoke(R T::*pmo, Arg &&arg)
+ MPARK_RETURN((*lib::forward<Arg>(arg)).*pmo)
+ };
+
+ template <typename R, typename T, typename Arg, typename... Args>
+ inline constexpr auto invoke(R T::*f, Arg &&arg, Args &&... args)
+ MPARK_RETURN(
+ Invoke<std::is_function<R>::value,
+ (std::is_base_of<T, lib::decay_t<Arg>>::value
+ ? 0
+ : is_reference_wrapper<lib::decay_t<Arg>>::value
+ ? 1
+ : 2)>::invoke(f,
+ lib::forward<Arg>(arg),
+ lib::forward<Args>(args)...))
+
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4100)
#endif
- template <typename F, typename... As>
- inline constexpr auto invoke(F &&f, As &&... as)
- RETURN(lib::forward<F>(f)(lib::forward<As>(as)...))
+ template <typename F, typename... Args>
+ inline constexpr auto invoke(F &&f, Args &&... args)
+ MPARK_RETURN(lib::forward<F>(f)(lib::forward<Args>(args)...))
#ifdef _MSC_VER
#pragma warning(pop)
#endif
+ } // namespace detail
- template <typename B, typename T, typename D>
- inline constexpr auto invoke(T B::*pmv, D &&d)
- RETURN(lib::forward<D>(d).*pmv)
-
- template <typename Pmv, typename Ptr>
- inline constexpr auto invoke(Pmv pmv, Ptr &&ptr)
- RETURN((*lib::forward<Ptr>(ptr)).*pmv)
-
- template <typename B, typename T, typename D, typename... As>
- inline constexpr auto invoke(T B::*pmf, D &&d, As &&... as)
- RETURN((lib::forward<D>(d).*pmf)(lib::forward<As>(as)...))
-
- template <typename Pmf, typename Ptr, typename... As>
- inline constexpr auto invoke(Pmf pmf, Ptr &&ptr, As &&... as)
- RETURN(((*lib::forward<Ptr>(ptr)).*pmf)(lib::forward<As>(as)...))
+ template <typename F, typename... Args>
+ inline constexpr auto invoke(F &&f, Args &&... args)
+ MPARK_RETURN(detail::invoke(lib::forward<F>(f),
+ lib::forward<Args>(args)...))
namespace detail {
@@ -299,10 +356,48 @@ namespace mpark {
template <typename R, typename F, typename... Args>
using is_invocable_r = detail::is_invocable_r<void, R, F, Args...>;
+ namespace detail {
+
+ template <bool Invocable, typename F, typename... Args>
+ struct is_nothrow_invocable {
+ static constexpr bool value =
+ noexcept(lib::invoke(std::declval<F>(), std::declval<Args>()...));
+ };
+
+ template <typename F, typename... Args>
+ struct is_nothrow_invocable<false, F, Args...> : std::false_type {};
+
+ template <bool Invocable, typename R, typename F, typename... Args>
+ struct is_nothrow_invocable_r {
+ private:
+ inline static R impl() {
+ return lib::invoke(std::declval<F>(), std::declval<Args>()...);
+ }
+
+ public:
+ static constexpr bool value = noexcept(impl());
+ };
+
+ template <typename R, typename F, typename... Args>
+ struct is_nothrow_invocable_r<false, R, F, Args...> : std::false_type {};
+
+ } // namespace detail
+
+ template <typename F, typename... Args>
+ using is_nothrow_invocable = detail::
+ is_nothrow_invocable<is_invocable<F, Args...>::value, F, Args...>;
+
+ template <typename R, typename F, typename... Args>
+ using is_nothrow_invocable_r =
+ detail::is_nothrow_invocable_r<is_invocable_r<R, F, Args...>::value,
+ R,
+ F,
+ Args...>;
+
// <memory>
#ifdef MPARK_BUILTIN_ADDRESSOF
template <typename T>
- inline constexpr T *addressof(T &arg) {
+ inline constexpr T *addressof(T &arg) noexcept {
return __builtin_addressof(arg);
}
#else
@@ -327,19 +422,19 @@ namespace mpark {
using has_addressof = bool_constant<has_addressof_impl::impl<T>()>;
template <typename T>
- inline constexpr T *addressof(T &arg, std::true_type) {
+ inline constexpr T *addressof(T &arg, std::true_type) noexcept {
return std::addressof(arg);
}
template <typename T>
- inline constexpr T *addressof(T &arg, std::false_type) {
+ inline constexpr T *addressof(T &arg, std::false_type) noexcept {
return &arg;
}
} // namespace detail
template <typename T>
- inline constexpr T *addressof(T &arg) {
+ inline constexpr T *addressof(T &arg) noexcept {
return detail::addressof(arg, detail::has_addressof<T>{});
}
#endif
@@ -362,7 +457,7 @@ namespace mpark {
using size_constant = std::integral_constant<std::size_t, N>;
template <std::size_t I, typename T>
- struct indexed_type : size_constant<I>, identity<T> {};
+ struct indexed_type : size_constant<I> { using type = T; };
template <bool... Bs>
using all = std::is_same<integer_sequence<bool, true, Bs...>,
@@ -437,6 +532,6 @@ namespace mpark {
} // namespace lib
} // namespace mpark
-#undef RETURN
+#undef MPARK_RETURN
#endif // MPARK_LIB_HPP
diff --git a/src/third_party/variant-1.3.0/include/mpark/variant.hpp b/src/third_party/variant-1.4.0/include/mpark/variant.hpp
index 09ad6445bd3..2364c7360a4 100644
--- a/src/third_party/variant-1.3.0/include/mpark/variant.hpp
+++ b/src/third_party/variant-1.4.0/include/mpark/variant.hpp
@@ -240,7 +240,7 @@ namespace mpark {
class bad_variant_access : public std::exception {
public:
- virtual const char *what() const noexcept { return "bad_variant_access"; }
+ virtual const char *what() const noexcept override { return "bad_variant_access"; }
};
[[noreturn]] inline void throw_bad_variant_access() {
@@ -248,9 +248,7 @@ namespace mpark {
throw bad_variant_access{};
#else
std::terminate();
-#ifdef MPARK_BUILTIN_UNREACHABLE
- __builtin_unreachable();
-#endif
+ MPARK_BUILTIN_UNREACHABLE;
#endif
}
@@ -298,7 +296,7 @@ namespace mpark {
template <std::size_t I, typename... Ts>
struct variant_alternative<I, variant<Ts...>> {
static_assert(I < sizeof...(Ts),
- "Index out of bounds in std::variant_alternative<>");
+ "index out of bounds in `std::variant_alternative<>`");
using type = lib::type_pack_element_t<I, Ts...>;
};
@@ -381,9 +379,11 @@ namespace mpark {
#ifdef MPARK_CPP14_CONSTEXPR
template <typename... Traits>
- inline constexpr Trait common_trait(Traits... traits) {
+ inline constexpr Trait common_trait(Traits... traits_) {
Trait result = Trait::TriviallyAvailable;
- for (Trait t : {traits...}) {
+ lib::array<Trait, sizeof...(Traits)> traits = {{traits_...}};
+ for (std::size_t i = 0; i < sizeof...(Traits); ++i) {
+ Trait t = traits[i];
if (static_cast<int>(t) > static_cast<int>(result)) {
result = t;
}
@@ -475,8 +475,13 @@ namespace mpark {
struct base {
template <std::size_t I, typename V>
inline static constexpr AUTO_REFREF get_alt(V &&v)
+#ifdef _MSC_VER
+ AUTO_REFREF_RETURN(recursive_union::get_alt(
+ lib::forward<V>(v).data_, in_place_index_t<I>{}))
+#else
AUTO_REFREF_RETURN(recursive_union::get_alt(
data(lib::forward<V>(v)), in_place_index_t<I>{}))
+#endif
};
struct variant {
@@ -489,106 +494,259 @@ namespace mpark {
namespace visitation {
+#if defined(MPARK_CPP14_CONSTEXPR) && !defined(_MSC_VER)
+#define MPARK_VARIANT_SWITCH_VISIT
+#endif
+
struct base {
- template <typename T>
- inline static constexpr const T &at(const T &elem) {
- return elem;
- }
+ template <typename Visitor, typename... Vs>
+ using dispatch_result_t = decltype(
+ lib::invoke(std::declval<Visitor>(),
+ access::base::get_alt<0>(std::declval<Vs>())...));
+
+ template <typename Expected>
+ struct expected {
+ template <typename Actual>
+ inline static constexpr bool but_got() {
+ return std::is_same<Expected, Actual>::value;
+ }
+ };
- template <typename T, std::size_t N, typename... Is>
- inline static constexpr const lib::remove_all_extents_t<T> &at(
- const lib::array<T, N> &elems, std::size_t i, Is... is) {
- return at(elems[i], is...);
- }
+ template <typename Expected, typename Actual>
+ struct visit_return_type_check {
+ static_assert(
+ expected<Expected>::template but_got<Actual>(),
+ "`visit` requires the visitor to have a single return type");
- template <typename F, typename... Fs>
- inline static constexpr int visit_visitor_return_type_check() {
- static_assert(lib::all<std::is_same<F, Fs>::value...>::value,
- "`mpark::visit` requires the visitor to have a single "
- "return type.");
- return 0;
- }
+ template <typename Visitor, typename... Alts>
+ inline static constexpr DECLTYPE_AUTO invoke(Visitor &&visitor,
+ Alts &&... alts)
+ DECLTYPE_AUTO_RETURN(lib::invoke(lib::forward<Visitor>(visitor),
+ lib::forward<Alts>(alts)...))
+ };
- template <typename... Fs>
- inline static constexpr lib::array<
- lib::common_type_t<lib::decay_t<Fs>...>,
- sizeof...(Fs)>
- make_farray(Fs &&... fs) {
- using result = lib::array<lib::common_type_t<lib::decay_t<Fs>...>,
- sizeof...(Fs)>;
- return visit_visitor_return_type_check<lib::decay_t<Fs>...>(),
- result{{lib::forward<Fs>(fs)...}};
- }
+#ifdef MPARK_VARIANT_SWITCH_VISIT
+ template <bool B, typename R, typename... ITs>
+ struct dispatcher;
- template <std::size_t... Is>
- struct dispatcher {
- template <typename F, typename... Vs>
- struct impl {
- inline static constexpr DECLTYPE_AUTO dispatch(F f, Vs... vs)
- DECLTYPE_AUTO_RETURN(lib::invoke(
- static_cast<F>(f),
- access::base::get_alt<Is>(static_cast<Vs>(vs))...))
- };
+ template <typename R, typename... ITs>
+ struct dispatcher<false, R, ITs...> {
+ template <std::size_t B, typename F, typename... Vs>
+ MPARK_ALWAYS_INLINE static constexpr R dispatch(
+ F &&, typename ITs::type &&..., Vs &&...) {
+ MPARK_BUILTIN_UNREACHABLE;
+ }
+
+ template <std::size_t I, typename F, typename... Vs>
+ MPARK_ALWAYS_INLINE static constexpr R dispatch_case(F &&, Vs &&...) {
+ MPARK_BUILTIN_UNREACHABLE;
+ }
+
+ template <std::size_t B, typename F, typename... Vs>
+ MPARK_ALWAYS_INLINE static constexpr R dispatch_at(std::size_t,
+ F &&,
+ Vs &&...) {
+ MPARK_BUILTIN_UNREACHABLE;
+ }
};
- template <typename F, typename... Vs, std::size_t... Is>
- inline static constexpr AUTO make_dispatch(lib::index_sequence<Is...>)
- AUTO_RETURN(&dispatcher<Is...>::template impl<F, Vs...>::dispatch)
+ template <typename R, typename... ITs>
+ struct dispatcher<true, R, ITs...> {
+ template <std::size_t B, typename F>
+ MPARK_ALWAYS_INLINE static constexpr R dispatch(
+ F &&f, typename ITs::type &&... visited_vs) {
+ using Expected = R;
+ using Actual = decltype(lib::invoke(
+ lib::forward<F>(f),
+ access::base::get_alt<ITs::value>(
+ lib::forward<typename ITs::type>(visited_vs))...));
+ return visit_return_type_check<Expected, Actual>::invoke(
+ lib::forward<F>(f),
+ access::base::get_alt<ITs::value>(
+ lib::forward<typename ITs::type>(visited_vs))...);
+ }
- template <std::size_t I, typename F, typename... Vs>
- inline static constexpr AUTO make_fdiagonal_impl()
- AUTO_RETURN(make_dispatch<F, Vs...>(
- lib::index_sequence<lib::indexed_type<I, Vs>::value...>{}))
+ template <std::size_t B, typename F, typename V, typename... Vs>
+ MPARK_ALWAYS_INLINE static constexpr R dispatch(
+ F &&f, typename ITs::type &&... visited_vs, V &&v, Vs &&... vs) {
+#define MPARK_DISPATCH(I) \
+ dispatcher<(I < lib::decay_t<V>::size()), \
+ R, \
+ ITs..., \
+ lib::indexed_type<I, V>>:: \
+ template dispatch<0>(lib::forward<F>(f), \
+ lib::forward<typename ITs::type>(visited_vs)..., \
+ lib::forward<V>(v), \
+ lib::forward<Vs>(vs)...)
+
+#define MPARK_DEFAULT(I) \
+ dispatcher<(I < lib::decay_t<V>::size()), R, ITs...>::template dispatch<I>( \
+ lib::forward<F>(f), \
+ lib::forward<typename ITs::type>(visited_vs)..., \
+ lib::forward<V>(v), \
+ lib::forward<Vs>(vs)...)
+
+ switch (v.index()) {
+ case B + 0: return MPARK_DISPATCH(B + 0);
+ case B + 1: return MPARK_DISPATCH(B + 1);
+ case B + 2: return MPARK_DISPATCH(B + 2);
+ case B + 3: return MPARK_DISPATCH(B + 3);
+ case B + 4: return MPARK_DISPATCH(B + 4);
+ case B + 5: return MPARK_DISPATCH(B + 5);
+ case B + 6: return MPARK_DISPATCH(B + 6);
+ case B + 7: return MPARK_DISPATCH(B + 7);
+ case B + 8: return MPARK_DISPATCH(B + 8);
+ case B + 9: return MPARK_DISPATCH(B + 9);
+ case B + 10: return MPARK_DISPATCH(B + 10);
+ case B + 11: return MPARK_DISPATCH(B + 11);
+ case B + 12: return MPARK_DISPATCH(B + 12);
+ case B + 13: return MPARK_DISPATCH(B + 13);
+ case B + 14: return MPARK_DISPATCH(B + 14);
+ case B + 15: return MPARK_DISPATCH(B + 15);
+ case B + 16: return MPARK_DISPATCH(B + 16);
+ case B + 17: return MPARK_DISPATCH(B + 17);
+ case B + 18: return MPARK_DISPATCH(B + 18);
+ case B + 19: return MPARK_DISPATCH(B + 19);
+ case B + 20: return MPARK_DISPATCH(B + 20);
+ case B + 21: return MPARK_DISPATCH(B + 21);
+ case B + 22: return MPARK_DISPATCH(B + 22);
+ case B + 23: return MPARK_DISPATCH(B + 23);
+ case B + 24: return MPARK_DISPATCH(B + 24);
+ case B + 25: return MPARK_DISPATCH(B + 25);
+ case B + 26: return MPARK_DISPATCH(B + 26);
+ case B + 27: return MPARK_DISPATCH(B + 27);
+ case B + 28: return MPARK_DISPATCH(B + 28);
+ case B + 29: return MPARK_DISPATCH(B + 29);
+ case B + 30: return MPARK_DISPATCH(B + 30);
+ case B + 31: return MPARK_DISPATCH(B + 31);
+ default: return MPARK_DEFAULT(B + 32);
+ }
- template <typename F, typename... Vs, std::size_t... Is>
- inline static constexpr AUTO make_fdiagonal_impl(
- lib::index_sequence<Is...>)
- AUTO_RETURN(make_farray(make_fdiagonal_impl<Is, F, Vs...>()...))
+#undef MPARK_DEFAULT
+#undef MPARK_DISPATCH
+ }
- template <typename F, typename V, typename... Vs>
- inline static constexpr /* auto * */ auto make_fdiagonal()
- -> decltype(make_fdiagonal_impl<F, V, Vs...>(
- lib::make_index_sequence<lib::decay_t<V>::size()>{})) {
- static_assert(lib::all<(lib::decay_t<V>::size() ==
- lib::decay_t<Vs>::size())...>::value,
- "all of the variants must be the same size.");
- return make_fdiagonal_impl<F, V, Vs...>(
- lib::make_index_sequence<lib::decay_t<V>::size()>{});
- }
+ template <std::size_t I, typename F, typename... Vs>
+ MPARK_ALWAYS_INLINE static constexpr R dispatch_case(F &&f,
+ Vs &&... vs) {
+ using Expected = R;
+ using Actual = decltype(
+ lib::invoke(lib::forward<F>(f),
+ access::base::get_alt<I>(lib::forward<Vs>(vs))...));
+ return visit_return_type_check<Expected, Actual>::invoke(
+ lib::forward<F>(f),
+ access::base::get_alt<I>(lib::forward<Vs>(vs))...);
+ }
-#ifdef MPARK_RETURN_TYPE_DEDUCTION
- template <typename F, typename... Vs, typename Is>
- inline static constexpr auto make_fmatrix_impl(Is is) {
- return make_dispatch<F, Vs...>(is);
+ template <std::size_t B, typename F, typename V, typename... Vs>
+ MPARK_ALWAYS_INLINE static constexpr R dispatch_at(std::size_t index,
+ F &&f,
+ V &&v,
+ Vs &&... vs) {
+ static_assert(lib::all<(lib::decay_t<V>::size() ==
+ lib::decay_t<Vs>::size())...>::value,
+ "all of the variants must be the same size.");
+#define MPARK_DISPATCH_AT(I) \
+ dispatcher<(I < lib::decay_t<V>::size()), R>::template dispatch_case<I>( \
+ lib::forward<F>(f), lib::forward<V>(v), lib::forward<Vs>(vs)...)
+
+#define MPARK_DEFAULT(I) \
+ dispatcher<(I < lib::decay_t<V>::size()), R>::template dispatch_at<I>( \
+ index, lib::forward<F>(f), lib::forward<V>(v), lib::forward<Vs>(vs)...)
+
+ switch (index) {
+ case B + 0: return MPARK_DISPATCH_AT(B + 0);
+ case B + 1: return MPARK_DISPATCH_AT(B + 1);
+ case B + 2: return MPARK_DISPATCH_AT(B + 2);
+ case B + 3: return MPARK_DISPATCH_AT(B + 3);
+ case B + 4: return MPARK_DISPATCH_AT(B + 4);
+ case B + 5: return MPARK_DISPATCH_AT(B + 5);
+ case B + 6: return MPARK_DISPATCH_AT(B + 6);
+ case B + 7: return MPARK_DISPATCH_AT(B + 7);
+ case B + 8: return MPARK_DISPATCH_AT(B + 8);
+ case B + 9: return MPARK_DISPATCH_AT(B + 9);
+ case B + 10: return MPARK_DISPATCH_AT(B + 10);
+ case B + 11: return MPARK_DISPATCH_AT(B + 11);
+ case B + 12: return MPARK_DISPATCH_AT(B + 12);
+ case B + 13: return MPARK_DISPATCH_AT(B + 13);
+ case B + 14: return MPARK_DISPATCH_AT(B + 14);
+ case B + 15: return MPARK_DISPATCH_AT(B + 15);
+ case B + 16: return MPARK_DISPATCH_AT(B + 16);
+ case B + 17: return MPARK_DISPATCH_AT(B + 17);
+ case B + 18: return MPARK_DISPATCH_AT(B + 18);
+ case B + 19: return MPARK_DISPATCH_AT(B + 19);
+ case B + 20: return MPARK_DISPATCH_AT(B + 20);
+ case B + 21: return MPARK_DISPATCH_AT(B + 21);
+ case B + 22: return MPARK_DISPATCH_AT(B + 22);
+ case B + 23: return MPARK_DISPATCH_AT(B + 23);
+ case B + 24: return MPARK_DISPATCH_AT(B + 24);
+ case B + 25: return MPARK_DISPATCH_AT(B + 25);
+ case B + 26: return MPARK_DISPATCH_AT(B + 26);
+ case B + 27: return MPARK_DISPATCH_AT(B + 27);
+ case B + 28: return MPARK_DISPATCH_AT(B + 28);
+ case B + 29: return MPARK_DISPATCH_AT(B + 29);
+ case B + 30: return MPARK_DISPATCH_AT(B + 30);
+ case B + 31: return MPARK_DISPATCH_AT(B + 31);
+ default: return MPARK_DEFAULT(B + 32);
+ }
+
+#undef MPARK_DEFAULT
+#undef MPARK_DISPATCH_AT
+ }
+ };
+#else
+ template <typename T>
+ inline static constexpr const T &at(const T &elem) noexcept {
+ return elem;
}
- template <typename F,
- typename... Vs,
- typename Is,
- std::size_t... Js,
- typename... Ls>
- inline static constexpr auto make_fmatrix_impl(
- Is, lib::index_sequence<Js...>, Ls... ls) {
- return make_farray(make_fmatrix_impl<F, Vs...>(
- lib::push_back_t<Is, Js>{}, ls...)...);
+ template <typename T, std::size_t N, typename... Is>
+ inline static constexpr const lib::remove_all_extents_t<T> &at(
+ const lib::array<T, N> &elems, std::size_t i, Is... is) noexcept {
+ return at(elems[i], is...);
}
- template <typename F, typename... Vs>
- inline static constexpr auto make_fmatrix() {
- return make_fmatrix_impl<F, Vs...>(
- lib::index_sequence<>{},
- lib::make_index_sequence<lib::decay_t<Vs>::size()>{}...);
+ template <typename F, typename... Fs>
+ inline static constexpr lib::array<lib::decay_t<F>, sizeof...(Fs) + 1>
+ make_farray(F &&f, Fs &&... fs) {
+ return {{lib::forward<F>(f), lib::forward<Fs>(fs)...}};
}
-#else
+
template <typename F, typename... Vs>
struct make_fmatrix_impl {
+
+ template <std::size_t... Is>
+ inline static constexpr dispatch_result_t<F, Vs...> dispatch(
+ F &&f, Vs &&... vs) {
+ using Expected = dispatch_result_t<F, Vs...>;
+ using Actual = decltype(lib::invoke(
+ lib::forward<F>(f),
+ access::base::get_alt<Is>(lib::forward<Vs>(vs))...));
+ return visit_return_type_check<Expected, Actual>::invoke(
+ lib::forward<F>(f),
+ access::base::get_alt<Is>(lib::forward<Vs>(vs))...);
+ }
+
+#ifdef MPARK_RETURN_TYPE_DEDUCTION
+ template <std::size_t... Is>
+ inline static constexpr auto impl(lib::index_sequence<Is...>) {
+ return &dispatch<Is...>;
+ }
+
+ template <typename Is, std::size_t... Js, typename... Ls>
+ inline static constexpr auto impl(Is,
+ lib::index_sequence<Js...>,
+ Ls... ls) {
+ return make_farray(impl(lib::push_back_t<Is, Js>{}, ls...)...);
+ }
+#else
template <typename...>
struct impl;
- template <typename Is>
- struct impl<Is> {
+ template <std::size_t... Is>
+ struct impl<lib::index_sequence<Is...>> {
inline constexpr AUTO operator()() const
- AUTO_RETURN(make_dispatch<F, Vs...>(Is{}))
+ AUTO_RETURN(&dispatch<Is...>)
};
template <typename Is, std::size_t... Js, typename... Ls>
@@ -597,8 +755,17 @@ namespace mpark {
AUTO_RETURN(
make_farray(impl<lib::push_back_t<Is, Js>, Ls...>{}()...))
};
+#endif
};
+#ifdef MPARK_RETURN_TYPE_DEDUCTION
+ template <typename F, typename... Vs>
+ inline static constexpr auto make_fmatrix() {
+ return make_fmatrix_impl<F, Vs...>::impl(
+ lib::index_sequence<>{},
+ lib::make_index_sequence<lib::decay_t<Vs>::size()>{}...);
+ }
+#else
template <typename F, typename... Vs>
inline static constexpr AUTO make_fmatrix()
AUTO_RETURN(
@@ -606,86 +773,141 @@ namespace mpark {
lib::index_sequence<>,
lib::make_index_sequence<lib::decay_t<Vs>::size()>...>{}())
#endif
- }; // namespace base
+ template <typename F, typename... Vs>
+ struct make_fdiagonal_impl {
+ template <std::size_t I>
+ inline static constexpr dispatch_result_t<F, Vs...> dispatch(
+ F &&f, Vs &&... vs) {
+ using Expected = dispatch_result_t<F, Vs...>;
+ using Actual = decltype(
+ lib::invoke(lib::forward<F>(f),
+ access::base::get_alt<I>(lib::forward<Vs>(vs))...));
+ return visit_return_type_check<Expected, Actual>::invoke(
+ lib::forward<F>(f),
+ access::base::get_alt<I>(lib::forward<Vs>(vs))...);
+ }
+
+ template <std::size_t... Is>
+ inline static constexpr AUTO impl(lib::index_sequence<Is...>)
+ AUTO_RETURN(make_farray(&dispatch<Is>...))
+ };
+
+ template <typename F, typename V, typename... Vs>
+ inline static constexpr auto make_fdiagonal()
+ -> decltype(make_fdiagonal_impl<F, V, Vs...>::impl(
+ lib::make_index_sequence<lib::decay_t<V>::size()>{})) {
+ static_assert(lib::all<(lib::decay_t<V>::size() ==
+ lib::decay_t<Vs>::size())...>::value,
+ "all of the variants must be the same size.");
+ return make_fdiagonal_impl<F, V, Vs...>::impl(
+ lib::make_index_sequence<lib::decay_t<V>::size()>{});
+ }
+#endif
+ };
+
+#if !defined(MPARK_VARIANT_SWITCH_VISIT) && \
+ (!defined(_MSC_VER) || _MSC_VER >= 1910)
template <typename F, typename... Vs>
- using FDiagonal = decltype(base::make_fdiagonal<F, Vs...>());
+ using fmatrix_t = decltype(base::make_fmatrix<F, Vs...>());
template <typename F, typename... Vs>
- struct fdiagonal {
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable : 4268)
-#endif
- static constexpr FDiagonal<F, Vs...> value =
- base::make_fdiagonal<F, Vs...>();
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
+ struct fmatrix {
+ static constexpr fmatrix_t<F, Vs...> value =
+ base::make_fmatrix<F, Vs...>();
};
template <typename F, typename... Vs>
- constexpr FDiagonal<F, Vs...> fdiagonal<F, Vs...>::value;
+ constexpr fmatrix_t<F, Vs...> fmatrix<F, Vs...>::value;
template <typename F, typename... Vs>
- using FMatrix = decltype(base::make_fmatrix<F, Vs...>());
+ using fdiagonal_t = decltype(base::make_fdiagonal<F, Vs...>());
template <typename F, typename... Vs>
- struct fmatrix {
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable : 4268)
-#endif
- static constexpr FMatrix<F, Vs...> value =
- base::make_fmatrix<F, Vs...>();
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
+ struct fdiagonal {
+ static constexpr fdiagonal_t<F, Vs...> value =
+ base::make_fdiagonal<F, Vs...>();
};
template <typename F, typename... Vs>
- constexpr FMatrix<F, Vs...> fmatrix<F, Vs...>::value;
+ constexpr fdiagonal_t<F, Vs...> fdiagonal<F, Vs...>::value;
+#endif
struct alt {
template <typename Visitor, typename... Vs>
+ inline static constexpr DECLTYPE_AUTO visit_alt(Visitor &&visitor,
+ Vs &&... vs)
+#ifdef MPARK_VARIANT_SWITCH_VISIT
+ DECLTYPE_AUTO_RETURN(
+ base::dispatcher<
+ true,
+ base::dispatch_result_t<Visitor,
+ decltype(as_base(
+ lib::forward<Vs>(vs)))...>>::
+ template dispatch<0>(lib::forward<Visitor>(visitor),
+ as_base(lib::forward<Vs>(vs))...))
+#elif !defined(_MSC_VER) || _MSC_VER >= 1910
+ DECLTYPE_AUTO_RETURN(base::at(
+ fmatrix<Visitor &&,
+ decltype(as_base(lib::forward<Vs>(vs)))...>::value,
+ vs.index()...)(lib::forward<Visitor>(visitor),
+ as_base(lib::forward<Vs>(vs))...))
+#else
+ DECLTYPE_AUTO_RETURN(base::at(
+ base::make_fmatrix<Visitor &&,
+ decltype(as_base(lib::forward<Vs>(vs)))...>(),
+ vs.index()...)(lib::forward<Visitor>(visitor),
+ as_base(lib::forward<Vs>(vs))...))
+#endif
+
+ template <typename Visitor, typename... Vs>
inline static constexpr DECLTYPE_AUTO visit_alt_at(std::size_t index,
Visitor &&visitor,
Vs &&... vs)
+#ifdef MPARK_VARIANT_SWITCH_VISIT
+ DECLTYPE_AUTO_RETURN(
+ base::dispatcher<
+ true,
+ base::dispatch_result_t<Visitor,
+ decltype(as_base(
+ lib::forward<Vs>(vs)))...>>::
+ template dispatch_at<0>(index,
+ lib::forward<Visitor>(visitor),
+ as_base(lib::forward<Vs>(vs))...))
+#elif !defined(_MSC_VER) || _MSC_VER >= 1910
DECLTYPE_AUTO_RETURN(base::at(
fdiagonal<Visitor &&,
decltype(as_base(lib::forward<Vs>(vs)))...>::value,
index)(lib::forward<Visitor>(visitor),
as_base(lib::forward<Vs>(vs))...))
-
- template <typename Visitor, typename... Vs>
- inline static constexpr DECLTYPE_AUTO visit_alt(Visitor &&visitor,
- Vs &&... vs)
+#else
DECLTYPE_AUTO_RETURN(base::at(
- fmatrix<Visitor &&,
- decltype(as_base(lib::forward<Vs>(vs)))...>::value,
- vs.index()...)(lib::forward<Visitor>(visitor),
- as_base(lib::forward<Vs>(vs))...))
+ base::make_fdiagonal<Visitor &&,
+ decltype(as_base(lib::forward<Vs>(vs)))...>(),
+ index)(lib::forward<Visitor>(visitor),
+ as_base(lib::forward<Vs>(vs))...))
+#endif
};
struct variant {
private:
+ template <typename Visitor>
+ struct visitor {
+ template <typename... Values>
+ inline static constexpr bool does_not_handle() {
+ return lib::is_invocable<Visitor, Values...>::value;
+ }
+ };
+
template <typename Visitor, typename... Values>
- struct visit_exhaustive_visitor_check {
- static_assert(
- lib::is_invocable<Visitor, Values...>::value,
- "`mpark::visit` requires the visitor to be exhaustive.");
+ struct visit_exhaustiveness_check {
+ static_assert(visitor<Visitor>::template does_not_handle<Values...>(),
+ "`visit` requires the visitor to be exhaustive.");
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable : 4100)
-#endif
- inline constexpr DECLTYPE_AUTO operator()(Visitor &&visitor,
- Values &&... values) const
+ inline static constexpr DECLTYPE_AUTO invoke(Visitor &&visitor,
+ Values &&... values)
DECLTYPE_AUTO_RETURN(lib::invoke(lib::forward<Visitor>(visitor),
lib::forward<Values>(values)...))
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
};
template <typename Visitor>
@@ -695,11 +917,11 @@ namespace mpark {
template <typename... Alts>
inline constexpr DECLTYPE_AUTO operator()(Alts &&... alts) const
DECLTYPE_AUTO_RETURN(
- visit_exhaustive_visitor_check<
+ visit_exhaustiveness_check<
Visitor,
- decltype((lib::forward<Alts>(alts).value))...>{}(
- lib::forward<Visitor>(visitor_),
- lib::forward<Alts>(alts).value...))
+ decltype((lib::forward<Alts>(alts).value))...>::
+ invoke(lib::forward<Visitor>(visitor_),
+ lib::forward<Alts>(alts).value...))
};
template <typename Visitor>
@@ -708,6 +930,12 @@ namespace mpark {
public:
template <typename Visitor, typename... Vs>
+ inline static constexpr DECLTYPE_AUTO visit_alt(Visitor &&visitor,
+ Vs &&... vs)
+ DECLTYPE_AUTO_RETURN(alt::visit_alt(lib::forward<Visitor>(visitor),
+ lib::forward<Vs>(vs).impl_...))
+
+ template <typename Visitor, typename... Vs>
inline static constexpr DECLTYPE_AUTO visit_alt_at(std::size_t index,
Visitor &&visitor,
Vs &&... vs)
@@ -717,10 +945,11 @@ namespace mpark {
lib::forward<Vs>(vs).impl_...))
template <typename Visitor, typename... Vs>
- inline static constexpr DECLTYPE_AUTO visit_alt(Visitor &&visitor,
- Vs &&... vs)
- DECLTYPE_AUTO_RETURN(alt::visit_alt(lib::forward<Visitor>(visitor),
- lib::forward<Vs>(vs).impl_...))
+ inline static constexpr DECLTYPE_AUTO visit_value(Visitor &&visitor,
+ Vs &&... vs)
+ DECLTYPE_AUTO_RETURN(
+ visit_alt(make_value_visitor(lib::forward<Visitor>(visitor)),
+ lib::forward<Vs>(vs)...))
template <typename Visitor, typename... Vs>
inline static constexpr DECLTYPE_AUTO visit_value_at(std::size_t index,
@@ -730,13 +959,6 @@ namespace mpark {
visit_alt_at(index,
make_value_visitor(lib::forward<Visitor>(visitor)),
lib::forward<Vs>(vs)...))
-
- template <typename Visitor, typename... Vs>
- inline static constexpr DECLTYPE_AUTO visit_value(Visitor &&visitor,
- Vs &&... vs)
- DECLTYPE_AUTO_RETURN(
- visit_alt(make_value_visitor(lib::forward<Visitor>(visitor)),
- lib::forward<Vs>(vs)...))
};
} // namespace visitation
@@ -862,13 +1084,13 @@ namespace mpark {
#endif
};
-#if defined(_MSC_VER) && _MSC_VER < 1910
-#define INHERITING_CTOR(type, base) \
+#if !defined(_MSC_VER) || _MSC_VER >= 1910
+#define MPARK_INHERITING_CTOR(type, base) using base::base;
+#else
+#define MPARK_INHERITING_CTOR(type, base) \
template <typename... Args> \
inline explicit constexpr type(Args &&... args) \
: base(lib::forward<Args>(args)...) {}
-#else
-#define INHERITING_CTOR(type, base) using base::base;
#endif
template <typename Traits, Trait = Traits::destructible_trait>
@@ -881,7 +1103,7 @@ namespace mpark {
using super = base<destructible_trait, Ts...>; \
\
public: \
- INHERITING_CTOR(destructor, super) \
+ MPARK_INHERITING_CTOR(destructor, super) \
using super::operator=; \
\
destructor(const destructor &) = default; \
@@ -923,7 +1145,7 @@ namespace mpark {
using super = destructor<Traits>;
public:
- INHERITING_CTOR(constructor, super)
+ MPARK_INHERITING_CTOR(constructor, super)
using super::operator=;
protected:
@@ -939,9 +1161,9 @@ namespace mpark {
template <std::size_t I, typename T, typename... Args>
inline static T &construct_alt(alt<I, T> &a, Args &&... args) {
- ::new (static_cast<void *>(lib::addressof(a)))
+ auto *result = ::new (static_cast<void *>(lib::addressof(a)))
alt<I, T>(in_place_t{}, lib::forward<Args>(args)...);
- return a.value;
+ return result->value;
}
template <typename Rhs>
@@ -976,7 +1198,7 @@ namespace mpark {
using super = constructor<traits<Ts...>>; \
\
public: \
- INHERITING_CTOR(move_constructor, super) \
+ MPARK_INHERITING_CTOR(move_constructor, super) \
using super::operator=; \
\
move_constructor(const move_constructor &) = default; \
@@ -1014,7 +1236,7 @@ namespace mpark {
using super = move_constructor<traits<Ts...>>; \
\
public: \
- INHERITING_CTOR(copy_constructor, super) \
+ MPARK_INHERITING_CTOR(copy_constructor, super) \
using super::operator=; \
\
definition \
@@ -1046,7 +1268,7 @@ namespace mpark {
using super = copy_constructor<Traits>;
public:
- INHERITING_CTOR(assignment, super)
+ MPARK_INHERITING_CTOR(assignment, super)
using super::operator=;
template <std::size_t I, typename... Args>
@@ -1134,7 +1356,7 @@ namespace mpark {
using super = assignment<traits<Ts...>>; \
\
public: \
- INHERITING_CTOR(move_assignment, super) \
+ MPARK_INHERITING_CTOR(move_assignment, super) \
using super::operator=; \
\
move_assignment(const move_assignment &) = default; \
@@ -1174,7 +1396,7 @@ namespace mpark {
using super = move_assignment<traits<Ts...>>; \
\
public: \
- INHERITING_CTOR(copy_assignment, super) \
+ MPARK_INHERITING_CTOR(copy_assignment, super) \
using super::operator=; \
\
copy_assignment(const copy_assignment &) = default; \
@@ -1206,7 +1428,7 @@ namespace mpark {
using super = copy_assignment<traits<Ts...>>;
public:
- INHERITING_CTOR(impl, super)
+ MPARK_INHERITING_CTOR(impl, super)
using super::operator=;
template <std::size_t I, typename Arg>
@@ -1277,6 +1499,8 @@ namespace mpark {
}
};
+#undef MPARK_INHERITING_CTOR
+
template <std::size_t I, typename T>
struct overload_leaf {
using F = lib::size_constant<I> (*)(T);
@@ -1520,7 +1744,7 @@ namespace mpark {
namespace detail {
template <std::size_t I, typename V>
struct generic_get_impl {
- constexpr generic_get_impl(int) {}
+ constexpr generic_get_impl(int) noexcept {}
constexpr AUTO_REFREF operator()(V &&v) const
AUTO_REFREF_RETURN(
@@ -1613,11 +1837,26 @@ namespace mpark {
return get_if<detail::find_index_checked<T, Ts...>::value>(v);
}
+ namespace detail {
+ template <typename RelOp>
+ struct convert_to_bool {
+ template <typename Lhs, typename Rhs>
+ inline constexpr bool operator()(Lhs &&lhs, Rhs &&rhs) const {
+ static_assert(std::is_convertible<lib::invoke_result_t<RelOp, Lhs, Rhs>,
+ bool>::value,
+ "relational operators must return a type"
+ " implicitly convertible to bool");
+ return lib::invoke(
+ RelOp{}, lib::forward<Lhs>(lhs), lib::forward<Rhs>(rhs));
+ }
+ };
+ } // namespace detail
+
template <typename... Ts>
inline constexpr bool operator==(const variant<Ts...> &lhs,
const variant<Ts...> &rhs) {
using detail::visitation::variant;
- using lib::equal_to;
+ using equal_to = detail::convert_to_bool<lib::equal_to>;
#ifdef MPARK_CPP14_CONSTEXPR
if (lhs.index() != rhs.index()) return false;
if (lhs.valueless_by_exception()) return true;
@@ -1633,7 +1872,7 @@ namespace mpark {
inline constexpr bool operator!=(const variant<Ts...> &lhs,
const variant<Ts...> &rhs) {
using detail::visitation::variant;
- using lib::not_equal_to;
+ using not_equal_to = detail::convert_to_bool<lib::not_equal_to>;
#ifdef MPARK_CPP14_CONSTEXPR
if (lhs.index() != rhs.index()) return true;
if (lhs.valueless_by_exception()) return false;
@@ -1649,7 +1888,7 @@ namespace mpark {
inline constexpr bool operator<(const variant<Ts...> &lhs,
const variant<Ts...> &rhs) {
using detail::visitation::variant;
- using lib::less;
+ using less = detail::convert_to_bool<lib::less>;
#ifdef MPARK_CPP14_CONSTEXPR
if (rhs.valueless_by_exception()) return false;
if (lhs.valueless_by_exception()) return true;
@@ -1668,7 +1907,7 @@ namespace mpark {
inline constexpr bool operator>(const variant<Ts...> &lhs,
const variant<Ts...> &rhs) {
using detail::visitation::variant;
- using lib::greater;
+ using greater = detail::convert_to_bool<lib::greater>;
#ifdef MPARK_CPP14_CONSTEXPR
if (lhs.valueless_by_exception()) return false;
if (rhs.valueless_by_exception()) return true;
@@ -1687,7 +1926,7 @@ namespace mpark {
inline constexpr bool operator<=(const variant<Ts...> &lhs,
const variant<Ts...> &rhs) {
using detail::visitation::variant;
- using lib::less_equal;
+ using less_equal = detail::convert_to_bool<lib::less_equal>;
#ifdef MPARK_CPP14_CONSTEXPR
if (lhs.valueless_by_exception()) return true;
if (rhs.valueless_by_exception()) return false;
@@ -1707,7 +1946,7 @@ namespace mpark {
inline constexpr bool operator>=(const variant<Ts...> &lhs,
const variant<Ts...> &rhs) {
using detail::visitation::variant;
- using lib::greater_equal;
+ using greater_equal = detail::convert_to_bool<lib::greater_equal>;
#ifdef MPARK_CPP14_CONSTEXPR
if (rhs.valueless_by_exception()) return true;
if (lhs.valueless_by_exception()) return false;
@@ -1814,14 +2053,14 @@ namespace mpark {
namespace hash {
template <typename H, typename K>
- constexpr bool meets_requirements() {
+ constexpr bool meets_requirements() noexcept {
return std::is_copy_constructible<H>::value &&
std::is_move_constructible<H>::value &&
lib::is_invocable_r<std::size_t, H, const K &>::value;
}
template <typename K>
- constexpr bool is_enabled() {
+ constexpr bool is_enabled() noexcept {
using H = std::hash<K>;
return meets_requirements<H, K>() &&
std::is_default_constructible<H>::value &&
diff --git a/src/third_party/variant-1.4.0/support/ninja.py b/src/third_party/variant-1.4.0/support/ninja.py
new file mode 100644
index 00000000000..82758e65ea7
--- /dev/null
+++ b/src/third_party/variant-1.4.0/support/ninja.py
@@ -0,0 +1,46 @@
+# MPark.Variant
+#
+# Copyright Michael Park, 2015-2017
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+import os
+import pprint
+import subprocess
+
+result = {}
+
+std_flags = os.getenv('STDFLAGS')
+for std_flag in std_flags.split() if std_flags is not None else ['']:
+ os.environ['CXXFLAGS'] = std_flag
+ for exceptions in ['OFF', 'ON']:
+ for build_type in ['Debug', 'Release']:
+ config = '{}-{}-{}'.format(
+ filter(str.isalnum, std_flag), exceptions, build_type)
+ build_dir = 'build-{}'.format(config)
+ os.mkdir(build_dir)
+ os.chdir(build_dir)
+ result[config] = { 'Configure': None, 'Build': None, 'Test': None }
+
+ tests = os.environ['TESTS'].split()
+ if std_flag.endswith(('11', '1y', '14', '1z')) and 'libc++' in tests:
+ tests.remove('libc++')
+
+ result[config]['Configure'] = subprocess.call([
+ 'cmake', '-GNinja',
+ '-DCMAKE_BUILD_TYPE={}'.format(build_type),
+ '-DMPARK_VARIANT_EXCEPTIONS={}'.format(exceptions),
+ '-DMPARK_VARIANT_INCLUDE_TESTS={}'.format(';'.join(tests)),
+ '..',
+ ])
+ if result[config]['Configure'] == 0:
+ result[config]['Build'] = subprocess.call([
+ 'cmake', '--build', '.', '--', '-k', '0'])
+ if result[config]['Build'] == 0:
+ result[config]['Test'] = subprocess.call([
+ 'ctest', '--output-on-failure'])
+ os.chdir('..')
+
+pprint.pprint(result)
+exit(any(status != 0 for d in result.itervalues() for status in d.itervalues()))
diff --git a/src/third_party/variant-1.3.0/support/single-header.py b/src/third_party/variant-1.4.0/support/single-header.py
index e6accbeae13..e6accbeae13 100755
--- a/src/third_party/variant-1.3.0/support/single-header.py
+++ b/src/third_party/variant-1.4.0/support/single-header.py
diff --git a/src/third_party/variant-1.4.0/support/vs.py b/src/third_party/variant-1.4.0/support/vs.py
new file mode 100644
index 00000000000..e02fad30ff9
--- /dev/null
+++ b/src/third_party/variant-1.4.0/support/vs.py
@@ -0,0 +1,51 @@
+# MPark.Variant
+#
+# Copyright Michael Park, 2015-2017
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+import os
+import pprint
+import subprocess
+
+result = {}
+
+std_flags = os.getenv('STDFLAGS')
+for std_flag in std_flags.split() if std_flags is not None else ['']:
+ os.environ['CXXFLAGS'] = std_flag
+ for exceptions in ['OFF', 'ON']:
+ config = '{}-{}'.format(filter(str.isalnum, std_flag), exceptions)
+ build_dir = 'build-{}'.format(config)
+ os.mkdir(build_dir)
+ os.chdir(build_dir)
+ result[config] = {
+ 'Configure': None,
+ 'Build-Debug': None,
+ 'Build-Release': None,
+ 'Test-Debug': None,
+ 'Test-Release': None
+ }
+
+ tests = os.environ['TESTS'].split()
+ if std_flag.endswith(('11', '1y', '14', '1z')) and 'libc++' in tests:
+ tests.remove('libc++')
+
+ configure = [
+ 'cmake', '-G', os.environ['GENERATOR'],
+ '-DMPARK_VARIANT_EXCEPTIONS={}'.format(exceptions),
+ '-DMPARK_VARIANT_INCLUDE_TESTS={}'.format(';'.join(tests)),
+ '..',
+ ]
+ result[config]['Configure'] = subprocess.call(configure)
+ if result[config]['Configure'] == 0:
+ for build_type in ['Debug', 'Release']:
+ result[config]['Build-{}'.format(build_type)] = subprocess.call([
+ 'cmake', '--build', '.', '--config', build_type])
+ if result[config]['Build-{}'.format(build_type)] == 0:
+ result[config]['Test-{}'.format(build_type)] = subprocess.call([
+ 'ctest', '--output-on-failure', '--build-config', build_type])
+ os.chdir('..')
+
+pprint.pprint(result)
+exit(any(status != 0 for d in result.itervalues() for status in d.itervalues()))
diff --git a/src/third_party/variant-1.3.0/support/wandbox.cpp b/src/third_party/variant-1.4.0/support/wandbox.cpp
index 1eb8d02bf16..1eb8d02bf16 100644
--- a/src/third_party/variant-1.3.0/support/wandbox.cpp
+++ b/src/third_party/variant-1.4.0/support/wandbox.cpp
diff --git a/src/third_party/variant-1.3.0/support/wandbox.py b/src/third_party/variant-1.4.0/support/wandbox.py
index 01c95e6dae0..01c95e6dae0 100755
--- a/src/third_party/variant-1.3.0/support/wandbox.py
+++ b/src/third_party/variant-1.4.0/support/wandbox.py
diff --git a/src/third_party/variant-1.3.0/test/README.md b/src/third_party/variant-1.4.0/test/README.md
index 45accac599e..45accac599e 100644
--- a/src/third_party/variant-1.3.0/test/README.md
+++ b/src/third_party/variant-1.4.0/test/README.md
diff --git a/src/third_party/variant-1.3.0/test/assign.copy.cpp b/src/third_party/variant-1.4.0/test/assign.copy.cpp
index 3133f554609..3133f554609 100644
--- a/src/third_party/variant-1.3.0/test/assign.copy.cpp
+++ b/src/third_party/variant-1.4.0/test/assign.copy.cpp
diff --git a/src/third_party/variant-1.3.0/test/assign.fwd.cpp b/src/third_party/variant-1.4.0/test/assign.fwd.cpp
index 83547f28091..ae09e342be1 100644
--- a/src/third_party/variant-1.3.0/test/assign.fwd.cpp
+++ b/src/third_party/variant-1.4.0/test/assign.fwd.cpp
@@ -7,8 +7,9 @@
#include <mpark/variant.hpp>
-#include <string>
#include <sstream>
+#include <string>
+#include <type_traits>
#include <gtest/gtest.h>
diff --git a/src/third_party/variant-1.3.0/test/assign.move.cpp b/src/third_party/variant-1.4.0/test/assign.move.cpp
index 65057d0a654..65057d0a654 100644
--- a/src/third_party/variant-1.3.0/test/assign.move.cpp
+++ b/src/third_party/variant-1.4.0/test/assign.move.cpp
diff --git a/src/third_party/variant-1.3.0/test/ctor.copy.cpp b/src/third_party/variant-1.4.0/test/ctor.copy.cpp
index 7efcd868323..7efcd868323 100644
--- a/src/third_party/variant-1.3.0/test/ctor.copy.cpp
+++ b/src/third_party/variant-1.4.0/test/ctor.copy.cpp
diff --git a/src/third_party/variant-1.3.0/test/ctor.default.cpp b/src/third_party/variant-1.4.0/test/ctor.default.cpp
index 5fb284b22a6..5fb284b22a6 100644
--- a/src/third_party/variant-1.3.0/test/ctor.default.cpp
+++ b/src/third_party/variant-1.4.0/test/ctor.default.cpp
diff --git a/src/third_party/variant-1.3.0/test/ctor.fwd.cpp b/src/third_party/variant-1.4.0/test/ctor.fwd.cpp
index 45f835685d1..45f835685d1 100644
--- a/src/third_party/variant-1.3.0/test/ctor.fwd.cpp
+++ b/src/third_party/variant-1.4.0/test/ctor.fwd.cpp
diff --git a/src/third_party/variant-1.3.0/test/ctor.in_place.cpp b/src/third_party/variant-1.4.0/test/ctor.in_place.cpp
index 072f3d6a182..072f3d6a182 100644
--- a/src/third_party/variant-1.3.0/test/ctor.in_place.cpp
+++ b/src/third_party/variant-1.4.0/test/ctor.in_place.cpp
diff --git a/src/third_party/variant-1.3.0/test/ctor.move.cpp b/src/third_party/variant-1.4.0/test/ctor.move.cpp
index b542b971621..1ca1e9168e7 100644
--- a/src/third_party/variant-1.3.0/test/ctor.move.cpp
+++ b/src/third_party/variant-1.4.0/test/ctor.move.cpp
@@ -22,8 +22,6 @@ TEST(Ctor_Move, Value) {
// `w`
mpark::variant<int, std::string> w(lib::move(v));
EXPECT_EQ("hello", mpark::get<std::string>(w));
- // Check `v`
- EXPECT_TRUE(mpark::get<std::string>(v).empty());
/* constexpr */ {
// `cv`
diff --git a/src/third_party/variant-1.3.0/test/dtor.cpp b/src/third_party/variant-1.4.0/test/dtor.cpp
index 6519ebcd724..6519ebcd724 100644
--- a/src/third_party/variant-1.3.0/test/dtor.cpp
+++ b/src/third_party/variant-1.4.0/test/dtor.cpp
diff --git a/src/third_party/variant-1.3.0/test/get.cpp b/src/third_party/variant-1.4.0/test/get.cpp
index 82fb23b145a..82fb23b145a 100644
--- a/src/third_party/variant-1.3.0/test/get.cpp
+++ b/src/third_party/variant-1.4.0/test/get.cpp
diff --git a/src/third_party/variant-1.3.0/test/hash.cpp b/src/third_party/variant-1.4.0/test/hash.cpp
index 4b4db44dbdb..4b4db44dbdb 100644
--- a/src/third_party/variant-1.3.0/test/hash.cpp
+++ b/src/third_party/variant-1.4.0/test/hash.cpp
diff --git a/src/third_party/variant-1.3.0/test/intro.cpp b/src/third_party/variant-1.4.0/test/intro.cpp
index c93a9fab441..5ed56319d70 100644
--- a/src/third_party/variant-1.3.0/test/intro.cpp
+++ b/src/third_party/variant-1.4.0/test/intro.cpp
@@ -35,8 +35,8 @@ TEST(Variant, Intro) {
v = 42;
struct unary {
- int operator()(int) const { return 0; }
- int operator()(const std::string &) const { return 1; }
+ int operator()(int) const noexcept { return 0; }
+ int operator()(const std::string &) const noexcept { return 1; }
}; // unary
// single visitation.
@@ -53,10 +53,12 @@ TEST(Variant, Intro) {
EXPECT_EQ(v, w);
struct binary {
- int operator()(int, int) const { return 0; }
- int operator()(int, const std::string &) const { return 1; }
- int operator()(const std::string &, int) const { return 2; }
- int operator()(const std::string &, const std::string &) const { return 3; }
+ int operator()(int, int) const noexcept { return 0; }
+ int operator()(int, const std::string &) const noexcept { return 1; }
+ int operator()(const std::string &, int) const noexcept { return 2; }
+ int operator()(const std::string &, const std::string &) const noexcept {
+ return 3;
+ }
}; // binary
// binary visitation.
diff --git a/src/third_party/variant-1.4.0/test/issue.cpp b/src/third_party/variant-1.4.0/test/issue.cpp
new file mode 100644
index 00000000000..e96ebfad791
--- /dev/null
+++ b/src/third_party/variant-1.4.0/test/issue.cpp
@@ -0,0 +1,34 @@
+// MPark.Variant
+//
+// Copyright Michael Park, 2015-2017
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <mpark/variant.hpp>
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include <gtest/gtest.h>
+
+#ifdef MPARK_INCOMPLETE_TYPE_TRAITS
+// https://github.com/mpark/variant/issues/34
+TEST(Issue, 34) {
+ struct S {
+ S(const S &) = default;
+ S(S &&) = default;
+ S &operator=(const S &) = default;
+ S &operator=(S &&) = default;
+
+ mpark::variant<std::map<std::string, S>> value;
+ };
+}
+#endif
+
+// https://github.com/mpark/variant/pull/57
+TEST(Issue, 57) {
+ std::vector<mpark::variant<int, std::unique_ptr<int>>> vec;
+ vec.emplace_back(0);
+}
diff --git a/src/third_party/variant-1.3.0/test/json.cpp b/src/third_party/variant-1.4.0/test/json.cpp
index c265415e0cc..c265415e0cc 100644
--- a/src/third_party/variant-1.3.0/test/json.cpp
+++ b/src/third_party/variant-1.4.0/test/json.cpp
diff --git a/src/third_party/variant-1.3.0/test/libcxx.sh b/src/third_party/variant-1.4.0/test/libcxx.sh
index 13ea7ba17ab..feef1589b52 100755
--- a/src/third_party/variant-1.3.0/test/libcxx.sh
+++ b/src/third_party/variant-1.4.0/test/libcxx.sh
@@ -24,6 +24,7 @@ ${MPARK_VARIANT_LIT} \
--param color_diagnostics \
--param cxx_under_test="${MPARK_VARIANT_CXX_COMPILER}" \
--param compile_flags=-I${MPARK_VARIANT_SOURCE_DIR}/include/mpark \
- --param std=c++17 \
--param libcxx_site_config=${MPARK_VARIANT_LIBCXX_SITE_CONFIG} \
+ --param std=c++17 \
+ --param use_clang_verify=false \
${MPARK_VARIANT_LIBCXX_SOURCE_DIR}/test/std/utilities/variant \
diff --git a/src/third_party/variant-1.3.0/test/mod.cpp b/src/third_party/variant-1.4.0/test/mod.cpp
index 41fb1ff8085..41fb1ff8085 100644
--- a/src/third_party/variant-1.3.0/test/mod.cpp
+++ b/src/third_party/variant-1.4.0/test/mod.cpp
diff --git a/src/third_party/variant-1.3.0/test/relops.cpp b/src/third_party/variant-1.4.0/test/relops.cpp
index 759eb4f0ce3..6b6322771d9 100644
--- a/src/third_party/variant-1.3.0/test/relops.cpp
+++ b/src/third_party/variant-1.4.0/test/relops.cpp
@@ -7,8 +7,12 @@
#include <mpark/variant.hpp>
+#include <string>
+
#include <gtest/gtest.h>
+#include <mpark/config.hpp>
+
#include "util.hpp"
TEST(Rel, SameTypeSameValue) {
@@ -28,7 +32,7 @@ TEST(Rel, SameTypeSameValue) {
EXPECT_TRUE(w <= v);
EXPECT_TRUE(w >= v);
-#if !defined(__GNUC__) || __GNUC__ >= 5
+#ifdef MPARK_CPP11_CONSTEXPR
/* constexpr */ {
constexpr mpark::variant<int, const char *> cv(0), cw(0);
// `cv` op `cw`
@@ -66,7 +70,7 @@ TEST(Rel, SameTypeDiffValue) {
EXPECT_FALSE(w <= v);
EXPECT_TRUE(w >= v);
-#if !defined(__GNUC__) || __GNUC__ >= 5
+#ifdef MPARK_CPP11_CONSTEXPR
/* constexpr */ {
constexpr mpark::variant<int, const char *> cv(0), cw(1);
// `cv` op `cw`
@@ -104,7 +108,7 @@ TEST(Rel, DiffTypeSameValue) {
EXPECT_FALSE(w <= v);
EXPECT_TRUE(w >= v);
-#if !defined(__GNUC__) || __GNUC__ >= 5
+#ifdef MPARK_CPP11_CONSTEXPR
/* constexpr */ {
constexpr mpark::variant<int, unsigned int> cv(0), cw(0u);
// `cv` op `cw`
@@ -142,7 +146,7 @@ TEST(Rel, DiffTypeDiffValue) {
EXPECT_FALSE(w <= v);
EXPECT_TRUE(w >= v);
-#if !defined(__GNUC__) || __GNUC__ >= 5
+#ifdef MPARK_CPP11_CONSTEXPR
/* constexpr */ {
constexpr mpark::variant<int, unsigned int> cv(0), cw(1u);
// `cv` op `cw`
diff --git a/src/third_party/variant-1.3.0/test/swap.cpp b/src/third_party/variant-1.4.0/test/swap.cpp
index 53ef0c46eb7..d3deb3e3c43 100644
--- a/src/third_party/variant-1.3.0/test/swap.cpp
+++ b/src/third_party/variant-1.4.0/test/swap.cpp
@@ -119,7 +119,9 @@ struct Obj {
size_t *dtor_count_;
}; // Obj
-static void swap(Obj &lhs, Obj &rhs) { std::swap(lhs.dtor_count_, rhs.dtor_count_); }
+static void swap(Obj &lhs, Obj &rhs) noexcept {
+ std::swap(lhs.dtor_count_, rhs.dtor_count_);
+}
} // namespace detail
diff --git a/src/third_party/variant-1.3.0/test/util.hpp b/src/third_party/variant-1.4.0/test/util.hpp
index 8fc8ffdd1f6..dc1c78c2014 100644
--- a/src/third_party/variant-1.3.0/test/util.hpp
+++ b/src/third_party/variant-1.4.0/test/util.hpp
@@ -36,12 +36,35 @@ struct copy_thrower_t {
copy_thrower_t &operator=(copy_thrower_t &&) = default;
};
-bool operator<(const copy_thrower_t &, const copy_thrower_t &) { return false; }
-bool operator>(const copy_thrower_t &, const copy_thrower_t &) { return false; }
-bool operator<=(const copy_thrower_t &, const copy_thrower_t &) { return true; }
-bool operator>=(const copy_thrower_t &, const copy_thrower_t &) { return true; }
-bool operator==(const copy_thrower_t &, const copy_thrower_t &) { return true; }
-bool operator!=(const copy_thrower_t &, const copy_thrower_t &) { return false; }
+inline bool operator<(const copy_thrower_t &,
+ const copy_thrower_t &) noexcept {
+ return false;
+}
+
+inline bool operator>(const copy_thrower_t &,
+ const copy_thrower_t &) noexcept {
+ return false;
+}
+
+inline bool operator<=(const copy_thrower_t &,
+ const copy_thrower_t &) noexcept {
+ return true;
+}
+
+inline bool operator>=(const copy_thrower_t &,
+ const copy_thrower_t &) noexcept {
+ return true;
+}
+
+inline bool operator==(const copy_thrower_t &,
+ const copy_thrower_t &) noexcept {
+ return true;
+}
+
+inline bool operator!=(const copy_thrower_t &,
+ const copy_thrower_t &) noexcept {
+ return false;
+}
struct move_thrower_t {
constexpr move_thrower_t() {}
@@ -51,10 +74,34 @@ struct move_thrower_t {
move_thrower_t &operator=(move_thrower_t &&) { throw MoveAssignment{}; }
};
-bool operator<(const move_thrower_t &, const move_thrower_t &) { return false; }
-bool operator>(const move_thrower_t &, const move_thrower_t &) { return false; }
-bool operator<=(const move_thrower_t &, const move_thrower_t &) { return true; }
-bool operator>=(const move_thrower_t &, const move_thrower_t &) { return true; }
-bool operator==(const move_thrower_t &, const move_thrower_t &) { return true; }
-bool operator!=(const move_thrower_t &, const move_thrower_t &) { return false; }
+inline bool operator<(const move_thrower_t &,
+ const move_thrower_t &) noexcept {
+ return false;
+}
+
+inline bool operator>(const move_thrower_t &,
+ const move_thrower_t &) noexcept {
+ return false;
+}
+
+inline bool operator<=(const move_thrower_t &,
+ const move_thrower_t &) noexcept {
+ return true;
+}
+
+inline bool operator>=(const move_thrower_t &,
+ const move_thrower_t &) noexcept {
+ return true;
+}
+
+inline bool operator==(const move_thrower_t &,
+ const move_thrower_t &) noexcept {
+ return true;
+}
+
+inline bool operator!=(const move_thrower_t &,
+ const move_thrower_t &) noexcept {
+ return false;
+}
+
#endif
diff --git a/src/third_party/variant-1.3.0/test/visit.cpp b/src/third_party/variant-1.4.0/test/visit.cpp
index 7f7e8c77a3c..2d3b431e42a 100644
--- a/src/third_party/variant-1.3.0/test/visit.cpp
+++ b/src/third_party/variant-1.4.0/test/visit.cpp
@@ -7,54 +7,48 @@
#include <mpark/variant.hpp>
-#include <cassert>
#include <string>
#include <sstream>
#include <gtest/gtest.h>
-namespace lib = mpark::lib;
+#include <mpark/config.hpp>
-enum Qual { LRef, ConstLRef, RRef, ConstRRef };
+#include "util.hpp"
-struct get_qual {
- constexpr Qual operator()(int &) const { return LRef; }
- constexpr Qual operator()(const int &) const { return ConstLRef; }
- constexpr Qual operator()(int &&) const { return RRef; }
- constexpr Qual operator()(const int &&) const { return ConstRRef; }
-}; // get_qual
+namespace lib = mpark::lib;
TEST(Visit, MutVarMutType) {
mpark::variant<int> v(42);
// Check `v`.
EXPECT_EQ(42, mpark::get<int>(v));
// Check qualifier.
- EXPECT_EQ(LRef, mpark::visit(get_qual(), v));
- EXPECT_EQ(RRef, mpark::visit(get_qual(), lib::move(v)));
+ EXPECT_EQ(LRef, mpark::visit(get_qual, v));
+ EXPECT_EQ(RRef, mpark::visit(get_qual, lib::move(v)));
}
TEST(Visit, MutVarConstType) {
mpark::variant<const int> v(42);
EXPECT_EQ(42, mpark::get<const int>(v));
// Check qualifier.
- EXPECT_EQ(ConstLRef, mpark::visit(get_qual(), v));
- EXPECT_EQ(ConstRRef, mpark::visit(get_qual(), lib::move(v)));
+ EXPECT_EQ(ConstLRef, mpark::visit(get_qual, v));
+ EXPECT_EQ(ConstRRef, mpark::visit(get_qual, lib::move(v)));
}
TEST(Visit, ConstVarMutType) {
const mpark::variant<int> v(42);
EXPECT_EQ(42, mpark::get<int>(v));
// Check qualifier.
- EXPECT_EQ(ConstLRef, mpark::visit(get_qual(), v));
- EXPECT_EQ(ConstRRef, mpark::visit(get_qual(), lib::move(v)));
+ EXPECT_EQ(ConstLRef, mpark::visit(get_qual, v));
+ EXPECT_EQ(ConstRRef, mpark::visit(get_qual, lib::move(v)));
-#if !defined(__GNUC__) || __GNUC__ >= 5
+#ifdef MPARK_CPP11_CONSTEXPR
/* constexpr */ {
constexpr mpark::variant<int> cv(42);
static_assert(42 == mpark::get<int>(cv), "");
// Check qualifier.
- static_assert(ConstLRef == mpark::visit(get_qual(), cv), "");
- static_assert(ConstRRef == mpark::visit(get_qual(), lib::move(cv)), "");
+ static_assert(ConstLRef == mpark::visit(get_qual, cv), "");
+ static_assert(ConstRRef == mpark::visit(get_qual, lib::move(cv)), "");
}
#endif
}
@@ -63,16 +57,16 @@ TEST(Visit, ConstVarConstType) {
const mpark::variant<const int> v(42);
EXPECT_EQ(42, mpark::get<const int>(v));
// Check qualifier.
- EXPECT_EQ(ConstLRef, mpark::visit(get_qual(), v));
- EXPECT_EQ(ConstRRef, mpark::visit(get_qual(), lib::move(v)));
+ EXPECT_EQ(ConstLRef, mpark::visit(get_qual, v));
+ EXPECT_EQ(ConstRRef, mpark::visit(get_qual, lib::move(v)));
-#if !defined(__GNUC__) || __GNUC__ >= 5
+#ifdef MPARK_CPP11_CONSTEXPR
/* constexpr */ {
constexpr mpark::variant<const int> cv(42);
static_assert(42 == mpark::get<const int>(cv), "");
// Check qualifier.
- static_assert(ConstLRef == mpark::visit(get_qual(), cv), "");
- static_assert(ConstRRef == mpark::visit(get_qual(), lib::move(cv)), "");
+ static_assert(ConstLRef == mpark::visit(get_qual, cv), "");
+ static_assert(ConstRRef == mpark::visit(get_qual, lib::move(cv)), "");
}
#endif
}
@@ -92,7 +86,7 @@ TEST(Visit_Homogeneous, Double) {
mpark::variant<int, std::string> v("hello"), w("world!");
EXPECT_EQ("helloworld!", mpark::visit(concat{}, v, w));
-#if !defined(__GNUC__) || __GNUC__ >= 5
+#ifdef MPARK_CPP11_CONSTEXPR
/* constexpr */ {
constexpr mpark::variant<int, double> cv(101), cw(202), cx(3.3);
struct add_ints {