removed unused methods(BeginPlay, Tick) and added rider plugin

This commit is contained in:
Caleb Buhungiro
2025-07-05 15:04:21 +08:00
parent a98fd4b2a7
commit 58a7fc2f55
416 changed files with 64917 additions and 16 deletions

View File

@@ -0,0 +1,92 @@
# 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)
cmake_minimum_required(VERSION 3.6.3)
project(MPark.Variant VERSION 1.4.1 LANGUAGES CXX)
# Option.
set(MPARK_VARIANT_INCLUDE_TESTS "" CACHE STRING
"Semicolon-separated list of tests to build. \
Possible values are `mpark`, and `libc++`.")
# Target.
add_library(mpark_variant INTERFACE)
target_include_directories(mpark_variant INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
# Config.
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/mpark_variant-config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/cmake/mpark_variant-config.cmake"
INSTALL_DESTINATION lib/cmake/mpark_variant
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/cmake/mpark_variant-config-version.cmake"
COMPATIBILITY AnyNewerVersion)
# Export.
export(
TARGETS mpark_variant
FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/mpark_variant-targets.cmake")
# Install.
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/mpark
DESTINATION "${CMAKE_INSTALL_PUBLIC_HEADER_THIRDPARTY}"
CONFIGURATIONS Release
FILES_MATCHING
PATTERN *.h
PATTERN *.hpp
)
#[[
install(TARGETS mpark_variant EXPORT mpark_variant)
install(
EXPORT mpark_variant
FILE mpark_variant-targets.cmake
DESTINATION lib/cmake/mpark_variant)
install(DIRECTORY include/mpark DESTINATION include)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/cmake/mpark_variant-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/mpark_variant-config-version.cmake"
DESTINATION lib/cmake/mpark_variant)
]]
# Test.
list(REMOVE_DUPLICATES MPARK_VARIANT_INCLUDE_TESTS)
list(FIND MPARK_VARIANT_INCLUDE_TESTS "mpark" MPARK_VARIANT_INDEX)
if(NOT MPARK_VARIANT_INDEX EQUAL -1)
set(MPARK_VARIANT_INCLUDE_MPARK_TESTS ON)
list(REMOVE_AT MPARK_VARIANT_INCLUDE_TESTS MPARK_VARIANT_INDEX)
endif()
list(FIND MPARK_VARIANT_INCLUDE_TESTS "libc++" MPARK_VARIANT_INDEX)
if(NOT MPARK_VARIANT_INDEX EQUAL -1)
set(MPARK_VARIANT_INCLUDE_LIBCXX_TESTS ON)
list(REMOVE_AT MPARK_VARIANT_INCLUDE_TESTS MPARK_VARIANT_INDEX)
endif()
list(LENGTH MPARK_VARIANT_INCLUDE_TESTS MPARK_VARIANT_LENGTH)
if(MPARK_VARIANT_LENGTH GREATER 0)
message(FATAL_ERROR
"The following values in `MPARK_VARIANT_INCLUDE_TESTS` are not one of "
"the possible values, `mpark`, and `libc++`: ${MPARK_VARIANT_INCLUDE_TESTS}")
endif()
if(MPARK_VARIANT_INCLUDE_MPARK_TESTS OR MPARK_VARIANT_INCLUDE_LIBCXX_TESTS)
enable_testing()
add_subdirectory(test)
endif()

View File

@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,159 @@
# MPark.Variant
> __C++17__ `std::variant` for __C++11__/__14__/__17__
[![release][badge.release]][release]
[![header][badge.header]][header]
[![travis][badge.travis]][travis]
[![appveyor][badge.appveyor]][appveyor]
[![license][badge.license]][license]
[![godbolt][badge.godbolt]][godbolt]
[![wandbox][badge.wandbox]][wandbox]
[badge.release]: https://img.shields.io/github/release/mpark/variant.svg
[badge.header]: https://img.shields.io/badge/single%20header-master-blue.svg
[badge.travis]: https://travis-ci.org/mpark/variant.svg?branch=master
[badge.appveyor]: https://ci.appveyor.com/api/projects/status/github/mpark/variant?branch=master&svg=true
[badge.license]: https://img.shields.io/badge/license-boost-blue.svg
[badge.godbolt]: https://img.shields.io/badge/try%20it-on%20godbolt-222266.svg
[badge.wandbox]: https://img.shields.io/badge/try%20it-on%20wandbox-5cb85c.svg
[release]: https://github.com/mpark/variant/releases/latest
[header]: https://github.com/mpark/variant/blob/single-header/master/variant.hpp
[travis]: https://travis-ci.org/mpark/variant
[appveyor]: https://ci.appveyor.com/project/mpark/variant
[license]: https://github.com/mpark/variant/blob/master/LICENSE.md
[godbolt]: https://godbolt.org/z/4r7hEy
[wandbox]: https://wandbox.org/permlink/dTZxf85MVhehOqx1
## Introduction
__MPark.Variant__ is an implementation of __C++17__ `std::variant` for __C++11__/__14__/__17__.
- Based on [my implementation of `std::variant` for __libc++__][libcxx-impl]
- Continuously tested against __libc++__'s `std::variant` test suite.
[libcxx-impl]: https://reviews.llvm.org/rL288547
## Documentation
- [cppreference.com](http://en.cppreference.com/w/cpp/utility/variant)
- [eel.is/c++draft](http://eel.is/c++draft/variant)
## Integration
### Single Header
The [single-header] branch provides a standalone `variant.hpp`
file for each [release](https://github.com/mpark/variant/releases).
Copy it and `#include` away!
[single-header]: https://github.com/mpark/variant/tree/single-header
### Submodule
You can add `mpark/variant` as a submodule to your project.
```bash
git submodule add https://github.com/mpark/variant.git 3rdparty/variant
```
Add the `include` directory to your include path with
`-I3rdparty/variant/include` then `#include` the `variant.hpp` header
with `#include <mpark/variant.hpp>`.
If you use CMake, you can simply use `add_subdirectory(3rdparty/variant)`:
```cmake
cmake_minimum_required(VERSION 3.6.3)
project(HelloWorld CXX)
add_subdirectory(3rdparty/variant)
add_executable(hello-world hello_world.cpp)
target_link_libraries(hello-world mpark_variant)
```
### Installation / CMake `find_package`
```bash
git clone https://github.com/mpark/variant.git
mkdir variant/build && cd variant/build
cmake ..
cmake --build . --target install
```
This will install `mpark/variant` to the default install-directory for
your platform (`/usr/local` for Unix, `C:\Program Files` for Windows).
You can also install at a custom location via the `CMAKE_INSTALL_PREFIX`
variable, (e.g., `cmake .. -DCMAKE_INSTALL_PREFIX=/opt`).
The installed `mpark/variant` can then be found by CMake via `find_package`:
```cmake
cmake_minimum_required(VERSION 3.6.3)
project(HelloWorld CXX)
find_package(mpark_variant 1.3.0 REQUIRED)
add_executable(hello-world hello_world.cpp)
target_link_libraries(hello-world mpark_variant)
```
CMake will search for `mpark/variant` in its default set of
installation prefixes. If `mpark/variant` is installed in
a custom location via the `CMAKE_INSTALL_PREFIX` variable,
you'll likely need to use the `CMAKE_PREFIX_PATH` to specify
the location (e.g., `cmake .. -DCMAKE_PREFIX_PATH=/opt`).
## Requirements
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 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 8.3 | Darwin Kernel Version 16.7.0 (OS X 10.12.6) | 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.
- Enabling __libc++__ `std::variant` tests require `-std=c++17` support.
## CMake Variables
- __`MPARK_VARIANT_INCLUDE_TESTS`__:`STRING` (__default__: `""`)
Semicolon-separated list of tests to build.
Possible values are `mpark`, and `libc++`.
__NOTE__: The __libc++__ `std::variant` tests are built with `-std=c++17`.
## Unit Tests
Refer to [test/README.md](test/README.md).
## License
Distributed under the [Boost Software License, Version 1.0](LICENSE.md).

View File

@@ -0,0 +1,26 @@
# 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)
# Config file for MPark.Variant
#
# `MPARK_VARIANT_INCLUDE_DIRS` - include directories
# `MPARK_VARIANT_LIBRARIES` - libraries to link against
#
# The following `IMPORTED` target is also defined:
#
# `mpark_variant`
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/mpark_variant-targets.cmake")
get_target_property(
MPARK_VARIANT_INCLUDE_DIRS
mpark_variant INTERFACE_INCLUDE_DIRECTORIES)
set_and_check(MPARK_VARIANT_INCLUDE_DIRS "${MPARK_VARIANT_INCLUDE_DIRS}")
set(MPARK_VARIANT_LIBRARIES mpark_variant)

View File

@@ -0,0 +1,96 @@
// 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)
#ifndef MPARK_CONFIG_HPP
#define MPARK_CONFIG_HPP
// MSVC 2015 Update 3.
#if __cplusplus < 201103L && (!defined(_MSC_VER) || _MSC_FULL_VER < 190024210)
#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
#ifndef __has_include
#define __has_include(x) 0
#endif
#ifndef __has_feature
#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) || defined(__GNUC__)
#define MPARK_BUILTIN_UNREACHABLE __builtin_unreachable()
#elif defined(_MSC_VER)
#define MPARK_BUILTIN_UNREACHABLE __assume(false)
#else
#define MPARK_BUILTIN_UNREACHABLE
#endif
#if __has_builtin(__type_pack_element)
#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
#if __has_feature(cxx_exceptions) || defined(__cpp_exceptions) || \
(defined(_MSC_VER) && defined(_CPPUNWIND))
#define MPARK_EXCEPTIONS
#endif
#if defined(__cpp_generic_lambdas) || defined(_MSC_VER)
#define MPARK_GENERIC_LAMBDAS
#endif
#if defined(__cpp_lib_integer_sequence)
#define MPARK_INTEGER_SEQUENCE
#endif
#if defined(__cpp_return_type_deduction) || defined(_MSC_VER)
#define MPARK_RETURN_TYPE_DEDUCTION
#endif
#if defined(__cpp_lib_transparent_operators) || defined(_MSC_VER)
#define MPARK_TRANSPARENT_OPERATORS
#endif
#if defined(__cpp_variable_templates) || defined(_MSC_VER)
#define MPARK_VARIABLE_TEMPLATES
#endif
#if !defined(__GLIBCXX__) || __has_include(<codecvt>) // >= libstdc++-5
#define MPARK_TRIVIALITY_TYPE_TRAITS
#define MPARK_INCOMPLETE_TYPE_TRAITS
#endif
#endif // MPARK_CONFIG_HPP

View File

@@ -0,0 +1,35 @@
// 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)
#ifndef MPARK_IN_PLACE_HPP
#define MPARK_IN_PLACE_HPP
#include <cstddef>
#include "config.hpp"
namespace mpark {
struct in_place_t { explicit in_place_t() = default; };
template <std::size_t I>
struct in_place_index_t { explicit in_place_index_t() = default; };
template <typename T>
struct in_place_type_t { explicit in_place_type_t() = default; };
#ifdef MPARK_VARIABLE_TEMPLATES
constexpr in_place_t in_place{};
template <std::size_t I> constexpr in_place_index_t<I> in_place_index{};
template <typename T> constexpr in_place_type_t<T> in_place_type{};
#endif
} // namespace mpark
#endif // MPARK_IN_PLACE_HPP

View File

@@ -0,0 +1,499 @@
// 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)
#ifndef MPARK_LIB_HPP
#define MPARK_LIB_HPP
#include <memory>
#include <functional>
#include <type_traits>
#include <utility>
#include "config.hpp"
#define MPARK_RETURN(...) \
noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__) { return __VA_ARGS__; }
namespace mpark {
namespace lib {
template <typename T>
struct identity { using type = T; };
inline namespace cpp14 {
template <typename T, std::size_t N>
struct array {
constexpr const T &operator[](std::size_t index) const {
return data[index];
}
T data[N == 0 ? 1 : N];
};
template <typename T>
using add_pointer_t = typename std::add_pointer<T>::type;
template <typename... Ts>
using common_type_t = typename std::common_type<Ts...>::type;
template <typename T>
using decay_t = typename std::decay<T>::type;
template <bool B, typename T = void>
using enable_if_t = typename std::enable_if<B, T>::type;
template <typename T>
using remove_const_t = typename std::remove_const<T>::type;
template <typename T>
using remove_reference_t = typename std::remove_reference<T>::type;
template <typename T>
inline constexpr T &&forward(remove_reference_t<T> &t) noexcept {
return static_cast<T &&>(t);
}
template <typename T>
inline constexpr T &&forward(remove_reference_t<T> &&t) noexcept {
static_assert(!std::is_lvalue_reference<T>::value,
"can not forward an rvalue as an lvalue");
return static_cast<T &&>(t);
}
template <typename T>
inline constexpr remove_reference_t<T> &&move(T &&t) noexcept {
return static_cast<remove_reference_t<T> &&>(t);
}
#ifdef MPARK_INTEGER_SEQUENCE
using std::integer_sequence;
using std::index_sequence;
using std::make_index_sequence;
using std::index_sequence_for;
#else
template <typename T, T... Is>
struct integer_sequence {
using value_type = T;
static constexpr std::size_t size() noexcept { return sizeof...(Is); }
};
template <std::size_t... Is>
using index_sequence = integer_sequence<std::size_t, Is...>;
template <typename Lhs, typename Rhs>
struct make_index_sequence_concat;
template <std::size_t... Lhs, std::size_t... Rhs>
struct make_index_sequence_concat<index_sequence<Lhs...>,
index_sequence<Rhs...>>
: identity<index_sequence<Lhs..., (sizeof...(Lhs) + Rhs)...>> {};
template <std::size_t N>
struct make_index_sequence_impl;
template <std::size_t N>
using make_index_sequence = typename make_index_sequence_impl<N>::type;
template <std::size_t N>
struct make_index_sequence_impl
: make_index_sequence_concat<make_index_sequence<N / 2>,
make_index_sequence<N - (N / 2)>> {};
template <>
struct make_index_sequence_impl<0> : identity<index_sequence<>> {};
template <>
struct make_index_sequence_impl<1> : identity<index_sequence<0>> {};
template <typename... Ts>
using index_sequence_for = make_index_sequence<sizeof...(Ts)>;
#endif
// <functional>
#ifdef MPARK_TRANSPARENT_OPERATORS
using equal_to = std::equal_to<>;
#else
struct equal_to {
template <typename Lhs, typename Rhs>
inline constexpr auto operator()(Lhs &&lhs, Rhs &&rhs) const
MPARK_RETURN(lib::forward<Lhs>(lhs) == lib::forward<Rhs>(rhs))
};
#endif
#ifdef MPARK_TRANSPARENT_OPERATORS
using not_equal_to = std::not_equal_to<>;
#else
struct not_equal_to {
template <typename Lhs, typename Rhs>
inline constexpr auto operator()(Lhs &&lhs, Rhs &&rhs) const
MPARK_RETURN(lib::forward<Lhs>(lhs) != lib::forward<Rhs>(rhs))
};
#endif
#ifdef MPARK_TRANSPARENT_OPERATORS
using less = std::less<>;
#else
struct less {
template <typename Lhs, typename Rhs>
inline constexpr auto operator()(Lhs &&lhs, Rhs &&rhs) const
MPARK_RETURN(lib::forward<Lhs>(lhs) < lib::forward<Rhs>(rhs))
};
#endif
#ifdef MPARK_TRANSPARENT_OPERATORS
using greater = std::greater<>;
#else
struct greater {
template <typename Lhs, typename Rhs>
inline constexpr auto operator()(Lhs &&lhs, Rhs &&rhs) const
MPARK_RETURN(lib::forward<Lhs>(lhs) > lib::forward<Rhs>(rhs))
};
#endif
#ifdef MPARK_TRANSPARENT_OPERATORS
using less_equal = std::less_equal<>;
#else
struct less_equal {
template <typename Lhs, typename Rhs>
inline constexpr auto operator()(Lhs &&lhs, Rhs &&rhs) const
MPARK_RETURN(lib::forward<Lhs>(lhs) <= lib::forward<Rhs>(rhs))
};
#endif
#ifdef MPARK_TRANSPARENT_OPERATORS
using greater_equal = std::greater_equal<>;
#else
struct greater_equal {
template <typename Lhs, typename Rhs>
inline constexpr auto operator()(Lhs &&lhs, Rhs &&rhs) const
MPARK_RETURN(lib::forward<Lhs>(lhs) >= lib::forward<Rhs>(rhs))
};
#endif
} // namespace cpp14
inline namespace cpp17 {
// <type_traits>
template <bool B>
using bool_constant = std::integral_constant<bool, B>;
template <typename...>
struct voider : identity<void> {};
template <typename... Ts>
using void_t = typename voider<Ts...>::type;
namespace detail {
namespace swappable {
using std::swap;
template <typename T>
struct is_swappable {
private:
template <typename U,
typename = decltype(swap(std::declval<U &>(),
std::declval<U &>()))>
inline static std::true_type test(int);
template <typename U>
inline static std::false_type test(...);
public:
static constexpr bool value = decltype(test<T>(0))::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<false, T> : std::false_type {};
} // namespace swappable
} // namespace detail
using detail::swappable::is_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... 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 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 {
template <typename Void, typename, typename...>
struct invoke_result {};
template <typename F, typename... Args>
struct invoke_result<void_t<decltype(lib::invoke(
std::declval<F>(), std::declval<Args>()...))>,
F,
Args...>
: identity<decltype(
lib::invoke(std::declval<F>(), std::declval<Args>()...))> {};
} // namespace detail
template <typename F, typename... Args>
using invoke_result = detail::invoke_result<void, F, Args...>;
template <typename F, typename... Args>
using invoke_result_t = typename invoke_result<F, Args...>::type;
namespace detail {
template <typename Void, typename, typename...>
struct is_invocable : std::false_type {};
template <typename F, typename... Args>
struct is_invocable<void_t<invoke_result_t<F, Args...>>, F, Args...>
: std::true_type {};
template <typename Void, typename, typename, typename...>
struct is_invocable_r : std::false_type {};
template <typename R, typename F, typename... Args>
struct is_invocable_r<void_t<invoke_result_t<F, Args...>>,
R,
F,
Args...>
: std::is_convertible<invoke_result_t<F, Args...>, R> {};
} // namespace detail
template <typename F, typename... Args>
using is_invocable = detail::is_invocable<void, F, Args...>;
template <typename R, typename F, typename... Args>
using is_invocable_r = detail::is_invocable_r<void, R, F, Args...>;
// <memory>
#ifdef MPARK_BUILTIN_ADDRESSOF
template <typename T>
inline constexpr T *addressof(T &arg) noexcept {
return __builtin_addressof(arg);
}
#else
namespace detail {
namespace has_addressof_impl {
struct fail;
template <typename T>
inline fail operator&(T &&);
template <typename T>
inline static constexpr bool impl() {
return (std::is_class<T>::value || std::is_union<T>::value) &&
!std::is_same<decltype(&std::declval<T &>()), fail>::value;
}
} // namespace has_addressof_impl
template <typename T>
using has_addressof = bool_constant<has_addressof_impl::impl<T>()>;
template <typename T>
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) noexcept {
return &arg;
}
} // namespace detail
template <typename T>
inline constexpr T *addressof(T &arg) noexcept {
return detail::addressof(arg, detail::has_addressof<T>{});
}
#endif
template <typename T>
inline constexpr T *addressof(const T &&) = delete;
} // namespace cpp17
template <typename T>
struct remove_all_extents : identity<T> {};
template <typename T, std::size_t N>
struct remove_all_extents<array<T, N>> : remove_all_extents<T> {};
template <typename T>
using remove_all_extents_t = typename remove_all_extents<T>::type;
template <std::size_t N>
using size_constant = std::integral_constant<std::size_t, N>;
template <std::size_t I, typename T>
struct indexed_type : size_constant<I> { using type = T; };
template <bool... Bs>
using all = std::is_same<integer_sequence<bool, true, Bs...>,
integer_sequence<bool, Bs..., true>>;
#ifdef MPARK_TYPE_PACK_ELEMENT
template <std::size_t I, typename... Ts>
using type_pack_element_t = __type_pack_element<I, Ts...>;
#else
template <std::size_t I, typename... Ts>
struct type_pack_element_impl {
private:
template <typename>
struct set;
template <std::size_t... Is>
struct set<index_sequence<Is...>> : indexed_type<Is, Ts>... {};
template <typename T>
inline static std::enable_if<true, T> impl(indexed_type<I, T>);
inline static std::enable_if<false> impl(...);
public:
using type = decltype(impl(set<index_sequence_for<Ts...>>{}));
};
template <std::size_t I, typename... Ts>
using type_pack_element = typename type_pack_element_impl<I, Ts...>::type;
template <std::size_t I, typename... Ts>
using type_pack_element_t = typename type_pack_element<I, Ts...>::type;
#endif
#ifdef MPARK_TRIVIALITY_TYPE_TRAITS
using std::is_trivially_copy_constructible;
using std::is_trivially_move_constructible;
using std::is_trivially_copy_assignable;
using std::is_trivially_move_assignable;
#else
template <typename T>
struct is_trivially_copy_constructible
: bool_constant<
std::is_copy_constructible<T>::value && __has_trivial_copy(T)> {};
template <typename T>
struct is_trivially_move_constructible : bool_constant<__is_trivial(T)> {};
template <typename T>
struct is_trivially_copy_assignable
: bool_constant<
std::is_copy_assignable<T>::value && __has_trivial_assign(T)> {};
template <typename T>
struct is_trivially_move_assignable : bool_constant<__is_trivial(T)> {};
#endif
template <typename T, bool>
struct dependent_type : T {};
template <typename Is, std::size_t J>
struct push_back;
template <typename Is, std::size_t J>
using push_back_t = typename push_back<Is, J>::type;
template <std::size_t... Is, std::size_t J>
struct push_back<index_sequence<Is...>, J> {
using type = index_sequence<Is..., J>;
};
} // namespace lib
} // namespace mpark
#undef MPARK_RETURN
#endif // MPARK_LIB_HPP

File diff suppressed because it is too large Load Diff