Compare commits
No commits in common. "main" and "svn-tags/RELEASE_30" have entirely different histories.
main
...
svn-tags/R
@ -1,4 +0,0 @@
|
||||
{
|
||||
"project_id" : "libcxx",
|
||||
"conduit_uri" : "http://reviews.llvm.org/"
|
||||
}
|
54
.gitignore
vendored
54
.gitignore
vendored
@ -1,54 +0,0 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
#lib/ # We actually have things checked in to lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
403
CMakeLists.txt
403
CMakeLists.txt
@ -1,403 +0,0 @@
|
||||
# See www/CMake.html for instructions on how to build libcxx with CMake.
|
||||
|
||||
#===============================================================================
|
||||
# Setup Project
|
||||
#===============================================================================
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
if(POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
|
||||
endif()
|
||||
if(POLICY CMP0022)
|
||||
cmake_policy(SET CMP0022 NEW) # Required when interacting with LLVM and Clang
|
||||
endif()
|
||||
|
||||
project(libcxx CXX C)
|
||||
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION trunk-svn)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org")
|
||||
|
||||
# Add path for custom modules
|
||||
set(CMAKE_MODULE_PATH
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
|
||||
${CMAKE_MODULE_PATH}
|
||||
)
|
||||
|
||||
# Require out of source build.
|
||||
include(MacroEnsureOutOfSourceBuild)
|
||||
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
|
||||
"${PROJECT_NAME} requires an out of source build. Please create a separate
|
||||
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
|
||||
)
|
||||
|
||||
# Find the LLVM sources and simulate LLVM CMake options.
|
||||
include(HandleOutOfTreeLLVM)
|
||||
if (LIBCXX_BUILT_STANDALONE AND NOT LLVM_FOUND)
|
||||
message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: "
|
||||
"llvm-config not found and LLVM_PATH not defined.\n"
|
||||
"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
|
||||
"or -DLLVM_PATH=path/to/llvm-source-root.")
|
||||
endif()
|
||||
|
||||
#===============================================================================
|
||||
# Setup CMake Options
|
||||
#===============================================================================
|
||||
|
||||
# Basic options ---------------------------------------------------------------
|
||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
||||
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
||||
|
||||
option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
|
||||
option(LIBCXX_INCLUDE_DOCS "Build the libc++ documentation." ${LLVM_INCLUDE_DOCS})
|
||||
set(LIBCXX_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
|
||||
"Define suffix of library directory name (32/64)")
|
||||
option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
|
||||
option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON)
|
||||
option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
|
||||
set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.")
|
||||
option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
|
||||
|
||||
# ABI Library options ---------------------------------------------------------
|
||||
set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
|
||||
"Specify C++ ABI library to use." FORCE)
|
||||
set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)
|
||||
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
|
||||
|
||||
# Setup the default options if LIBCXX_CXX_ABI is not specified.
|
||||
if (NOT LIBCXX_CXX_ABI)
|
||||
if (NOT DEFINED LIBCXX_BUILT_STANDALONE AND
|
||||
IS_DIRECTORY "${CMAKE_SOURCE_DIR}/projects/libcxxabi")
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
|
||||
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${CMAKE_SOURCE_DIR}/projects/libcxxabi/include")
|
||||
set(LIBCXX_CXX_ABI_INTREE 1)
|
||||
else ()
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "none")
|
||||
endif ()
|
||||
else ()
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}")
|
||||
endif ()
|
||||
|
||||
# Use a static copy of the ABI library when linking libc++. This option
|
||||
# cannot be used with LIBCXX_ENABLE_ABI_LINKER_SCRIPT.
|
||||
option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF)
|
||||
|
||||
# Generate and install a linker script inplace of libc++.so. The linker script
|
||||
# will link libc++ to the correct ABI library. This option is on by default
|
||||
# On UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY'
|
||||
# is on. This option is also disabled when the ABI library is not specified
|
||||
# or is specified to be "none".
|
||||
set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF)
|
||||
if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY
|
||||
AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"
|
||||
AND PYTHONINTERP_FOUND)
|
||||
set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE ON)
|
||||
endif()
|
||||
|
||||
option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT
|
||||
"Use and install a linker script for the given ABI library"
|
||||
${ENABLE_LINKER_SCRIPT_DEFAULT_VALUE})
|
||||
|
||||
# Build libc++abi with libunwind. We need this option to determine whether to
|
||||
# link with libunwind or libgcc_s while running the test cases.
|
||||
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
|
||||
|
||||
# Target options --------------------------------------------------------------
|
||||
option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
|
||||
set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.")
|
||||
set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
|
||||
|
||||
# Feature options -------------------------------------------------------------
|
||||
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
|
||||
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
|
||||
option(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE "Build libc++ with support for the global filesystem namespace." ON)
|
||||
option(LIBCXX_ENABLE_STDIN "Build libc++ with support for stdin/std::cin." ON)
|
||||
option(LIBCXX_ENABLE_STDOUT "Build libc++ with support for stdout/std::cout." ON)
|
||||
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
|
||||
option(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS "Build libc++ with support for thread-unsafe C functions" ON)
|
||||
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
|
||||
"Build libc++ with support for a monotonic clock.
|
||||
This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
|
||||
option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" OFF)
|
||||
|
||||
# Misc options ----------------------------------------------------------------
|
||||
# FIXME: Turn -pedantic back ON. It is currently off because it warns
|
||||
# about #include_next which is used everywhere.
|
||||
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF)
|
||||
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
||||
|
||||
option(LIBCXX_GENERATE_COVERAGE "Enable generating code coverage." OFF)
|
||||
set(LIBCXX_COVERAGE_LIBRARY "" CACHE STRING
|
||||
"The Profile-rt library used to build with code coverage")
|
||||
|
||||
# Don't allow a user to accidentally overwrite the system libc++ installation on Darwin.
|
||||
# If the user specifies -DCMAKE_INSTALL_PREFIX=/usr the install rules for libc++
|
||||
# will not be generated and a warning will be issued.
|
||||
option(LIBCXX_OVERRIDE_DARWIN_INSTALL "Enable overwriting darwins libc++ installation." OFF)
|
||||
mark_as_advanced(LIBCXX_OVERRIDE_DARWIN_INSTALL) # Don't show this option by default.
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT LIBCXX_OVERRIDE_DARWIN_INSTALL)
|
||||
if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
|
||||
message(WARNING "Disabling libc++ install rules because installation would "
|
||||
"overwrite the systems installation. Configure with "
|
||||
"-DLIBCXX_OVERRIDE_DARWIN_INSTALL=ON to suppress this behaviour.")
|
||||
mark_as_advanced(CLEAR LIBCXX_OVERRIDE_DARWIN_INSTALL) # Show the override option.
|
||||
set(LIBCXX_INSTALL_HEADERS OFF)
|
||||
set(LIBCXX_INSTALL_LIBRARY OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(LIBCXX_CONFIGURE_IDE_DEFAULT OFF)
|
||||
if (XCODE OR MSVC_IDE)
|
||||
set(LIBCXX_CONFIGURE_IDE_DEFAULT ON)
|
||||
endif()
|
||||
option(LIBCXX_CONFIGURE_IDE "Configure libcxx for use within an IDE"
|
||||
${LIBCXX_CONFIGURE_IDE_DEFAULT})
|
||||
|
||||
#===============================================================================
|
||||
# Check option configurations
|
||||
#===============================================================================
|
||||
|
||||
# Ensure LIBCXX_ENABLE_MONOTONIC_CLOCK is set to ON only when
|
||||
# LIBCXX_ENABLE_THREADS is on.
|
||||
if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_ENABLE_MONOTONIC_CLOCK)
|
||||
message(FATAL_ERROR "LIBCXX_ENABLE_MONOTONIC_CLOCK can only be set to OFF"
|
||||
" when LIBCXX_ENABLE_THREADS is also set to OFF.")
|
||||
endif()
|
||||
|
||||
# Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE
|
||||
# is ON.
|
||||
if (LLVM_USE_SANITIZER AND LIBCXX_GENERATE_COVERAGE)
|
||||
message(FATAL_ERROR "LLVM_USE_SANITIZER cannot be used with LIBCXX_GENERATE_COVERAGE")
|
||||
endif()
|
||||
|
||||
# Set LIBCXX_BUILD_32_BITS to (LIBCXX_BUILD_32_BITS OR LLVM_BUILD_32_BITS)
|
||||
# and check that we can build with 32 bits if requested.
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
|
||||
if (LIBCXX_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
|
||||
message(STATUS "Building 32 bits executables and libraries.")
|
||||
endif()
|
||||
elseif(LIBCXX_BUILD_32_BITS)
|
||||
message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
|
||||
endif()
|
||||
|
||||
# Check that this option is not enabled on Apple and emit a usage warning.
|
||||
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
|
||||
if (APPLE)
|
||||
message(FATAL_ERROR "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is not supported on OS X")
|
||||
else()
|
||||
message(WARNING "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is an experimental option")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
||||
if (APPLE)
|
||||
message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT cannot be used on APPLE targets")
|
||||
endif()
|
||||
if (NOT PYTHONINTERP_FOUND)
|
||||
message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT requires python but it was not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
||||
message(FATAL_ERROR "Conflicting options given.
|
||||
LIBCXX_ENABLE_STATIC_ABI_LIBRARY cannot be specified with
|
||||
LIBCXX_ENABLE_ABI_LINKER_SCRIPT")
|
||||
endif()
|
||||
|
||||
if (LIBCXX_HAS_MUSL_LIBC AND NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
|
||||
message(FATAL_ERROR "LIBCXX_INSTALL_SUPPORT_HEADERS can not be turned off"
|
||||
"when building for Musl with LIBCXX_HAS_MUSL_LIBC.")
|
||||
endif()
|
||||
|
||||
#===============================================================================
|
||||
# Configure System
|
||||
#===============================================================================
|
||||
|
||||
set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER})
|
||||
set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
|
||||
|
||||
# Declare libc++ configuration variables.
|
||||
# They are intended for use as follows:
|
||||
# LIBCXX_CXX_FLAGS: General flags for both the compiler and linker.
|
||||
# LIBCXX_COMPILE_FLAGS: Compile only flags.
|
||||
# LIBCXX_LINK_FLAGS: Linker only flags.
|
||||
set(LIBCXX_COMPILE_FLAGS "")
|
||||
set(LIBCXX_LINK_FLAGS "")
|
||||
set(LIBCXX_LIBRARIES "")
|
||||
|
||||
# Configure compiler.
|
||||
include(config-ix)
|
||||
|
||||
# Configure coverage options.
|
||||
if (LIBCXX_GENERATE_COVERAGE)
|
||||
include(CodeCoverage)
|
||||
set(CMAKE_BUILD_TYPE "COVERAGE" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Compiler Flags
|
||||
#===============================================================================
|
||||
|
||||
include(HandleLibCXXABI) # Steup the ABI library flags
|
||||
|
||||
# Include macros for adding and removing libc++ flags.
|
||||
include(HandleLibcxxFlags)
|
||||
|
||||
# Remove flags that may have snuck in.
|
||||
remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG
|
||||
-stdlib=libc++ -stdlib=libstdc++ -lc++abi -m32)
|
||||
|
||||
# FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEDANTIC.
|
||||
# Remove the -pedantic flag and -Wno-pedantic and -pedantic-errors
|
||||
# so they don't get transformed into -Wno and -errors respectivly.
|
||||
remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
|
||||
|
||||
# Required flags ==============================================================
|
||||
add_compile_flags_if_supported(-std=c++11)
|
||||
if (NOT MSVC AND NOT LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG)
|
||||
message(FATAL_ERROR "C++11 is required but the compiler does not support -std=c++11")
|
||||
endif()
|
||||
|
||||
# On all systems the system c++ standard library headers need to be excluded.
|
||||
# MSVC only has -X, which disables all default includes; including the crt.
|
||||
# Thus, we do nothing and hope we don't accidentally include any of the C++
|
||||
# headers
|
||||
add_compile_flags_if_supported(-nostdinc++)
|
||||
|
||||
# Target flags ================================================================
|
||||
add_flags_if(LIBCXX_BUILD_32_BITS -m32)
|
||||
add_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
|
||||
add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
|
||||
add_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
|
||||
|
||||
# Warning flags ===============================================================
|
||||
add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
add_compile_flags_if_supported(
|
||||
-Wall -W -Wwrite-strings
|
||||
-Wno-unused-parameter -Wno-long-long
|
||||
-Werror=return-type)
|
||||
if (LIBCXX_ENABLE_WERROR)
|
||||
add_compile_flags_if_supported(-Werror)
|
||||
add_compile_flags_if_supported(-WX)
|
||||
else()
|
||||
# TODO(EricWF) Remove this. We shouldn't be suppressing errors when -Werror is
|
||||
# added elsewhere.
|
||||
add_compile_flags_if_supported(-Wno-error)
|
||||
endif()
|
||||
if (LIBCXX_ENABLE_PEDANTIC)
|
||||
add_compile_flags_if_supported(-pedantic)
|
||||
endif()
|
||||
|
||||
# Exception flags =============================================================
|
||||
if (LIBCXX_ENABLE_EXCEPTIONS)
|
||||
# Catches C++ exceptions only and tells the compiler to assume that extern C
|
||||
# functions never throw a C++ exception.
|
||||
add_compile_flags_if_supported(-EHsc)
|
||||
else()
|
||||
add_definitions(-D_LIBCPP_NO_EXCEPTIONS)
|
||||
add_compile_flags_if_supported(-EHs- -EHa-)
|
||||
add_compile_flags_if_supported(-fno-exceptions)
|
||||
endif()
|
||||
|
||||
# RTTI flags ==================================================================
|
||||
if (NOT LIBCXX_ENABLE_RTTI)
|
||||
add_definitions(-D_LIBCPP_NO_RTTI)
|
||||
add_compile_flags_if_supported(-GR-)
|
||||
add_compile_flags_if_supported(-fno-rtti)
|
||||
endif()
|
||||
|
||||
# Assertion flags =============================================================
|
||||
define_if(LIBCXX_ENABLE_ASSERTIONS -UNDEBUG)
|
||||
define_if_not(LIBCXX_ENABLE_ASSERTIONS -DNDEBUG)
|
||||
if (LIBCXX_ENABLE_ASSERTIONS)
|
||||
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
||||
define_if_not(MSVC -D_DEBUG)
|
||||
endif()
|
||||
|
||||
# Feature flags ===============================================================
|
||||
define_if(MSVC -D_CRT_SECURE_NO_WARNINGS)
|
||||
|
||||
# Sanitizer flags =============================================================
|
||||
|
||||
# Configure for sanitizers. If LIBCXX_BUILT_STANDALONE then we have to do
|
||||
# the flag translation ourselves. Othewise LLVM's CMakeList.txt will handle it.
|
||||
if (LIBCXX_BUILT_STANDALONE)
|
||||
set(LLVM_USE_SANITIZER "" CACHE STRING
|
||||
"Define the sanitizer used to build the library and tests")
|
||||
# NOTE: LLVM_USE_SANITIZER checks for a UNIX like system instead of MSVC.
|
||||
# But we don't have LLVM_ON_UNIX so checking for MSVC is the best we can do.
|
||||
if (LLVM_USE_SANITIZER AND NOT MSVC)
|
||||
add_flags_if_supported("-fno-omit-frame-pointer")
|
||||
add_flags_if_supported("-gline-tables-only")
|
||||
|
||||
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" AND
|
||||
NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
||||
add_flags_if_supported("-gline-tables-only")
|
||||
endif()
|
||||
if (LLVM_USE_SANITIZER STREQUAL "Address")
|
||||
add_flags("-fsanitize=address")
|
||||
elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?")
|
||||
add_flags(-fsanitize=memory)
|
||||
if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins")
|
||||
add_flags("-fsanitize-memory-track-origins")
|
||||
endif()
|
||||
elseif (LLVM_USE_SANITIZER STREQUAL "Undefined")
|
||||
add_flags("-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all")
|
||||
elseif (LLVM_USE_SANITIZER STREQUAL "Thread")
|
||||
add_flags(-fsanitize=thread)
|
||||
else()
|
||||
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
|
||||
endif()
|
||||
elseif(LLVM_USE_SANITIZER AND MSVC)
|
||||
message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Configuration file flags =====================================================
|
||||
if (NOT LIBCXX_ABI_VERSION EQUAL "1")
|
||||
config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
|
||||
endif()
|
||||
config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)
|
||||
|
||||
config_define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE)
|
||||
config_define_if_not(LIBCXX_ENABLE_STDIN _LIBCPP_HAS_NO_STDIN)
|
||||
config_define_if_not(LIBCXX_ENABLE_STDOUT _LIBCPP_HAS_NO_STDOUT)
|
||||
config_define_if_not(LIBCXX_ENABLE_THREADS _LIBCPP_HAS_NO_THREADS)
|
||||
config_define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK _LIBCPP_HAS_NO_MONOTONIC_CLOCK)
|
||||
config_define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS)
|
||||
|
||||
config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
|
||||
|
||||
if (LIBCXX_NEEDS_SITE_CONFIG)
|
||||
configure_file(
|
||||
include/__config_site.in
|
||||
${LIBCXX_BINARY_DIR}/__config_site
|
||||
@ONLY)
|
||||
# Provide the config definitions by included the generated __config_site
|
||||
# file at compile time.
|
||||
add_compile_flags("-include ${LIBCXX_BINARY_DIR}/__config_site")
|
||||
endif()
|
||||
|
||||
#===============================================================================
|
||||
# Setup Source Code And Tests
|
||||
#===============================================================================
|
||||
include_directories(include)
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(lib)
|
||||
|
||||
if (LIBCXX_INCLUDE_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
if (LIBCXX_INCLUDE_DOCS)
|
||||
add_subdirectory(docs)
|
||||
endif()
|
138
CREDITS.TXT
138
CREDITS.TXT
@ -1,138 +0,0 @@
|
||||
This file is a partial list of people who have contributed to the LLVM/libc++
|
||||
project. If you have contributed a patch or made some other contribution to
|
||||
LLVM/libc++, please submit a patch to this file to add yourself, and it will be
|
||||
done!
|
||||
|
||||
The list is sorted by surname and formatted to allow easy grepping and
|
||||
beautification by scripts. The fields are: name (N), email (E), web-address
|
||||
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
|
||||
(S).
|
||||
|
||||
N: Saleem Abdulrasool
|
||||
E: compnerd@compnerd.org
|
||||
D: Minor patches and Linux fixes.
|
||||
|
||||
N: Dan Albert
|
||||
E: danalbert@google.com
|
||||
D: Android support and test runner improvements.
|
||||
|
||||
N: Dimitry Andric
|
||||
E: dimitry@andric.com
|
||||
D: Visibility fixes, minor FreeBSD portability patches.
|
||||
|
||||
N: Holger Arnold
|
||||
E: holgerar@gmail.com
|
||||
D: Minor fix.
|
||||
|
||||
N: Ruben Van Boxem
|
||||
E: vanboxem dot ruben at gmail dot com
|
||||
D: Initial Windows patches.
|
||||
|
||||
N: David Chisnall
|
||||
E: theraven at theravensnest dot org
|
||||
D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
|
||||
|
||||
N: Marshall Clow
|
||||
E: mclow.lists@gmail.com
|
||||
E: marshall@idio.com
|
||||
D: C++14 support, patches and bug fixes.
|
||||
|
||||
N: Eric Fiselier
|
||||
E: eric@efcs.ca
|
||||
D: LFTS support, patches and bug fixes.
|
||||
|
||||
N: Bill Fisher
|
||||
E: william.w.fisher@gmail.com
|
||||
D: Regex bug fixes.
|
||||
|
||||
N: Matthew Dempsky
|
||||
E: matthew@dempsky.org
|
||||
D: Minor patches and bug fixes.
|
||||
|
||||
N: Google Inc.
|
||||
D: Copyright owner and contributor of the CityHash algorithm
|
||||
|
||||
N: Howard Hinnant
|
||||
E: hhinnant@apple.com
|
||||
D: Architect and primary author of libc++
|
||||
|
||||
N: Hyeon-bin Jeong
|
||||
E: tuhertz@gmail.com
|
||||
D: Minor patches and bug fixes.
|
||||
|
||||
N: Argyrios Kyrtzidis
|
||||
E: kyrtzidis@apple.com
|
||||
D: Bug fixes.
|
||||
|
||||
N: Bruce Mitchener, Jr.
|
||||
E: bruce.mitchener@gmail.com
|
||||
D: Emscripten-related changes.
|
||||
|
||||
N: Michel Morin
|
||||
E: mimomorin@gmail.com
|
||||
D: Minor patches to is_convertible.
|
||||
|
||||
N: Andrew Morrow
|
||||
E: andrew.c.morrow@gmail.com
|
||||
D: Minor patches and Linux fixes.
|
||||
|
||||
N: Arvid Picciani
|
||||
E: aep at exys dot org
|
||||
D: Minor patches and musl port.
|
||||
|
||||
N: Bjorn Reese
|
||||
E: breese@users.sourceforge.net
|
||||
D: Initial regex prototype
|
||||
|
||||
N: Nico Rieck
|
||||
E: nico.rieck@gmail.com
|
||||
D: Windows fixes
|
||||
|
||||
N: Jon Roelofs
|
||||
E: jonathan@codesourcery.com
|
||||
D: Remote testing, Newlib port, baremetal/single-threaded support.
|
||||
|
||||
N: Jonathan Sauer
|
||||
D: Minor patches, mostly related to constexpr
|
||||
|
||||
N: Craig Silverstein
|
||||
E: csilvers@google.com
|
||||
D: Implemented Cityhash as the string hash function on 64-bit machines
|
||||
|
||||
N: Richard Smith
|
||||
D: Minor patches.
|
||||
|
||||
N: Joerg Sonnenberger
|
||||
E: joerg@NetBSD.org
|
||||
D: NetBSD port.
|
||||
|
||||
N: Stephan Tolksdorf
|
||||
E: st@quanttec.com
|
||||
D: Minor <atomic> fix
|
||||
|
||||
N: Michael van der Westhuizen
|
||||
E: r1mikey at gmail dot com
|
||||
|
||||
N: Larisse Voufo
|
||||
D: Minor patches.
|
||||
|
||||
N: Klaas de Vries
|
||||
E: klaas at klaasgaaf dot nl
|
||||
D: Minor bug fix.
|
||||
|
||||
N: Zhang Xiongpang
|
||||
E: zhangxiongpang@gmail.com
|
||||
D: Minor patches and bug fixes.
|
||||
|
||||
N: Xing Xue
|
||||
E: xingxue@ca.ibm.com
|
||||
D: AIX port
|
||||
|
||||
N: Zhihao Yuan
|
||||
E: lichray@gmail.com
|
||||
D: Standard compatibility fixes.
|
||||
|
||||
N: Jeffrey Yasskin
|
||||
E: jyasskin@gmail.com
|
||||
E: jyasskin@google.com
|
||||
D: Linux fixes.
|
76
LICENSE.TXT
76
LICENSE.TXT
@ -1,76 +0,0 @@
|
||||
==============================================================================
|
||||
libc++ License
|
||||
==============================================================================
|
||||
|
||||
The libc++ library is dual licensed under both the University of Illinois
|
||||
"BSD-Like" license and the MIT license. As a user of this code you may choose
|
||||
to use it under either license. As a contributor, you agree to allow your code
|
||||
to be used under both.
|
||||
|
||||
Full text of the relevant licenses is included below.
|
||||
|
||||
==============================================================================
|
||||
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
|
||||
LLVM Team
|
||||
|
||||
University of Illinois at Urbana-Champaign
|
||||
|
||||
http://llvm.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the LLVM Team, University of Illinois at
|
||||
Urbana-Champaign, nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this Software without specific
|
||||
prior written permission.
|
||||
|
||||
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 AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
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 AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
56
Makefile
56
Makefile
@ -1,56 +0,0 @@
|
||||
##
|
||||
# libc++ Makefile
|
||||
##
|
||||
|
||||
SRCDIRS = .
|
||||
DESTDIR = $(DSTROOT)
|
||||
|
||||
OBJROOT=.
|
||||
SYMROOT=.
|
||||
export TRIPLE=-apple-
|
||||
|
||||
ifeq (,$(RC_INDIGO))
|
||||
INSTALL_PREFIX=""
|
||||
else
|
||||
INSTALL_PREFIX="$(SDKROOT)"
|
||||
endif
|
||||
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
|
||||
|
||||
.PHONY: help installsrc clean installheaders install
|
||||
|
||||
help::
|
||||
@echo "Use make install DSTROOT=<destination>"
|
||||
|
||||
installsrc:: $(SRCROOT)
|
||||
|
||||
ditto $(SRCDIRS)/include $(SRCROOT)/include
|
||||
ditto $(SRCDIRS)/lib $(SRCROOT)/lib
|
||||
ditto $(SRCDIRS)/src $(SRCROOT)/src
|
||||
ditto $(SRCDIRS)/Makefile $(SRCROOT)/Makefile
|
||||
|
||||
clean::
|
||||
|
||||
# The installheaders target is used by clang's runtime/libcxx makefile.
|
||||
installheaders::
|
||||
mkdir -p $(HEADER_DIR)/c++/v1/ext
|
||||
(cd $(SRCDIRS)/include && \
|
||||
tar cf - --exclude=".*" --exclude=support \
|
||||
--exclude=CMakeLists.txt *) | \
|
||||
(cd $(HEADER_DIR)/c++/v1 && tar xf -)
|
||||
chmod 755 $(HEADER_DIR)/c++/v1
|
||||
chmod 644 $(HEADER_DIR)/c++/v1/*
|
||||
chmod 755 $(HEADER_DIR)/c++/v1/ext
|
||||
chmod 644 $(HEADER_DIR)/c++/v1/ext/*
|
||||
chmod 755 $(HEADER_DIR)/c++/v1/experimental
|
||||
chmod 644 $(HEADER_DIR)/c++/v1/experimental/*
|
||||
|
||||
install::
|
||||
|
||||
cd lib && ./buildit
|
||||
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM \
|
||||
$(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
mkdir -p $(INSTALL_DIR)/usr/lib
|
||||
strip -S -o $(INSTALL_DIR)/usr/lib/libc++.1.dylib \
|
||||
$(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd $(INSTALL_DIR)/usr/lib && ln -s libc++.1.dylib libc++.dylib
|
56
TODO.TXT
56
TODO.TXT
@ -1,56 +0,0 @@
|
||||
This is meant to be a general place to list things that should be done "someday"
|
||||
|
||||
3.8 Release Goals
|
||||
=================
|
||||
* LFTS v1 (EricWF, MClow)
|
||||
* Filesystem TS (EricWF)
|
||||
* ASIO TS (MClow)
|
||||
* <regex> Improvements (MClow)
|
||||
* Setup ABI Versioning policy (EricWF)
|
||||
* Fix PR19302 - Fix UB in list and __tree.
|
||||
|
||||
|
||||
ABI Related Tasks
|
||||
=================
|
||||
* Explicitly manage and verify symbols exported from the dylib.
|
||||
* Explore using namespaces for managing symbol visibility.
|
||||
* Introduce and document ABI versioning/evolution policy.
|
||||
|
||||
CXX Runtime Library Tasks
|
||||
=========================
|
||||
* Cleanup #ifdef hell in sources files that supports the different ABI libraries.
|
||||
* Fix that CMake always link to /usr/lib/libc++abi.dylib on OS X.
|
||||
* Fix selection of ABI symbol list on OS X.
|
||||
* Have CMake generate linker scripts for libc++.so that it properly links the
|
||||
runtime library.
|
||||
* Look into mirroring libsupc++'s typeinfo vtable layout when libsupc++/libstdc++
|
||||
is used as the runtime library.
|
||||
* Audit libraries that CMake links into libc++. Are they all required?
|
||||
* Investigate and document interoperability between libc++ and libstdc++ on
|
||||
linux. Do this for every supported c++ runtime library.
|
||||
|
||||
Atomic Related Tasks
|
||||
====================
|
||||
* Enable mixing of clang and GCC atomics internally. Currently some
|
||||
parts of libc++ use atomics only when clang provides them.
|
||||
(see memory@5380 for an example)
|
||||
* Audit use of libatomic builtins in <atomic> with GCC.
|
||||
* future should use <atomic> for synchronization.
|
||||
|
||||
Test Suite Tasks
|
||||
================
|
||||
* Move all libc++ specific tests from test/std into test/libcxx.
|
||||
* Improve how LIT handles compiler warnings.
|
||||
* Improve the quality and portability of the locale test data.
|
||||
* Convert failure tests to use Clang Verify.
|
||||
|
||||
Misc Tasks
|
||||
==========
|
||||
* Find all sequences of >2 underscores and eradicate them.
|
||||
* run clang-tidy on libc++
|
||||
* Document the "conditionally-supported" bits of libc++
|
||||
* Look at basic_string's move assignment operator, re LWG 2063 and POCMA
|
||||
* libc++ is missing try_emplace
|
||||
* Put a static_assert in std::allocator to deny const/volatile types (LWG 2447)
|
||||
* Document support (or lack of) for C++11 libraries in C++03.
|
||||
* Document supported compilers.
|
@ -1,36 +0,0 @@
|
||||
find_program(CODE_COVERAGE_LCOV lcov)
|
||||
if (NOT CODE_COVERAGE_LCOV)
|
||||
message(FATAL_ERROR "Cannot find lcov...")
|
||||
endif()
|
||||
|
||||
find_program(CODE_COVERAGE_GENHTML genhtml)
|
||||
if (NOT CODE_COVERAGE_GENHTML)
|
||||
message(FATAL_ERROR "Cannot find genhtml...")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage")
|
||||
|
||||
function(setup_lcov_test_target_coverage target_name output_dir capture_dirs source_dirs)
|
||||
file(MAKE_DIRECTORY ${output_dir})
|
||||
|
||||
set(CAPTURE_DIRS "")
|
||||
foreach(cdir ${capture_dirs})
|
||||
list(APPEND CAPTURE_DIRS "-d;${cdir}")
|
||||
endforeach()
|
||||
|
||||
set(EXTRACT_DIRS "")
|
||||
foreach(sdir ${source_dirs})
|
||||
list(APPEND EXTRACT_DIRS "'${sdir}/*'")
|
||||
endforeach()
|
||||
|
||||
message(STATUS "Capture Directories: ${CAPTURE_DIRS}")
|
||||
message(STATUS "Extract Directories: ${EXTRACT_DIRS}")
|
||||
|
||||
add_custom_target(generate-lib${target_name}-coverage
|
||||
COMMAND ${CODE_COVERAGE_LCOV} --capture ${CAPTURE_DIRS} -o test_coverage.info
|
||||
COMMAND ${CODE_COVERAGE_LCOV} --extract test_coverage.info ${EXTRACT_DIRS} -o test_coverage.info
|
||||
COMMAND ${CODE_COVERAGE_GENHTML} --demangle-cpp test_coverage.info -o test_coverage
|
||||
COMMAND ${CMAKE_COMMAND} -E remove test_coverage.info
|
||||
WORKING_DIRECTORY ${output_dir}
|
||||
COMMENT "Generating coverage results")
|
||||
endfunction()
|
@ -1,108 +0,0 @@
|
||||
|
||||
#===============================================================================
|
||||
# Add an ABI library if appropriate
|
||||
#===============================================================================
|
||||
|
||||
#
|
||||
# _setup_abi: Set up the build to use an ABI library
|
||||
#
|
||||
# Parameters:
|
||||
# abidefines: A list of defines needed to compile libc++ with the ABI library
|
||||
# abilib : The ABI library to link against.
|
||||
# abifiles : A list of files (which may be relative paths) to copy into the
|
||||
# libc++ build tree for the build. These files will also be
|
||||
# installed alongside the libc++ headers.
|
||||
# abidirs : A list of relative paths to create under an include directory
|
||||
# in the libc++ build directory.
|
||||
#
|
||||
macro(setup_abi_lib abidefines abilib abifiles abidirs)
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS ${abidefines})
|
||||
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_CXX_ABI_INCLUDE_PATHS}"
|
||||
CACHE PATH
|
||||
"Paths to C++ ABI header directories separated by ';'." FORCE
|
||||
)
|
||||
|
||||
set(LIBCXX_CXX_ABI_LIBRARY ${abilib})
|
||||
|
||||
set(LIBCXX_ABILIB_FILES ${abifiles})
|
||||
|
||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
|
||||
foreach(_d ${abidirs})
|
||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/${_d}")
|
||||
endforeach()
|
||||
|
||||
foreach(fpath ${LIBCXX_ABILIB_FILES})
|
||||
set(found FALSE)
|
||||
foreach(incpath ${LIBCXX_CXX_ABI_INCLUDE_PATHS})
|
||||
if (EXISTS "${incpath}/${fpath}")
|
||||
set(found TRUE)
|
||||
get_filename_component(dstdir ${fpath} PATH)
|
||||
get_filename_component(ifile ${fpath} NAME)
|
||||
file(COPY "${incpath}/${fpath}"
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/include/${dstdir}"
|
||||
)
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/include/${fpath}"
|
||||
DESTINATION include/c++/v1/${dstdir}
|
||||
COMPONENT libcxx
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
endif()
|
||||
list(APPEND abilib_headers "${CMAKE_BINARY_DIR}/include/${fpath}")
|
||||
endif()
|
||||
endforeach()
|
||||
if (NOT found)
|
||||
message(WARNING "Failed to find ${fpath}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_custom_target(LIBCXX_CXX_ABI_DEPS DEPENDS ${abilib_headers})
|
||||
include_directories("${CMAKE_BINARY_DIR}/include")
|
||||
|
||||
endmacro()
|
||||
|
||||
|
||||
# Configure based on the selected ABI library.
|
||||
if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++" OR
|
||||
"${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libsupc++")
|
||||
set(_LIBSUPCXX_INCLUDE_FILES
|
||||
cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h
|
||||
bits/cxxabi_tweaks.h bits/cxxabi_forced.h
|
||||
)
|
||||
if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++")
|
||||
set(_LIBSUPCXX_DEFINES "-DLIBSTDCXX")
|
||||
set(_LIBSUPCXX_LIBNAME stdc++)
|
||||
else()
|
||||
set(_LIBSUPCXX_DEFINES "")
|
||||
set(_LIBSUPCXX_LIBNAME supc++)
|
||||
endif()
|
||||
setup_abi_lib(
|
||||
"-D__GLIBCXX__ ${_LIBSUPCXX_DEFINES}"
|
||||
"${_LIBSUPCXX_LIBNAME}" "${_LIBSUPCXX_INCLUDE_FILES}" "bits"
|
||||
)
|
||||
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
|
||||
if (LIBCXX_CXX_ABI_INTREE)
|
||||
# Link against just-built "cxxabi" target.
|
||||
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
|
||||
set(CXXABI_LIBNAME cxxabi_static)
|
||||
else()
|
||||
set(CXXABI_LIBNAME cxxabi_shared)
|
||||
endif()
|
||||
set(LIBCXX_LIBCPPABI_VERSION "2" PARENT_SCOPE)
|
||||
else()
|
||||
# Assume c++abi is installed in the system, rely on -lc++abi link flag.
|
||||
set(CXXABI_LIBNAME "c++abi")
|
||||
endif()
|
||||
setup_abi_lib("-DLIBCXX_BUILDING_LIBCXXABI"
|
||||
${CXXABI_LIBNAME} "cxxabi.h;__cxxabi_config.h" ""
|
||||
)
|
||||
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
|
||||
setup_abi_lib("-DLIBCXXRT"
|
||||
"cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
|
||||
)
|
||||
elseif (NOT "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "none")
|
||||
message(FATAL_ERROR
|
||||
"Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are "
|
||||
"supported for c++ abi."
|
||||
)
|
||||
endif ()
|
@ -1,169 +0,0 @@
|
||||
# HandleLibcxxFlags - A set of macros used to setup the flags used to compile
|
||||
# and link libc++. These macros add flags to the following CMake variables.
|
||||
# - LIBCXX_COMPILE_FLAGS: flags used to compile libc++
|
||||
# - LIBCXX_LINK_FLAGS: flags used to link libc++
|
||||
# - LIBCXX_LIBRARIES: libraries to link libc++ to.
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
unset(add_flag_if_supported)
|
||||
|
||||
# Mangle the name of a compiler flag into a valid CMake identifier.
|
||||
# Ex: --std=c++11 -> STD_EQ_CXX11
|
||||
macro(mangle_name str output)
|
||||
string(STRIP "${str}" strippedStr)
|
||||
string(REGEX REPLACE "^/" "" strippedStr "${strippedStr}")
|
||||
string(REGEX REPLACE "^-+" "" strippedStr "${strippedStr}")
|
||||
string(REGEX REPLACE "-+$" "" strippedStr "${strippedStr}")
|
||||
string(REPLACE "-" "_" strippedStr "${strippedStr}")
|
||||
string(REPLACE "=" "_EQ_" strippedStr "${strippedStr}")
|
||||
string(REPLACE "+" "X" strippedStr "${strippedStr}")
|
||||
string(TOUPPER "${strippedStr}" ${output})
|
||||
endmacro()
|
||||
|
||||
# Remove a list of flags from all CMake variables that affect compile flags.
|
||||
# This can be used to remove unwanted flags specified on the command line
|
||||
# or added in other parts of LLVM's cmake configuration.
|
||||
macro(remove_flags)
|
||||
foreach(var ${ARGN})
|
||||
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE "${var}" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string(REPLACE "${var}" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||
string(REPLACE "${var}" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
string(REPLACE "${var}" "" CMAKE_SHARED_MODULE_FLAGS "${CMAKE_SHARED_MODULE_FLAGS}")
|
||||
remove_definitions(${var})
|
||||
endforeach()
|
||||
endmacro(remove_flags)
|
||||
|
||||
# Add a macro definition if condition is true.
|
||||
macro(define_if condition def)
|
||||
if (${condition})
|
||||
add_definitions(${def})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Add a macro definition if condition is not true.
|
||||
macro(define_if_not condition def)
|
||||
if (NOT ${condition})
|
||||
add_definitions(${def})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Add a macro definition to the __config_site file if the specified condition
|
||||
# is 'true'. Note that '-D${def}' is not added. Instead it is expected that
|
||||
# the build include the '__config_site' header.
|
||||
macro(config_define_if condition def)
|
||||
if (${condition})
|
||||
set(${def} ON)
|
||||
set(LIBCXX_NEEDS_SITE_CONFIG ON)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(config_define_if_not condition def)
|
||||
if (NOT ${condition})
|
||||
set(${def} ON)
|
||||
set(LIBCXX_NEEDS_SITE_CONFIG ON)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(config_define value def)
|
||||
set(${def} ${value})
|
||||
set(LIBCXX_NEEDS_SITE_CONFIG ON)
|
||||
endmacro()
|
||||
|
||||
# Add a specified list of flags to both 'LIBCXX_COMPILE_FLAGS' and
|
||||
# 'LIBCXX_LINK_FLAGS'.
|
||||
macro(add_flags)
|
||||
foreach(value ${ARGN})
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS ${value})
|
||||
list(APPEND LIBCXX_LINK_FLAGS ${value})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# If the specified 'condition' is true then add a list of flags to both
|
||||
# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
|
||||
macro(add_flags_if condition)
|
||||
if (${condition})
|
||||
add_flags(${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Add each flag in the list to LIBCXX_COMPILE_FLAGS and LIBCXX_LINK_FLAGS
|
||||
# if that flag is supported by the current compiler.
|
||||
macro(add_flags_if_supported)
|
||||
foreach(flag ${ARGN})
|
||||
mangle_name("${flag}" flagname)
|
||||
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
|
||||
add_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Add a list of flags to 'LIBCXX_COMPILE_FLAGS'.
|
||||
macro(add_compile_flags)
|
||||
foreach(f ${ARGN})
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS ${f})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# If 'condition' is true then add the specified list of flags to
|
||||
# 'LIBCXX_COMPILE_FLAGS'
|
||||
macro(add_compile_flags_if condition)
|
||||
if (${condition})
|
||||
add_compile_flags(${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# For each specified flag, add that flag to 'LIBCXX_COMPILE_FLAGS' if the
|
||||
# flag is supported by the C++ compiler.
|
||||
macro(add_compile_flags_if_supported)
|
||||
foreach(flag ${ARGN})
|
||||
mangle_name("${flag}" flagname)
|
||||
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
|
||||
add_compile_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Add a list of flags to 'LIBCXX_LINK_FLAGS'.
|
||||
macro(add_link_flags)
|
||||
foreach(f ${ARGN})
|
||||
list(APPEND LIBCXX_LINK_FLAGS ${f})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# If 'condition' is true then add the specified list of flags to
|
||||
# 'LIBCXX_LINK_FLAGS'
|
||||
macro(add_link_flags_if condition)
|
||||
if (${condition})
|
||||
add_link_flags(${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# For each specified flag, add that flag to 'LIBCXX_LINK_FLAGS' if the
|
||||
# flag is supported by the C++ compiler.
|
||||
macro(add_link_flags_if_supported)
|
||||
foreach(flag ${ARGN})
|
||||
mangle_name("${flag}" flagname)
|
||||
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
|
||||
add_link_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Add a list of libraries or link flags to 'LIBCXX_LIBRARIES'.
|
||||
macro(add_library_flags)
|
||||
foreach(lib ${ARGN})
|
||||
list(APPEND LIBCXX_LIBRARIES ${lib})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# if 'condition' is true then add the specified list of libraries and flags
|
||||
# to 'LIBCXX_LIBRARIES'.
|
||||
macro(add_library_flags_if condition)
|
||||
if(${condition})
|
||||
add_library_flags(${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Turn a comma separated CMake list into a space separated string.
|
||||
macro(split_list listname)
|
||||
string(REPLACE ";" " " ${listname} "${${listname}}")
|
||||
endmacro()
|
@ -1,138 +0,0 @@
|
||||
macro(find_llvm_parts)
|
||||
# Rely on llvm-config.
|
||||
set(CONFIG_OUTPUT)
|
||||
find_program(LLVM_CONFIG "llvm-config")
|
||||
if(DEFINED LLVM_PATH)
|
||||
set(LLVM_INCLUDE_DIR ${LLVM_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
|
||||
set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree")
|
||||
set(LLVM_MAIN_SRC_DIR ${LLVM_PATH})
|
||||
set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules")
|
||||
elseif(LLVM_CONFIG)
|
||||
message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
|
||||
set(CONFIG_COMMAND ${LLVM_CONFIG}
|
||||
"--includedir"
|
||||
"--prefix"
|
||||
"--src-root")
|
||||
execute_process(
|
||||
COMMAND ${CONFIG_COMMAND}
|
||||
RESULT_VARIABLE HAD_ERROR
|
||||
OUTPUT_VARIABLE CONFIG_OUTPUT
|
||||
)
|
||||
if(NOT HAD_ERROR)
|
||||
string(REGEX REPLACE
|
||||
"[ \t]*[\r\n]+[ \t]*" ";"
|
||||
CONFIG_OUTPUT ${CONFIG_OUTPUT})
|
||||
else()
|
||||
string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
|
||||
message(STATUS "${CONFIG_COMMAND_STR}")
|
||||
message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
|
||||
endif()
|
||||
|
||||
list(GET CONFIG_OUTPUT 0 INCLUDE_DIR)
|
||||
list(GET CONFIG_OUTPUT 1 LLVM_OBJ_ROOT)
|
||||
list(GET CONFIG_OUTPUT 2 MAIN_SRC_DIR)
|
||||
|
||||
set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
|
||||
set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
|
||||
set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
|
||||
set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake")
|
||||
else()
|
||||
set(LLVM_FOUND OFF)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (NOT EXISTS ${LLVM_MAIN_SRC_DIR})
|
||||
set(LLVM_FOUND OFF)
|
||||
message(WARNING "Not found: ${LLVM_MAIN_SRC_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${LLVM_CMAKE_PATH})
|
||||
set(LLVM_FOUND OFF)
|
||||
message(WARNING "Not found: ${LLVM_CMAKE_PATH}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
|
||||
list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
|
||||
|
||||
set(LLVM_FOUND ON)
|
||||
endmacro(find_llvm_parts)
|
||||
|
||||
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
set(LIBCXX_BUILT_STANDALONE 1)
|
||||
message(STATUS "Configuring for standalone build.")
|
||||
|
||||
find_llvm_parts()
|
||||
|
||||
# LLVM Options --------------------------------------------------------------
|
||||
include(FindPythonInterp)
|
||||
if( NOT PYTHONINTERP_FOUND )
|
||||
message(WARNING "Failed to find python interpreter. "
|
||||
"The libc++ test suite will be disabled.")
|
||||
set(LLVM_INCLUDE_TESTS OFF)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED LLVM_INCLUDE_TESTS)
|
||||
set(LLVM_INCLUDE_TESTS ${LLVM_FOUND})
|
||||
endif()
|
||||
if (NOT DEFINED LLVM_INCLUDE_DOCS)
|
||||
set(LLVM_INCLUDE_DOCS ${LLVM_FOUND})
|
||||
endif()
|
||||
if (NOT DEFINED LLVM_ENABLE_SPHINX)
|
||||
set(LLVM_ENABLE_SPHINX OFF)
|
||||
endif()
|
||||
|
||||
# Required LIT Configuration ------------------------------------------------
|
||||
# Define the default arguments to use with 'lit', and an option for the user
|
||||
# to override.
|
||||
set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
|
||||
if (MSVC OR XCODE)
|
||||
set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
|
||||
endif()
|
||||
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
|
||||
|
||||
# Make sure we can use the console pool for recent cmake and ninja > 1.5
|
||||
# Needed for add_lit_testsuite
|
||||
if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
|
||||
set(cmake_3_2_USES_TERMINAL)
|
||||
else()
|
||||
set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
|
||||
endif()
|
||||
|
||||
# Required doc configuration
|
||||
if (LLVM_ENABLE_SPHINX)
|
||||
message(STATUS "Sphinx enabled.")
|
||||
find_package(Sphinx REQUIRED)
|
||||
else()
|
||||
message(STATUS "Sphinx disabled.")
|
||||
endif()
|
||||
|
||||
# FIXME - This is cribbed from HandleLLVMOptions.cmake.
|
||||
if(WIN32)
|
||||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
|
||||
if(CYGWIN)
|
||||
set(LLVM_ON_WIN32 0)
|
||||
set(LLVM_ON_UNIX 1)
|
||||
else(CYGWIN)
|
||||
set(LLVM_ON_WIN32 1)
|
||||
set(LLVM_ON_UNIX 0)
|
||||
endif(CYGWIN)
|
||||
else(WIN32)
|
||||
if(UNIX)
|
||||
set(LLVM_ON_WIN32 0)
|
||||
set(LLVM_ON_UNIX 1)
|
||||
if(APPLE)
|
||||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
|
||||
else(APPLE)
|
||||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
|
||||
endif(APPLE)
|
||||
else(UNIX)
|
||||
MESSAGE(SEND_ERROR "Unable to determine platform")
|
||||
endif(UNIX)
|
||||
endif(WIN32)
|
||||
|
||||
# Add LLVM Functions --------------------------------------------------------
|
||||
include(AddLLVM OPTIONAL)
|
||||
endif()
|
@ -1,19 +0,0 @@
|
||||
include(CheckLibraryExists)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
# Check compiler flags
|
||||
|
||||
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
|
||||
check_cxx_compiler_flag(/WX- LIBCXX_HAS_NO_WX_FLAG)
|
||||
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
|
||||
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
|
||||
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
|
||||
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
|
||||
|
||||
|
||||
# Check libraries
|
||||
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
|
||||
check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
|
||||
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
|
||||
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
|
||||
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
@ -1,306 +0,0 @@
|
||||
|
||||
===============
|
||||
Building libc++
|
||||
===============
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Getting Started
|
||||
===============
|
||||
|
||||
On Mac OS 10.7 (Lion) and later, the easiest way to get this library is to install
|
||||
Xcode 4.2 or later. However if you want to install tip-of-trunk from here
|
||||
(getting the bleeding edge), read on.
|
||||
|
||||
The basic steps needed to build libc++ are:
|
||||
|
||||
#. Checkout LLVM:
|
||||
|
||||
* ``cd where-you-want-llvm-to-live``
|
||||
* ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
|
||||
|
||||
#. Checkout libc++:
|
||||
|
||||
* ``cd where-you-want-llvm-to-live``
|
||||
* ``cd llvm/projects``
|
||||
* ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx``
|
||||
|
||||
#. Checkout libc++abi:
|
||||
|
||||
* ``cd where-you-want-llvm-to-live``
|
||||
* ``cd llvm/projects``
|
||||
* ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi``
|
||||
|
||||
#. Configure and build libc++ with libc++abi:
|
||||
|
||||
CMake is the only supported configuration system. Unlike other LLVM
|
||||
projects autotools is not supported for either libc++ or libc++abi.
|
||||
|
||||
Clang is the preferred compiler when building and using libc++.
|
||||
|
||||
* ``cd where you want to build llvm``
|
||||
* ``mkdir build``
|
||||
* ``cd build``
|
||||
* ``cmake -G <generator> [options] <path to llvm sources>``
|
||||
|
||||
For more information about configuring libc++ see :ref:`CMake Options`.
|
||||
|
||||
* ``make cxx`` --- will build libc++ and libc++abi.
|
||||
* ``make check-libcxx check-libcxxabi`` --- will run the test suites.
|
||||
|
||||
Shared libraries for libc++ and libc++ abi should now be present in llvm/build/lib.
|
||||
See :ref:`using an alternate libc++ installation <alternate libcxx>`
|
||||
|
||||
#. **Optional**: Install libc++ and libc++abi
|
||||
|
||||
If your system already provides a libc++ installation it is important to be
|
||||
careful not to replace it. Remember Use the CMake option ``CMAKE_INSTALL_PREFIX`` to
|
||||
select a safe place to install libc++.
|
||||
|
||||
* ``make install-libcxx install-libcxxabi`` --- Will install the libraries and the headers
|
||||
|
||||
.. warning::
|
||||
* Replacing your systems libc++ installation could render the system non-functional.
|
||||
* Mac OS X will not boot without a valid copy of ``libc++.1.dylib`` in ``/usr/lib``.
|
||||
|
||||
|
||||
The instructions are for building libc++ on
|
||||
FreeBSD, Linux, or Mac using `libc++abi`_ as the C++ ABI library.
|
||||
On Linux, it is also possible to use :ref:`libsupc++ <libsupcxx>` or libcxxrt.
|
||||
|
||||
It is sometimes beneficial to build outside of the LLVM tree. An out-of-tree
|
||||
build would look like this:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ cd where-you-want-libcxx-to-live
|
||||
$ # Check out llvm, libc++ and libc++abi.
|
||||
$ ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
|
||||
$ ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx``
|
||||
$ ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi``
|
||||
$ cd where-you-want-to-build
|
||||
$ mkdir build && cd build
|
||||
$ export CC=clang CXX=clang++
|
||||
$ cmake -DLLVM_PATH=path/to/llvm \
|
||||
-DLIBCXX_CXX_ABI=libcxxabi \
|
||||
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=path/to/libcxxabi/include \
|
||||
path/to/libcxx
|
||||
$ make
|
||||
$ make check-libcxx # optional
|
||||
|
||||
|
||||
.. _`libc++abi`: http://libcxxabi.llvm.org/
|
||||
|
||||
|
||||
.. _CMake Options:
|
||||
|
||||
CMake Options
|
||||
=============
|
||||
|
||||
Here are some of the CMake variables that are used often, along with a
|
||||
brief explanation and LLVM-specific notes. For full documentation, check the
|
||||
CMake docs or execute ``cmake --help-variable VARIABLE_NAME``.
|
||||
|
||||
**CMAKE_BUILD_TYPE**:STRING
|
||||
Sets the build type for ``make`` based generators. Possible values are
|
||||
Release, Debug, RelWithDebInfo and MinSizeRel. On systems like Visual Studio
|
||||
the user sets the build type with the IDE settings.
|
||||
|
||||
**CMAKE_INSTALL_PREFIX**:PATH
|
||||
Path where LLVM will be installed if "make install" is invoked or the
|
||||
"INSTALL" target is built.
|
||||
|
||||
**CMAKE_CXX_COMPILER**:STRING
|
||||
The C++ compiler to use when building and testing libc++.
|
||||
|
||||
|
||||
.. _libcxx-specific options:
|
||||
|
||||
libc++ specific options
|
||||
-----------------------
|
||||
|
||||
.. option:: LIBCXX_ENABLE_ASSERTIONS:BOOL
|
||||
|
||||
**Default**: ``ON``
|
||||
|
||||
Build libc++ with assertions enabled.
|
||||
|
||||
.. option:: LIBCXX_BUILD_32_BITS:BOOL
|
||||
|
||||
**Default**: ``OFF``
|
||||
|
||||
Build libc++ as a 32 bit library. Also see :option:`LLVM_BUILD_32_BITS`.
|
||||
|
||||
.. option:: LIBCXX_ENABLE_SHARED:BOOL
|
||||
|
||||
**Default**: ``ON``
|
||||
|
||||
Build libc++ as a shared library. If ``OFF`` is specified then libc++ is
|
||||
built as a static library.
|
||||
|
||||
.. option:: LIBCXX_LIBDIR_SUFFIX:STRING
|
||||
|
||||
Extra suffix to append to the directory where libraries are to be installed.
|
||||
This option overrides :option:`LLVM_LIBDIR_SUFFIX`.
|
||||
|
||||
.. _ABI Library Specific Options:
|
||||
|
||||
ABI Library Specific Options
|
||||
----------------------------
|
||||
|
||||
.. option:: LIBCXX_CXX_ABI:STRING
|
||||
|
||||
**Values**: ``none``, ``libcxxabi``, ``libcxxrt``, ``libstdc++``, ``libsupc++``.
|
||||
|
||||
Select the ABI library to build libc++ against.
|
||||
|
||||
.. option:: LIBCXX_CXX_ABI_INCLUDE_PATHS:PATHS
|
||||
|
||||
Provide additional search paths for the ABI library headers.
|
||||
|
||||
.. option:: LIBCXX_CXX_ABI_LIBRARY_PATH:PATH
|
||||
|
||||
Provide the path to the ABI library that libc++ should link against.
|
||||
|
||||
.. option:: LIBCXX_ENABLE_STATIC_ABI_LIBRARY:BOOL
|
||||
|
||||
**Default**: ``OFF``
|
||||
|
||||
If this option is enabled, libc++ will try and link the selected ABI library
|
||||
statically.
|
||||
|
||||
.. option:: LIBCXX_ENABLE_ABI_LINKER_SCRIPT:BOOL
|
||||
|
||||
**Default**: ``ON`` by default on UNIX platforms other than Apple unless
|
||||
'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' is ON. Otherwise the default value is ``OFF``.
|
||||
|
||||
This option generate and installs a linker script as ``libc++.so`` which
|
||||
links the correct ABI library.
|
||||
|
||||
.. option:: LIBCXXABI_USE_LLVM_UNWINDER:BOOL
|
||||
|
||||
**Default**: ``OFF``
|
||||
|
||||
Build and use the LLVM unwinder. Note: This option can only be used when
|
||||
libc++abi is the C++ ABI library used.
|
||||
|
||||
|
||||
libc++ Feature options
|
||||
----------------------
|
||||
|
||||
.. option:: LIBCXX_ENABLE_EXCEPTIONS:BOOL
|
||||
|
||||
**Default**: ``ON``
|
||||
|
||||
Build libc++ with exception support.
|
||||
|
||||
.. option:: LIBCXX_ENABLE_RTTI:BOOL
|
||||
|
||||
**Default**: ``ON``
|
||||
|
||||
Build libc++ with run time type information.
|
||||
|
||||
|
||||
libc++ Feature options
|
||||
----------------------
|
||||
|
||||
The following options allow building libc++ for a different ABI version.
|
||||
|
||||
.. option:: LIBCXX_ABI_VERSION:STRING
|
||||
|
||||
**Default**: ``1``
|
||||
|
||||
Defines the target ABI version of libc++.
|
||||
|
||||
.. option:: LIBCXX_ABI_UNSTABLE:BOOL
|
||||
|
||||
**Default**: ``OFF``
|
||||
|
||||
Build the "unstable" ABI version of libc++. Includes all ABI changing features
|
||||
on top of the current stable version.
|
||||
|
||||
.. _LLVM-specific variables:
|
||||
|
||||
LLVM-specific options
|
||||
---------------------
|
||||
|
||||
.. option:: LLVM_LIBDIR_SUFFIX:STRING
|
||||
|
||||
Extra suffix to append to the directory where libraries are to be
|
||||
installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
|
||||
to install libraries to ``/usr/lib64``.
|
||||
|
||||
.. option:: LLVM_BUILD_32_BITS:BOOL
|
||||
|
||||
Build 32-bits executables and libraries on 64-bits systems. This option is
|
||||
available only on some 64-bits unix systems. Defaults to OFF.
|
||||
|
||||
.. option:: LLVM_LIT_ARGS:STRING
|
||||
|
||||
Arguments given to lit. ``make check`` and ``make clang-test`` are affected.
|
||||
By default, ``'-sv --no-progress-bar'`` on Visual C++ and Xcode, ``'-sv'`` on
|
||||
others.
|
||||
|
||||
|
||||
Using Alternate ABI libraries
|
||||
=============================
|
||||
|
||||
|
||||
.. _libsupcxx:
|
||||
|
||||
Using libsupc++ on Linux
|
||||
------------------------
|
||||
|
||||
You will need libstdc++ in order to provide libsupc++.
|
||||
|
||||
Figure out where the libsupc++ headers are on your system. On Ubuntu this
|
||||
is ``/usr/include/c++/<version>`` and ``/usr/include/c++/<version>/<target-triple>``
|
||||
|
||||
You can also figure this out by running
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ echo | g++ -Wp,-v -x c++ - -fsyntax-only
|
||||
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
|
||||
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include"
|
||||
#include "..." search starts here:
|
||||
#include <...> search starts here:
|
||||
/usr/include/c++/4.7
|
||||
/usr/include/c++/4.7/x86_64-linux-gnu
|
||||
/usr/include/c++/4.7/backward
|
||||
/usr/lib/gcc/x86_64-linux-gnu/4.7/include
|
||||
/usr/local/include
|
||||
/usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
|
||||
/usr/include/x86_64-linux-gnu
|
||||
/usr/include
|
||||
End of search list.
|
||||
|
||||
Note that the first two entries happen to be what we are looking for. This
|
||||
may not be correct on other platforms.
|
||||
|
||||
We can now run CMake:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ CC=clang CXX=clang++ cmake -G "Unix Makefiles" \
|
||||
-DLIBCXX_CXX_ABI=libstdc++ \
|
||||
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="/usr/include/c++/4.7/;/usr/include/c++/4.7/x86_64-linux-gnu/" \
|
||||
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
<libc++-source-dir>
|
||||
|
||||
|
||||
You can also substitute ``-DLIBCXX_CXX_ABI=libsupc++``
|
||||
above, which will cause the library to be linked to libsupc++ instead
|
||||
of libstdc++, but this is only recommended if you know that you will
|
||||
never need to link against libstdc++ in the same executable as libc++.
|
||||
GCC ships libsupc++ separately but only as a static library. If a
|
||||
program also needs to link against libstdc++, it will provide its
|
||||
own copy of libsupc++ and this can lead to subtle problems.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make cxx
|
||||
$ make install
|
||||
|
||||
You can now run clang with -stdlib=libc++.
|
@ -1,9 +0,0 @@
|
||||
|
||||
if (LLVM_ENABLE_SPHINX)
|
||||
if (SPHINX_FOUND)
|
||||
include(AddSphinxTarget)
|
||||
if (${SPHINX_OUTPUT_HTML})
|
||||
add_sphinx_target(html libcxx)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
@ -1,17 +0,0 @@
|
||||
|
||||
====================
|
||||
Libc++ ABI stability
|
||||
====================
|
||||
|
||||
Libc++ aims to preserve stable ABI to avoid subtle bugs when code built to the old ABI
|
||||
is linked with the code build to the new ABI. At the same time, libc++ allows ABI-breaking
|
||||
improvements and bugfixes for the scenarios when ABI change is not a issue.
|
||||
|
||||
To support both cases, libc++ allows specifying the ABI version at the
|
||||
build time. The version is defined with a cmake option
|
||||
LIBCXX_ABI_VERSION. Another option LIBCXX_ABI_UNSTABLE can be used to
|
||||
include all present ABI breaking features. These options translate
|
||||
into C++ macro definitions _LIBCPP_ABI_VERSION, _LIBCPP_ABI_UNSTABLE.
|
||||
|
||||
Any ABI-changing feature is placed under it's own macro, _LIBCPP_ABI_XXX, which is enabled
|
||||
based on the value of _LIBCPP_ABI_VERSION. _LIBCPP_ABI_UNSTABLE, if set, enables all features at once.
|
@ -1,88 +0,0 @@
|
||||
=======================================================
|
||||
Capturing configuration information during installation
|
||||
=======================================================
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
The Problem
|
||||
===========
|
||||
|
||||
Currently the libc++ supports building the library with a number of different
|
||||
configuration options. Unfortunately all of that configuration information is
|
||||
lost when libc++ is installed. In order to support "persistent"
|
||||
configurations libc++ needs a mechanism to capture the configuration options
|
||||
in the INSTALLED headers.
|
||||
|
||||
|
||||
Design Goals
|
||||
============
|
||||
|
||||
* The solution should not INSTALL any additional headers. We don't want an extra
|
||||
#include slowing everybody down.
|
||||
|
||||
* The solution should not unduly affect libc++ developers. The problem is limited
|
||||
to installed versions of libc++ and the solution should be as well.
|
||||
|
||||
* The solution should not modify any existing headers EXCEPT during installation.
|
||||
It makes developers lives harder if they have to regenerate the libc++ headers
|
||||
every time they are modified.
|
||||
|
||||
* The solution should not make any of the libc++ headers dependant on
|
||||
files generated by the build system. The headers should be able to compile
|
||||
out of the box without any modification.
|
||||
|
||||
* The solution should not have ANY effect on users who don't need special
|
||||
configuration options. The vast majority of users will never need this so it
|
||||
shouldn't cost them.
|
||||
|
||||
|
||||
The Solution
|
||||
============
|
||||
|
||||
When you first configure libc++ using CMake we check to see if we need to
|
||||
capture any options. If we haven't been given any "persistent" options then
|
||||
we do NOTHING.
|
||||
|
||||
Otherwise we create a custom installation rule that modifies the installed __config
|
||||
header. The rule first generates a dummy "__config_site" header containing the required
|
||||
#defines. The contents of the dummy header are then prependend to the installed
|
||||
__config header. By manually prepending the files we avoid the cost of an
|
||||
extra #include and we allow the __config header to be ignorant of the extra
|
||||
configuration all together. An example "__config" header generated when
|
||||
-DLIBCXX_ENABLE_THREADS=OFF is given to CMake would look something like:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CONFIG_SITE
|
||||
#define _LIBCPP_CONFIG_SITE
|
||||
|
||||
/* #undef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE */
|
||||
/* #undef _LIBCPP_HAS_NO_STDIN */
|
||||
/* #undef _LIBCPP_HAS_NO_STDOUT */
|
||||
#define _LIBCPP_HAS_NO_THREADS
|
||||
/* #undef _LIBCPP_HAS_NO_MONOTONIC_CLOCK */
|
||||
/* #undef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS */
|
||||
|
||||
#endif
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- __config ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CONFIG
|
||||
#define _LIBCPP_CONFIG
|
@ -1,37 +0,0 @@
|
||||
# Makefile for Sphinx documentation
|
||||
#
|
||||
# FIXME: This hack is only in place to allow the libcxx.llvm.org/docs builder
|
||||
# to work with libcxx. This should be removed when that builder supports
|
||||
# out-of-tree builds.
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = _build
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext default
|
||||
|
||||
default: html
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
|
||||
clean:
|
||||
-rm -rf $(BUILDDIR)/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@# FIXME: Remove this `cp` once HTML->Sphinx transition is completed.
|
||||
@# Kind of a hack, but HTML-formatted docs are on the way out anyway.
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
@ -1,13 +0,0 @@
|
||||
libc++ Documentation
|
||||
====================
|
||||
|
||||
The libc++ documentation is written using the Sphinx documentation generator. It is
|
||||
currently tested with Sphinx 1.1.3.
|
||||
|
||||
To build the documents into html configure libc++ with the following cmake options:
|
||||
|
||||
* -DLLVM_ENABLE_SPHINX=ON
|
||||
* -DLIBCXX_INCLUDE_DOCS=ON
|
||||
|
||||
After configuring libc++ with these options the make rule `docs-libcxx-html`
|
||||
should be available.
|
@ -1,191 +0,0 @@
|
||||
==============
|
||||
Testing libc++
|
||||
==============
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Getting Started
|
||||
===============
|
||||
|
||||
libc++ uses LIT to configure and run its tests. The primary way to run the
|
||||
libc++ tests is by using make check-libcxx. However since libc++ can be used
|
||||
in any number of possible configurations it is important to customize the way
|
||||
LIT builds and runs the tests. This guide provides information on how to use
|
||||
LIT directly to test libc++.
|
||||
|
||||
Please see the `Lit Command Guide`_ for more information about LIT.
|
||||
|
||||
.. _LIT Command Guide: http://llvm.org/docs/CommandGuide/lit.html
|
||||
|
||||
Setting up the Environment
|
||||
--------------------------
|
||||
|
||||
After building libc++ you must setup your environment to test libc++ using
|
||||
LIT.
|
||||
|
||||
#. Create a shortcut to the actual lit executable so that you can invoke it
|
||||
easily from the command line.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ alias lit='python path/to/llvm/utils/lit/lit.py'
|
||||
|
||||
#. Tell LIT where to find your build configuration.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ export LIBCXX_SITE_CONFIG=path/to/build-libcxx/test/lit.site.cfg
|
||||
|
||||
Example Usage
|
||||
-------------
|
||||
|
||||
Once you have your environment set up and you have built libc++ you can run
|
||||
parts of the libc++ test suite by simply running `lit` on a specified test or
|
||||
directory. For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ cd path/to/src/libcxx
|
||||
$ lit -sv test/std/re # Run all of the std::regex tests
|
||||
$ lit -sv test/std/depr/depr.c.headers/stdlib_h.pass.cpp # Run a single test
|
||||
$ lit -sv test/std/atomics test/std/threads # Test std::thread and std::atomic
|
||||
|
||||
Sometimes you'll want to change the way LIT is running the tests. Custom options
|
||||
can be specified using the `--param=<name>=<val>` flag. The most common option
|
||||
you'll want to change is the standard dialect (ie -std=c++XX). By default the
|
||||
test suite will select the newest C++ dialect supported by the compiler and use
|
||||
that. However if you want to manually specify the option like so:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ lit -sv test/std/containers # Run the tests with the newest -std
|
||||
$ lit -sv --param=std=c++03 test/std/containers # Run the tests in C++03
|
||||
|
||||
Occasionally you'll want to add extra compile or link flags when testing.
|
||||
You can do this as follows:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ lit -sv --param=compile_flags='-Wcustom-warning'
|
||||
$ lit -sv --param=link_flags='-L/custom/library/path'
|
||||
|
||||
Some other common examples include:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Specify a custom compiler.
|
||||
$ lit -sv --param=cxx_under_test=/opt/bin/g++ test/std
|
||||
|
||||
# Enable warnings in the test suite
|
||||
$ lit -sv --param=enable_warnings=true test/std
|
||||
|
||||
# Use UBSAN when running the tests.
|
||||
$ lit -sv --param=use_sanitizer=Undefined
|
||||
|
||||
|
||||
LIT Options
|
||||
===========
|
||||
|
||||
:program:`lit` [*options*...] [*filenames*...]
|
||||
|
||||
Command Line Options
|
||||
--------------------
|
||||
|
||||
To use these options you pass them on the LIT command line as --param NAME or
|
||||
--param NAME=VALUE. Some options have default values specified during CMake's
|
||||
configuration. Passing the option on the command line will override the default.
|
||||
|
||||
.. program:: lit
|
||||
|
||||
.. option:: cxx_under_test=<path/to/compiler>
|
||||
|
||||
Specify the compiler used to build the tests.
|
||||
|
||||
.. option:: std=<standard version>
|
||||
|
||||
**Values**: c++98, c++03, c++11, c++14, c++1z
|
||||
|
||||
Change the standard version used when building the tests.
|
||||
|
||||
.. option:: libcxx_site_config=<path/to/lit.site.cfg>
|
||||
|
||||
Specify the site configuration to use when running the tests. This option
|
||||
overrides the enviroment variable LIBCXX_SITE_CONFIG.
|
||||
|
||||
.. option:: libcxx_headers=<path/to/headers>
|
||||
|
||||
Specify the libc++ headers that are tested. By default the headers in the
|
||||
source tree are used.
|
||||
|
||||
.. option:: libcxx_library=<path/to/libc++.so>
|
||||
|
||||
Specify the libc++ library that is tested. By default the library in the
|
||||
build directory is used. This option cannot be used when use_system_lib is
|
||||
provided.
|
||||
|
||||
.. option:: use_system_lib=<bool>
|
||||
|
||||
**Default**: False
|
||||
|
||||
Enable or disable testing against the installed version of libc++ library.
|
||||
Note: This does not use the installed headers.
|
||||
|
||||
.. option:: use_lit_shell=<bool>
|
||||
|
||||
Enable or disable the use of LIT's internal shell in ShTests. If the
|
||||
environment variable LIT_USE_INTERNAL_SHELL is present then that is used as
|
||||
the default value. Otherwise the default value is True on Windows and False
|
||||
on every other platform.
|
||||
|
||||
.. option:: no_default_flags=<bool>
|
||||
|
||||
**Default**: False
|
||||
|
||||
Disable all default compile and link flags from being added. When this
|
||||
option is used only flags specified using the compile_flags and link_flags
|
||||
will be used.
|
||||
|
||||
.. option:: compile_flags="<list-of-args>"
|
||||
|
||||
Specify additional compile flags as a space delimited string.
|
||||
Note: This options should not be used to change the standard version used.
|
||||
|
||||
.. option:: link_flags="<list-of-args>"
|
||||
|
||||
Specify additional link flags as a space delimited string.
|
||||
|
||||
.. option:: debug_level=<level>
|
||||
|
||||
**Values**: 0, 1
|
||||
|
||||
Enable the use of debug mode. Level 0 enables assertions and level 1 enables
|
||||
assertions and debugging of iterator misuse.
|
||||
|
||||
.. option:: use_sanitizer=<sanitizer name>
|
||||
|
||||
**Values**: Memory, MemoryWithOrigins, Address, Undefined
|
||||
|
||||
Run the tests using the given sanitizer. If LLVM_USE_SANITIZER was given when
|
||||
building libc++ then that sanitizer will be used by default.
|
||||
|
||||
.. option:: color_diagnostics
|
||||
|
||||
Enable the use of colorized compile diagnostics. If the color_diagnostics
|
||||
option is specified or the environment variable LIBCXX_COLOR_DIAGNOSTICS is
|
||||
present then color diagnostics will be enabled.
|
||||
|
||||
|
||||
Environment Variables
|
||||
---------------------
|
||||
|
||||
.. envvar:: LIBCXX_SITE_CONFIG=<path/to/lit.site.cfg>
|
||||
|
||||
Specify the site configuration to use when running the tests.
|
||||
Also see :option:`libcxx_site_config`.
|
||||
|
||||
.. envvar:: LIBCXX_COLOR_DIAGNOSTICS
|
||||
|
||||
If ``LIBCXX_COLOR_DIAGNOSTICS`` is defined then the test suite will attempt
|
||||
to use color diagnostic outputs from the compiler.
|
||||
Also see :option:`color_diagnostics`.
|
@ -1,89 +0,0 @@
|
||||
============
|
||||
Using libc++
|
||||
============
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Getting Started
|
||||
===============
|
||||
|
||||
If you already have libc++ installed you can use it with clang.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ clang++ -stdlib=libc++ test.cpp
|
||||
$ clang++ -std=c++11 -stdlib=libc++ test.cpp
|
||||
|
||||
On OS X and FreeBSD libc++ is the default standard library
|
||||
and the ``-stdlib=libc++`` is not required.
|
||||
|
||||
.. _alternate libcxx:
|
||||
|
||||
If you want to select an alternate installation of libc++ you
|
||||
can use the following options.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ clang++ -std=c++11 -stdlib=libc++ -nostdinc++ \
|
||||
-I<libcxx-install-prefix>/include/c++/v1 \
|
||||
-L<libcxx-install-prefix>/lib \
|
||||
-Wl,-rpath,<libcxx-install-prefix>/lib \
|
||||
test.cpp
|
||||
|
||||
The option ``-Wl,-rpath,<libcxx-install-prefix>/lib`` adds a runtime library
|
||||
search path. Meaning that the systems dynamic linker will look for libc++ in
|
||||
``<libcxx-install-prefix>/lib`` whenever the program is run. Alternatively the
|
||||
environment variable ``LD_LIBRARY_PATH`` (``DYLD_LIBRARY_PATH`` on OS X) can
|
||||
be used to change the dynamic linkers search paths after a program is compiled.
|
||||
|
||||
An example of using ``LD_LIBRARY_PATH``:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ clang++ -stdlib=libc++ -nostdinc++ \
|
||||
-I<libcxx-install-prefix>/include/c++/v1
|
||||
-L<libcxx-install-prefix>/lib \
|
||||
test.cpp -o
|
||||
$ ./a.out # Searches for libc++ in the systems library paths.
|
||||
$ export LD_LIBRARY_PATH=<libcxx-install-prefix>/lib
|
||||
$ ./a.out # Searches for libc++ along LD_LIBRARY_PATH
|
||||
|
||||
|
||||
|
||||
Using libc++ on Linux
|
||||
=====================
|
||||
|
||||
On Linux libc++ can typically be used with only '-stdlib=libc++'. However
|
||||
some libc++ installations require the user manually link libc++abi themselves.
|
||||
If you are running into linker errors when using libc++ try adding '-lc++abi'
|
||||
to the link line. For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ clang++ -stdlib=libc++ test.cpp -lc++ -lc++abi -lm -lc -lgcc_s -lgcc
|
||||
|
||||
Alternately, you could just add libc++abi to your libraries list, which in
|
||||
most situations will give the same result:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ clang++ -stdlib=libc++ test.cpp -lc++abi
|
||||
|
||||
|
||||
Using libc++ with GCC
|
||||
---------------------
|
||||
|
||||
GCC does not provide a way to switch from libstdc++ to libc++. You must manually
|
||||
configure the compile and link commands.
|
||||
|
||||
In particular you must tell GCC to remove the libstdc++ include directories
|
||||
using ``-nostdinc++`` and to not link libstdc++.so using ``-nodefaultlibs``.
|
||||
|
||||
Note that ``-nodefaultlibs`` removes all of the standard system libraries and
|
||||
not just libstdc++ so they must be manually linked. For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ g++ -nostdinc++ -I<libcxx-install-prefix>/include/c++/v1 \
|
||||
test.cpp -nodefaultlibs -lc++ -lc++abi -lm -lc -lgcc_s -lgcc
|
251
docs/conf.py
251
docs/conf.py
@ -1,251 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# libc++ documentation build configuration file.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys, os
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo']
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'libc++'
|
||||
copyright = u'2011-2015, LLVM Project'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '3.8'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '3.8'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
today_fmt = '%Y-%m-%d'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
show_authors = True
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'friendly'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
|
||||
# -- Options for HTML output ---------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme = 'haiku'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = []
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'libcxxdoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output --------------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('contents', 'libcxx.tex', u'libcxx Documentation',
|
||||
u'LLVM project', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output --------------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('contents', 'libc++', u'libc++ Documentation',
|
||||
[u'LLVM project'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output ------------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('contents', 'libc++', u'libc++ Documentation',
|
||||
u'LLVM project', 'libc++', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
|
||||
|
||||
# FIXME: Define intersphinx configration.
|
||||
intersphinx_mapping = {}
|
||||
|
||||
|
||||
# -- Options for extensions ----------------------------------------------------
|
||||
|
||||
# Enable this if you want TODOs to show up in the generated documentation.
|
||||
todo_include_todos = True
|
185
docs/index.rst
185
docs/index.rst
@ -1,185 +0,0 @@
|
||||
.. _index:
|
||||
|
||||
=============================
|
||||
"libc++" C++ Standard Library
|
||||
=============================
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
libc++ is a new implementation of the C++ standard library, targeting C++11.
|
||||
|
||||
* Features and Goals
|
||||
|
||||
* Correctness as defined by the C++11 standard.
|
||||
* Fast execution.
|
||||
* Minimal memory use.
|
||||
* Fast compile times.
|
||||
* ABI compatibility with gcc's libstdc++ for some low-level features
|
||||
such as exception objects, rtti and memory allocation.
|
||||
* Extensive unit tests.
|
||||
|
||||
* Design and Implementation:
|
||||
|
||||
* Extensive unit tests
|
||||
* Internal linker model can be dumped/read to textual format
|
||||
* Additional linking features can be plugged in as "passes"
|
||||
* OS specific and CPU specific code factored out
|
||||
|
||||
|
||||
Getting Started with libc++
|
||||
---------------------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
UsingLibcxx
|
||||
BuildingLibcxx
|
||||
TestingLibcxx
|
||||
|
||||
|
||||
Current Status
|
||||
--------------
|
||||
|
||||
After its initial introduction, many people have asked "why start a new
|
||||
library instead of contributing to an existing library?" (like Apache's
|
||||
libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing
|
||||
reasons, but some of the major ones are:
|
||||
|
||||
* From years of experience (including having implemented the standard
|
||||
library before), we've learned many things about implementing
|
||||
the standard containers which require ABI breakage and fundamental changes
|
||||
to how they are implemented. For example, it is generally accepted that
|
||||
building std::string using the "short string optimization" instead of
|
||||
using Copy On Write (COW) is a superior approach for multicore
|
||||
machines (particularly in C++11, which has rvalue references). Breaking
|
||||
ABI compatibility with old versions of the library was
|
||||
determined to be critical to achieving the performance goals of
|
||||
libc++.
|
||||
|
||||
* Mainline libstdc++ has switched to GPL3, a license which the developers
|
||||
of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be
|
||||
independently extended to support C++11, but this would be a fork of the
|
||||
codebase (which is often seen as worse for a project than starting a new
|
||||
independent one). Another problem with libstdc++ is that it is tightly
|
||||
integrated with G++ development, tending to be tied fairly closely to the
|
||||
matching version of G++.
|
||||
|
||||
* STLport and the Apache libstdcxx library are two other popular
|
||||
candidates, but both lack C++11 support. Our experience (and the
|
||||
experience of libstdc++ developers) is that adding support for C++11 (in
|
||||
particular rvalue references and move-only types) requires changes to
|
||||
almost every class and function, essentially amounting to a rewrite.
|
||||
Faced with a rewrite, we decided to start from scratch and evaluate every
|
||||
design decision from first principles based on experience.
|
||||
Further, both projects are apparently abandoned: STLport 5.2.1 was
|
||||
released in Oct'08, and STDCXX 4.2.1 in May'08.
|
||||
|
||||
Platform and Compiler Support
|
||||
-----------------------------
|
||||
|
||||
libc++ is known to work on the following platforms, using gcc-4.2 and
|
||||
clang (lack of C++11 language support disables some functionality).
|
||||
Note that functionality provided by ``<atomic>`` is only functional with clang
|
||||
and GCC.
|
||||
|
||||
============ ==================== ============ ========================
|
||||
OS Arch Compilers ABI Library
|
||||
============ ==================== ============ ========================
|
||||
Mac OS X i386, x86_64 Clang, GCC libc++abi
|
||||
FreeBSD 10+ i386, x86_64, ARM Clang, GCC libcxxrt, libc++abi
|
||||
Linux i386, x86_64 Clang, GCC libc++abi
|
||||
============ ==================== ============ ========================
|
||||
|
||||
The following minimum compiler versions are strongly recommended.
|
||||
|
||||
* Clang 3.5 and above
|
||||
* GCC 4.7 and above.
|
||||
|
||||
Anything older *may* work.
|
||||
|
||||
C++ Dialect Support
|
||||
---------------------
|
||||
|
||||
* C++11 - Complete
|
||||
* `C++14 - Complete <http://libcxx.llvm.org/cxx1y_status.html>`__
|
||||
* `C++1z - In Progress <http://libcxx.llvm.org/cxx1z_status.html>`__
|
||||
* `Post C++14 Technical Specifications - In Progress <http://libcxx.llvm.org/ts1z_status.html>`__
|
||||
|
||||
Notes and Known Issues
|
||||
----------------------
|
||||
|
||||
This list contains known issues with libc++
|
||||
|
||||
* Building libc++ with ``-fno-rtti`` is not supported. However
|
||||
linking against it with ``-fno-rtti`` is supported.
|
||||
* On OS X v10.8 and older the CMake option ``-DLIBCXX_LIBCPPABI_VERSION=""``
|
||||
must be used during configuration.
|
||||
|
||||
|
||||
A full list of currently open libc++ bugs can be `found here`__.
|
||||
|
||||
.. __: https://llvm.org/bugs/buglist.cgi?component=All%20Bugs&product=libc%2B%2B&query_format=advanced&resolution=---&order=changeddate%20DESC%2Cassigned_to%20DESC%2Cbug_status%2Cpriority%2Cbug_id&list_id=74184
|
||||
|
||||
Design Documents
|
||||
----------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
DesignDocs/CapturingConfigInfo
|
||||
DesignDocs/ABIVersioning
|
||||
|
||||
|
||||
* `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_
|
||||
* `<type_traits> design <http://libcxx.llvm.org/type_traits_design.html>`_
|
||||
* `Status of debug mode <http://libcxx.llvm.org/debug_mode.html>`_
|
||||
* `Notes by Marshall Clow`__
|
||||
|
||||
.. __: https://cplusplusmusings.wordpress.com/2012/07/05/clang-and-standard-libraries-on-mac-os-x/
|
||||
|
||||
Build Bots and Test Coverage
|
||||
----------------------------
|
||||
|
||||
* `LLVM Buildbot Builders <http://lab.llvm.org:8011/console>`_
|
||||
* `Apple Jenkins Builders <http://lab.llvm.org:8080/green/view/Libcxx/>`_
|
||||
* `EricWF's Nightly Builders <http://ds2.efcs.ca:8080/console>`_
|
||||
* `Code Coverage Results <http://efcs.ca/libcxx-coverage>`_
|
||||
|
||||
Getting Involved
|
||||
================
|
||||
|
||||
First please review our `Developer's Policy <http://llvm.org/docs/DeveloperPolicy.html>`__
|
||||
and `Getting started with LLVM <http://llvm.org/docs/GettingStarted.html>`__.
|
||||
|
||||
**Bug Reports**
|
||||
|
||||
If you think you've found a bug in libc++, please report it using
|
||||
the `LLVM Bugzilla`_. If you're not sure, you
|
||||
can post a message to the `cfe-dev mailing list`_ or on IRC.
|
||||
Please include "libc++" in your subject.
|
||||
|
||||
**Patches**
|
||||
|
||||
If you want to contribute a patch to libc++, the best place for that is
|
||||
`Phabricator <http://llvm.org/docs/Phabricator.html>`_. Please include [libcxx] in the subject and
|
||||
add `cfe-commits` as a subscriber. Also make sure you are subscribed to the
|
||||
`cfe-commits mailing list <http://lists.llvm.org/mailman/listinfo/cfe-commits>`_.
|
||||
|
||||
**Discussion and Questions**
|
||||
|
||||
Send discussions and questions to the
|
||||
`cfe-dev mailing list <http://lists.llvm.org/mailman/listinfo/cfe-dev>`_.
|
||||
Please include [libcxx] in the subject.
|
||||
|
||||
|
||||
|
||||
Quick Links
|
||||
===========
|
||||
* `LLVM Homepage <http://llvm.org/>`_
|
||||
* `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
|
||||
* `LLVM Bugzilla <http://llvm.org/bugs/>`_
|
||||
* `cfe-commits Mailing List`_
|
||||
* `cfe-dev Mailing List`_
|
||||
* `Browse libc++ -- SVN <http://llvm.org/svn/llvm-project/libcxx/trunk/>`_
|
||||
* `Browse libc++ -- ViewVC <http://llvm.org/viewvc/llvm-project/libcxx/trunk/>`_
|
159
final/CMakeLists.txt
Normal file
159
final/CMakeLists.txt
Normal file
@ -0,0 +1,159 @@
|
||||
# See www/CMake.html for instructions on how to build libcxx with CMake.
|
||||
|
||||
#===============================================================================
|
||||
# Setup Project
|
||||
#===============================================================================
|
||||
|
||||
project(libcxx CXX C)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION trunk-svn)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
|
||||
|
||||
# Add path for custom modules
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_MODULE_PATH}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
|
||||
)
|
||||
|
||||
# Require out of source build.
|
||||
include(MacroEnsureOutOfSourceBuild)
|
||||
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
|
||||
"${PROJECT_NAME} requires an out of source build. Please create a separate
|
||||
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
# Setup CMake Options
|
||||
#===============================================================================
|
||||
|
||||
# Define options.
|
||||
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
|
||||
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
|
||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
||||
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
|
||||
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
||||
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
|
||||
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
||||
|
||||
#===============================================================================
|
||||
# Configure System
|
||||
#===============================================================================
|
||||
|
||||
# Get triples.
|
||||
include(GetTriple)
|
||||
get_host_triple(LIBCXX_HOST_TRIPLE
|
||||
LIBCXX_HOST_ARCH
|
||||
LIBCXX_HOST_VENDOR
|
||||
LIBCXX_HOST_OS
|
||||
)
|
||||
set(LIBCXX_HOST_TRIPLE ${LIBCXX_HOST_TRIPLE} CACHE STRING "Host triple.")
|
||||
get_target_triple(LIBCXX_TARGET_TRIPLE
|
||||
LIBCXX_TARGET_ARCH
|
||||
LIBCXX_TARGET_VENDOR
|
||||
LIBCXX_TARGET_OS
|
||||
)
|
||||
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
|
||||
|
||||
# Configure compiler.
|
||||
include(config-ix)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Compiler Flags
|
||||
#===============================================================================
|
||||
|
||||
# Get required flags.
|
||||
# On all systems the system c++ standard library headers need to be excluded.
|
||||
if (MSVC)
|
||||
# MSVC only has -X, which disables all default includes; including the crt.
|
||||
# Thus, we do nothing and hope we don't accidentally include any of the C++
|
||||
# headers.
|
||||
else()
|
||||
if (LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||
set(LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++)
|
||||
endif()
|
||||
if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro(append_if list condition var)
|
||||
if (${condition})
|
||||
list(APPEND ${list} ${var})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Get warning flags
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
|
||||
if (LIBCXX_ENABLE_WERROR)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
|
||||
endif()
|
||||
if (LIBCXX_ENABLE_PEDANTIC)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
||||
endif()
|
||||
|
||||
# Get feature flags.
|
||||
# Exceptions
|
||||
if (LIBCXX_ENABLE_EXCEPTIONS)
|
||||
# Catches C++ exceptions only and tells the compiler to assume that extern C
|
||||
# functions never throw a C++ exception.
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
|
||||
else()
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
|
||||
endif()
|
||||
# RTTI
|
||||
if (NOT LIBCXX_ENABLE_RTTI)
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_RTTI)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
|
||||
endif()
|
||||
# Assert
|
||||
if (LLVM_ENABLE_ASSERTIONS)
|
||||
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
||||
if (NOT MSVC)
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
|
||||
endif()
|
||||
# On Release builds cmake automatically defines NDEBUG, so we
|
||||
# explicitly undefine it:
|
||||
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -UNDEBUG)
|
||||
endif()
|
||||
else()
|
||||
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# This is the _ONLY_ place where add_definitions is called.
|
||||
add_definitions(
|
||||
${LIBCXX_CXX_REQUIRED_FLAGS}
|
||||
${LIBCXX_CXX_WARNING_FLAGS}
|
||||
${LIBCXX_CXX_FEATURE_FLAGS}
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Source Code
|
||||
#===============================================================================
|
||||
|
||||
include_directories(include)
|
||||
|
||||
# Add source code. This also contains all of the logic for deciding linker flags
|
||||
# soname, etc...
|
||||
add_subdirectory(lib)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Tests
|
||||
#===============================================================================
|
||||
|
||||
add_subdirectory(test)
|
34
final/CREDITS.TXT
Normal file
34
final/CREDITS.TXT
Normal file
@ -0,0 +1,34 @@
|
||||
This file is a partial list of people who have contributed to the LLVM/libc++
|
||||
project. If you have contributed a patch or made some other contribution to
|
||||
LLVM/libc++, please submit a patch to this file to add yourself, and it will be
|
||||
done!
|
||||
|
||||
The list is sorted by surname and formatted to allow easy grepping and
|
||||
beautification by scripts. The fields are: name (N), email (E), web-address
|
||||
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
|
||||
(S).
|
||||
|
||||
N: Howard Hinnant
|
||||
E: hhinnant@apple.com
|
||||
D: Architect and primary author of libc++
|
||||
|
||||
N: Marshall Clow
|
||||
E: marshall@idio.com
|
||||
E: mclow@qualcomm.com
|
||||
D: Minor patches and bug fixes.
|
||||
|
||||
N: Bjorn Reese
|
||||
E: breese@users.sourceforge.net
|
||||
D: Initial regex prototype
|
||||
|
||||
N: David Chisnall
|
||||
E: theraven at theravensnest dot org
|
||||
D: FreeBSD port and libcxxrt support.
|
||||
|
||||
N: Ruben Van Boxem
|
||||
E: vanboxem dot ruben at gmail dot com
|
||||
D: Initial Windows patches.
|
||||
|
||||
N: Arvid Picciani
|
||||
E: aep at exys dot org
|
||||
D: Minor patches and musl port.
|
76
final/LICENSE.TXT
Normal file
76
final/LICENSE.TXT
Normal file
@ -0,0 +1,76 @@
|
||||
==============================================================================
|
||||
libc++ License
|
||||
==============================================================================
|
||||
|
||||
The libc++ library is dual licensed under both the University of Illinois
|
||||
"BSD-Like" license and the MIT license. As a user of this code you may choose
|
||||
to use it under either license. As a contributor, you agree to allow your code
|
||||
to be used under both.
|
||||
|
||||
Full text of the relevant licenses is included below.
|
||||
|
||||
==============================================================================
|
||||
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
|
||||
LLVM Team
|
||||
|
||||
University of Illinois at Urbana-Champaign
|
||||
|
||||
http://llvm.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the LLVM Team, University of Illinois at
|
||||
Urbana-Champaign, nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this Software without specific
|
||||
prior written permission.
|
||||
|
||||
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 AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
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 AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
68
final/Makefile
Normal file
68
final/Makefile
Normal file
@ -0,0 +1,68 @@
|
||||
##
|
||||
# libcpp Makefile
|
||||
##
|
||||
|
||||
SRCDIRS = .
|
||||
DESTDIR = $(DSTROOT)
|
||||
|
||||
OBJROOT=.
|
||||
SYMROOT=.
|
||||
export TRIPLE=-apple-
|
||||
|
||||
ifeq (,$(RC_INDIGO))
|
||||
INSTALL_PREFIX=""
|
||||
else
|
||||
INSTALL_PREFIX="$(SDKROOT)"
|
||||
endif
|
||||
|
||||
help::
|
||||
echo Use make install DSTROOT=<destination>
|
||||
|
||||
installsrc:: $(SRCROOT)
|
||||
|
||||
ditto $(SRCDIRS)/include $(SRCROOT)/include
|
||||
ditto $(SRCDIRS)/lib $(SRCROOT)/lib
|
||||
ditto $(SRCDIRS)/src $(SRCROOT)/src
|
||||
ditto $(SRCDIRS)/Makefile $(SRCROOT)/Makefile
|
||||
|
||||
clean::
|
||||
|
||||
installhdrs::
|
||||
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/*
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext/*
|
||||
|
||||
install:: installhdrs $(DESTDIR)
|
||||
|
||||
cd lib && ./buildit
|
||||
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib
|
||||
strip -S -o $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib && ln -s libc++.1.dylib libc++.dylib
|
53
final/cmake/Modules/GetTriple.cmake
Normal file
53
final/cmake/Modules/GetTriple.cmake
Normal file
@ -0,0 +1,53 @@
|
||||
# Define functions to get the host and target triple.
|
||||
|
||||
function(get_host_triple out out_arch out_vendor out_os)
|
||||
# Get the architecture.
|
||||
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
||||
if (arch STREQUAL "x86")
|
||||
set(arch "i686")
|
||||
endif()
|
||||
# Get the vendor.
|
||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set(vendor "apple")
|
||||
else()
|
||||
set(vendor "pc")
|
||||
endif()
|
||||
# Get os.
|
||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(os "win32")
|
||||
else()
|
||||
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} os)
|
||||
endif()
|
||||
set(triple "${arch}-${vendor}-${os}")
|
||||
set(${out} ${triple} PARENT_SCOPE)
|
||||
set(${out_arch} ${arch} PARENT_SCOPE)
|
||||
set(${out_vendor} ${vendor} PARENT_SCOPE)
|
||||
set(${out_os} ${os} PARENT_SCOPE)
|
||||
message(STATUS "Host triple: ${triple}")
|
||||
endfunction()
|
||||
|
||||
function(get_target_triple out out_arch out_vendor out_os)
|
||||
# Get the architecture.
|
||||
set(arch ${CMAKE_SYSTEM_PROCESSOR})
|
||||
if (arch STREQUAL "x86")
|
||||
set(arch "i686")
|
||||
endif()
|
||||
# Get the vendor.
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set(vendor "apple")
|
||||
else()
|
||||
set(vendor "pc")
|
||||
endif()
|
||||
# Get os.
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(os "win32")
|
||||
else()
|
||||
string(TOLOWER ${CMAKE_SYSTEM_NAME} os)
|
||||
endif()
|
||||
set(triple "${arch}-${vendor}-${os}")
|
||||
set(${out} ${triple} PARENT_SCOPE)
|
||||
set(${out_arch} ${arch} PARENT_SCOPE)
|
||||
set(${out_vendor} ${vendor} PARENT_SCOPE)
|
||||
set(${out_os} ${os} PARENT_SCOPE)
|
||||
message(STATUS "Target triple: ${triple}")
|
||||
endfunction()
|
38
final/cmake/config-ix.cmake
Normal file
38
final/cmake/config-ix.cmake
Normal file
@ -0,0 +1,38 @@
|
||||
include(CheckLibraryExists)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
# Check compiler flags
|
||||
check_cxx_compiler_flag(-std=c++0x LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG)
|
||||
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG)
|
||||
check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||
check_cxx_compiler_flag(-Wall LIBCXX_HAS_WALL_FLAG)
|
||||
check_cxx_compiler_flag(-W LIBCXX_HAS_W_FLAG)
|
||||
check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
|
||||
check_cxx_compiler_flag(-Wwrite-strings LIBCXX_HAS_WWRITE_STRINGS_FLAG)
|
||||
check_cxx_compiler_flag(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG)
|
||||
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
|
||||
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
|
||||
check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
|
||||
check_cxx_compiler_flag(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG)
|
||||
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
|
||||
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
|
||||
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
|
||||
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
|
||||
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
|
||||
|
||||
# Check libraries
|
||||
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
|
||||
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
|
||||
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
|
||||
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
|
||||
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
||||
|
||||
# Check C++0x features
|
||||
if (LIBCXX_ENABLE_CXX0X)
|
||||
if (LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -std=c++0x)
|
||||
endif()
|
||||
else()
|
||||
set(LIBCXX_HAS_STDCXX0X_FLAG FALSE)
|
||||
endif()
|
1245
final/include/__bit_reference
Normal file
1245
final/include/__bit_reference
Normal file
File diff suppressed because it is too large
Load Diff
336
final/include/__config
Normal file
336
final/include/__config
Normal file
@ -0,0 +1,336 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- __config ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CONFIG
|
||||
#define _LIBCPP_CONFIG
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#define _LIBCPP_VERSION 1001
|
||||
|
||||
#define _LIBCPP_ABI_VERSION 1
|
||||
|
||||
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
|
||||
#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
|
||||
|
||||
#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
|
||||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#if __LITTLE_ENDIAN__
|
||||
#define _LIBCPP_LITTLE_ENDIAN 1
|
||||
#define _LIBCPP_BIG_ENDIAN 0
|
||||
#endif // __LITTLE_ENDIAN__
|
||||
#endif // __LITTLE_ENDIAN__
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#if __BIG_ENDIAN__
|
||||
#define _LIBCPP_LITTLE_ENDIAN 0
|
||||
#define _LIBCPP_BIG_ENDIAN 1
|
||||
#endif // __BIG_ENDIAN__
|
||||
#endif // __BIG_ENDIAN__
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
# include <sys/endian.h>
|
||||
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# else // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#endif // __FreeBSD__
|
||||
|
||||
#ifdef _WIN32
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
// Compiler intrinsics (GCC or MSVC)
|
||||
# if (defined(_MSC_VER) && _MSC_VER >= 1400) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3)
|
||||
# define _LIBCP_HAS_IS_BASE_OF
|
||||
# endif
|
||||
#endif // _WIN32
|
||||
|
||||
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
# include <endian.h>
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# else // __BYTE_ORDER == __BIG_ENDIAN
|
||||
# error unable to determine endian
|
||||
# endif
|
||||
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
|
||||
#ifndef _LIBCPP_VISIBILITY_TAG
|
||||
#define _LIBCPP_VISIBILITY_TAG 1
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_VISIBILITY_TAG
|
||||
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
|
||||
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
|
||||
#else // _LIBCPP_VISIBILITY_TAG
|
||||
#define _LIBCPP_HIDDEN
|
||||
#define _LIBCPP_VISIBLE
|
||||
#endif // _LIBCPP_VISIBILITY_TAG
|
||||
|
||||
#ifndef _LIBCPP_INLINE_VISIBILITY
|
||||
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXCEPTION_ABI
|
||||
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
|
||||
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
|
||||
#if defined(__clang__)
|
||||
|
||||
#if !__has_feature(cxx_alias_templates)
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#endif
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
#ifdef __linux__
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#else
|
||||
typedef __char16_t char16_t;
|
||||
typedef __char32_t char32_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_exceptions))
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_rtti))
|
||||
#define _LIBCPP_NO_RTTI
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_decltype))
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_attributes)
|
||||
# define _ATTRIBUTE(x) [[x]]
|
||||
#else
|
||||
# define _ATTRIBUTE(x) __attribute__ ((x))
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
|
||||
#if !(__has_feature(cxx_deleted_functions))
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#endif // !(__has_feature(cxx_deleted_functions))
|
||||
|
||||
#if !(__has_feature(cxx_lambdas))
|
||||
#define _LIBCPP_HAS_NO_LAMBDAS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_nullptr))
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_rvalue_references))
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_static_assert))
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_auto_type))
|
||||
#define _LIBCPP_HAS_NO_AUTO_TYPE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_variadic_templates))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_trailing_return))
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_generalized_initializers))
|
||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif
|
||||
|
||||
#if __has_feature(is_base_of)
|
||||
# define _LIBCP_HAS_IS_BASE_OF
|
||||
#endif
|
||||
|
||||
// Objective-C++ features (opt-in)
|
||||
#if __has_feature(objc_arc)
|
||||
#define _LIBCPP_HAS_OBJC_ARC
|
||||
#endif
|
||||
|
||||
#if __has_feature(objc_arc_weak)
|
||||
#define _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||
#endif
|
||||
|
||||
// Inline namespaces are available in Clang regardless of C++ dialect.
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
inline namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
}
|
||||
|
||||
#if !(__has_feature(cxx_constexpr))
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#endif
|
||||
|
||||
#if (__has_feature(cxx_noexcept))
|
||||
# define _NOEXCEPT noexcept
|
||||
# define _NOEXCEPT_(x) noexcept(x)
|
||||
#else
|
||||
# define _NOEXCEPT throw()
|
||||
# define _NOEXCEPT_(x)
|
||||
#endif
|
||||
|
||||
#if __has_feature(underlying_type)
|
||||
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
|
||||
#endif
|
||||
|
||||
// end defined(__clang__)
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#define _ATTRIBUTE(x) __attribute__((x))
|
||||
|
||||
#if !__EXCEPTIONS
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
|
||||
#define _NOEXCEPT throw()
|
||||
#define _NOEXCEPT_(x)
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
|
||||
#else // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||
}
|
||||
|
||||
#endif // defined(__GNUC__)
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef unsigned short char16_t;
|
||||
typedef unsigned int char32_t;
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
|
||||
template <bool> struct __static_assert_test;
|
||||
template <> struct __static_assert_test<true> {};
|
||||
template <unsigned> struct __static_assert_check {};
|
||||
#define static_assert(__b, __m) \
|
||||
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
|
||||
_LIBCPP_CONCAT(__t, __LINE__)
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define decltype(x) __typeof__(x)
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#define constexpr const
|
||||
#endif
|
||||
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
|
||||
#if __APPLE__ || __FreeBSD__ || _WIN32
|
||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
||||
#endif
|
||||
|
||||
#if __APPLE__ || __FreeBSD__
|
||||
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
#endif
|
||||
|
||||
#if __APPLE__ || __FreeBSD__
|
||||
#define _LIBCPP_WCTYPE_IS_MASK
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
# if _LIBCPP_DEBUG2 == 0
|
||||
# define _LIBCPP_DEBUG_LEVEL 1
|
||||
# elif _LIBCPP_DEBUG2 == 1
|
||||
# define _LIBCPP_DEBUG_LEVEL 2
|
||||
# else
|
||||
# error Supported values for _LIBCPP_DEBUG2 are 0 and 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
# include <__debug>
|
||||
#else
|
||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
191
final/include/__debug
Normal file
191
final/include/__debug
Normal file
@ -0,0 +1,191 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- __debug ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_DEBUG_H
|
||||
#define _LIBCPP_DEBUG_H
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 1
|
||||
|
||||
# include <cstdlib>
|
||||
# include <cstdio>
|
||||
# include <cstddef>
|
||||
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
|
||||
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
struct _LIBCPP_VISIBLE __c_node;
|
||||
|
||||
struct _LIBCPP_VISIBLE __i_node
|
||||
{
|
||||
void* __i_;
|
||||
__i_node* __next_;
|
||||
__c_node* __c_;
|
||||
|
||||
__i_node(const __i_node&) = delete;
|
||||
__i_node& operator=(const __i_node&) = delete;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__i_node(void* __i, __i_node* __next, __c_node* __c)
|
||||
: __i_(__i), __next_(__next), __c_(__c) {}
|
||||
~__i_node();
|
||||
};
|
||||
|
||||
struct _LIBCPP_VISIBLE __c_node
|
||||
{
|
||||
void* __c_;
|
||||
__c_node* __next_;
|
||||
__i_node** beg_;
|
||||
__i_node** end_;
|
||||
__i_node** cap_;
|
||||
|
||||
__c_node(const __c_node&) = delete;
|
||||
__c_node& operator=(const __c_node&) = delete;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__c_node(void* __c, __c_node* __next)
|
||||
: __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
|
||||
virtual ~__c_node();
|
||||
|
||||
virtual bool __dereferenceable(const void*) const = 0;
|
||||
virtual bool __decrementable(const void*) const = 0;
|
||||
virtual bool __addable(const void*, ptrdiff_t) const = 0;
|
||||
virtual bool __subscriptable(const void*, ptrdiff_t) const = 0;
|
||||
|
||||
void __add(__i_node* __i);
|
||||
_LIBCPP_HIDDEN void __remove(__i_node* __i);
|
||||
};
|
||||
|
||||
template <class _Cont>
|
||||
struct _C_node
|
||||
: public __c_node
|
||||
{
|
||||
_C_node(void* __c, __c_node* __n)
|
||||
: __c_node(__c, __n) {}
|
||||
|
||||
virtual bool __dereferenceable(const void*) const;
|
||||
virtual bool __decrementable(const void*) const;
|
||||
virtual bool __addable(const void*, ptrdiff_t) const;
|
||||
virtual bool __subscriptable(const void*, ptrdiff_t) const;
|
||||
};
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__dereferenceable(const void* __i) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _C = static_cast<_Cont*>(__c_);
|
||||
return _C->__dereferenceable(__j);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__decrementable(const void* __i) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _C = static_cast<_Cont*>(__c_);
|
||||
return _C->__decrementable(__j);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _C = static_cast<_Cont*>(__c_);
|
||||
return _C->__addable(__j, __n);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _C = static_cast<_Cont*>(__c_);
|
||||
return _C->__subscriptable(__j, __n);
|
||||
}
|
||||
|
||||
class _LIBCPP_VISIBLE __libcpp_db
|
||||
{
|
||||
__c_node** __cbeg_;
|
||||
__c_node** __cend_;
|
||||
size_t __csz_;
|
||||
__i_node** __ibeg_;
|
||||
__i_node** __iend_;
|
||||
size_t __isz_;
|
||||
|
||||
__libcpp_db();
|
||||
public:
|
||||
__libcpp_db(const __libcpp_db&) = delete;
|
||||
__libcpp_db& operator=(const __libcpp_db&) = delete;
|
||||
~__libcpp_db();
|
||||
|
||||
class __db_c_iterator;
|
||||
class __db_c_const_iterator;
|
||||
class __db_i_iterator;
|
||||
class __db_i_const_iterator;
|
||||
|
||||
__db_c_const_iterator __c_end() const;
|
||||
__db_i_const_iterator __i_end() const;
|
||||
|
||||
template <class _Cont>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __insert_c(_Cont* __c)
|
||||
{
|
||||
__c_node* __n = __insert_c(static_cast<void*>(__c));
|
||||
::new(__n) _C_node<_Cont>(__n->__c_, __n->__next_);
|
||||
}
|
||||
|
||||
void __insert_i(void* __i);
|
||||
__c_node* __insert_c(void* __c);
|
||||
void __erase_c(void* __c);
|
||||
|
||||
void __insert_ic(void* __i, const void* __c);
|
||||
void __iterator_copy(void* __i, const void* __i0);
|
||||
void __erase_i(void* __i);
|
||||
|
||||
void* __find_c_from_i(void* __i) const;
|
||||
void __invalidate_all(void* __c);
|
||||
__c_node* __find_c_and_lock(void* __c) const;
|
||||
__c_node* __find_c(void* __c) const;
|
||||
void unlock() const;
|
||||
|
||||
void swap(void* __c1, void* __c2);
|
||||
|
||||
|
||||
bool __dereferenceable(const void* __i) const;
|
||||
bool __decrementable(const void* __i) const;
|
||||
bool __addable(const void* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const void* __i, ptrdiff_t __n) const;
|
||||
bool __comparable(const void* __i, const void* __j) const;
|
||||
private:
|
||||
_LIBCPP_HIDDEN
|
||||
__i_node* __insert_iterator(void* __i);
|
||||
_LIBCPP_HIDDEN
|
||||
__i_node* __find_iterator(const void* __i) const;
|
||||
|
||||
friend _LIBCPP_VISIBLE __libcpp_db* __get_db();
|
||||
};
|
||||
|
||||
_LIBCPP_VISIBLE __libcpp_db* __get_db();
|
||||
_LIBCPP_VISIBLE const __libcpp_db* __get_const_db();
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_DEBUG_H
|
||||
|
2128
final/include/__functional_03
Normal file
2128
final/include/__functional_03
Normal file
File diff suppressed because it is too large
Load Diff
428
final/include/__functional_base
Normal file
428
final/include/__functional_base
Normal file
@ -0,0 +1,428 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_FUNCTIONAL_BASE
|
||||
#define _LIBCPP_FUNCTIONAL_BASE
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
#include <typeinfo>
|
||||
#include <exception>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
struct _LIBCPP_VISIBLE unary_function
|
||||
{
|
||||
typedef _Arg argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct _LIBCPP_VISIBLE binary_function
|
||||
{
|
||||
typedef _Arg1 first_argument_type;
|
||||
typedef _Arg2 second_argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Tp> struct _LIBCPP_VISIBLE hash;
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_result_type
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::result_type* = 0);
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
};
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#include <__functional_base_03>
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
// __weak_result_type
|
||||
|
||||
template <class _Tp>
|
||||
struct __derives_from_unary_function
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
static __two __test(...);
|
||||
template <class _A, class _R>
|
||||
static unary_function<_A, _R>
|
||||
__test(const volatile unary_function<_A, _R>*);
|
||||
public:
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __derives_from_binary_function
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
static __two __test(...);
|
||||
template <class _A1, class _A2, class _R>
|
||||
static binary_function<_A1, _A2, _R>
|
||||
__test(const volatile binary_function<_A1, _A2, _R>*);
|
||||
public:
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
};
|
||||
|
||||
template <class _Tp, bool = __derives_from_unary_function<_Tp>::value>
|
||||
struct __maybe_derive_from_unary_function // bool is true
|
||||
: public __derives_from_unary_function<_Tp>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __maybe_derive_from_unary_function<_Tp, false>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, bool = __derives_from_binary_function<_Tp>::value>
|
||||
struct __maybe_derive_from_binary_function // bool is true
|
||||
: public __derives_from_binary_function<_Tp>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __maybe_derive_from_binary_function<_Tp, false>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, bool = __has_result_type<_Tp>::value>
|
||||
struct __weak_result_type_imp // bool is true
|
||||
: public __maybe_derive_from_unary_function<_Tp>,
|
||||
public __maybe_derive_from_binary_function<_Tp>
|
||||
{
|
||||
typedef typename _Tp::result_type result_type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __weak_result_type_imp<_Tp, false>
|
||||
: public __maybe_derive_from_unary_function<_Tp>,
|
||||
public __maybe_derive_from_binary_function<_Tp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __weak_result_type
|
||||
: public __weak_result_type_imp<_Tp>
|
||||
{
|
||||
};
|
||||
|
||||
// 0 argument case
|
||||
|
||||
template <class _R>
|
||||
struct __weak_result_type<_R ()>
|
||||
{
|
||||
typedef _R result_type;
|
||||
};
|
||||
|
||||
template <class _R>
|
||||
struct __weak_result_type<_R (&)()>
|
||||
{
|
||||
typedef _R result_type;
|
||||
};
|
||||
|
||||
template <class _R>
|
||||
struct __weak_result_type<_R (*)()>
|
||||
{
|
||||
typedef _R result_type;
|
||||
};
|
||||
|
||||
// 1 argument case
|
||||
|
||||
template <class _R, class _A1>
|
||||
struct __weak_result_type<_R (_A1)>
|
||||
: public unary_function<_A1, _R>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _A1>
|
||||
struct __weak_result_type<_R (&)(_A1)>
|
||||
: public unary_function<_A1, _R>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _A1>
|
||||
struct __weak_result_type<_R (*)(_A1)>
|
||||
: public unary_function<_A1, _R>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C>
|
||||
struct __weak_result_type<_R (_C::*)()>
|
||||
: public unary_function<_C*, _R>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C>
|
||||
struct __weak_result_type<_R (_C::*)() const>
|
||||
: public unary_function<const _C*, _R>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C>
|
||||
struct __weak_result_type<_R (_C::*)() volatile>
|
||||
: public unary_function<volatile _C*, _R>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C>
|
||||
struct __weak_result_type<_R (_C::*)() const volatile>
|
||||
: public unary_function<const volatile _C*, _R>
|
||||
{
|
||||
};
|
||||
|
||||
// 2 argument case
|
||||
|
||||
template <class _R, class _A1, class _A2>
|
||||
struct __weak_result_type<_R (_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _R>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _A1, class _A2>
|
||||
struct __weak_result_type<_R (*)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _R>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _A1, class _A2>
|
||||
struct __weak_result_type<_R (&)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _R>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1>
|
||||
struct __weak_result_type<_R (_C::*)(_A1)>
|
||||
: public binary_function<_C*, _A1, _R>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1>
|
||||
struct __weak_result_type<_R (_C::*)(_A1) const>
|
||||
: public binary_function<const _C*, _A1, _R>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1>
|
||||
struct __weak_result_type<_R (_C::*)(_A1) volatile>
|
||||
: public binary_function<volatile _C*, _A1, _R>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1>
|
||||
struct __weak_result_type<_R (_C::*)(_A1) const volatile>
|
||||
: public binary_function<const volatile _C*, _A1, _R>
|
||||
{
|
||||
};
|
||||
|
||||
// 3 or more arguments
|
||||
|
||||
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_R (_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
typedef _R result_type;
|
||||
};
|
||||
|
||||
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_R (&)(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
typedef _R result_type;
|
||||
};
|
||||
|
||||
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_R (*)(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
typedef _R result_type;
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...)>
|
||||
{
|
||||
typedef _R result_type;
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const>
|
||||
{
|
||||
typedef _R result_type;
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile>
|
||||
{
|
||||
typedef _R result_type;
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
|
||||
{
|
||||
typedef _R result_type;
|
||||
};
|
||||
|
||||
// __invoke
|
||||
|
||||
// bullets 1 and 2
|
||||
|
||||
template <class _F, class _A0, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _F, class _A0, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
// bullets 3 and 4
|
||||
|
||||
template <class _F, class _A0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_F&& __f, _A0&& __a0)
|
||||
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
|
||||
{
|
||||
return _VSTD::forward<_A0>(__a0).*__f;
|
||||
}
|
||||
|
||||
template <class _F, class _A0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_F&& __f, _A0&& __a0)
|
||||
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
|
||||
{
|
||||
return (*_VSTD::forward<_A0>(__a0)).*__f;
|
||||
}
|
||||
|
||||
// bullet 5
|
||||
|
||||
template <class _F, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_F&& __f, _Args&& ...__args)
|
||||
-> decltype(_VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return _VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _Tp, class ..._Args>
|
||||
struct __invoke_return
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE reference_wrapper
|
||||
: public __weak_result_type<_Tp>
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef _Tp type;
|
||||
private:
|
||||
type* __f_;
|
||||
|
||||
public:
|
||||
// construct/copy/destroy
|
||||
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
|
||||
#endif
|
||||
|
||||
// access
|
||||
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
|
||||
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_of<type&, _ArgTypes...>::type
|
||||
operator() (_ArgTypes&&... __args) const
|
||||
{
|
||||
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp> struct ____is_reference_wrapper : public false_type {};
|
||||
template <class _Tp> struct ____is_reference_wrapper<reference_wrapper<_Tp> > : public true_type {};
|
||||
template <class _Tp> struct __is_reference_wrapper
|
||||
: public ____is_reference_wrapper<typename remove_cv<_Tp>::type> {};
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<_Tp>
|
||||
ref(_Tp& __t) _NOEXCEPT
|
||||
{
|
||||
return reference_wrapper<_Tp>(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<_Tp>
|
||||
ref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
return ref(__t.get());
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<const _Tp>
|
||||
cref(const _Tp& __t) _NOEXCEPT
|
||||
{
|
||||
return reference_wrapper<const _Tp>(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<const _Tp>
|
||||
cref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
return cref(__t.get());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
template <class _Tp> void ref(const _Tp&& __t) = delete;
|
||||
template <class _Tp> void cref(const _Tp&& __t) = delete;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
template <class _Tp> void ref(const _Tp&& __t);// = delete;
|
||||
template <class _Tp> void cref(const _Tp&& __t);// = delete;
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_FUNCTIONAL_BASE
|
1087
final/include/__functional_base_03
Normal file
1087
final/include/__functional_base_03
Normal file
File diff suppressed because it is too large
Load Diff
1916
final/include/__hash_table
Normal file
1916
final/include/__hash_table
Normal file
File diff suppressed because it is too large
Load Diff
1412
final/include/__locale
Normal file
1412
final/include/__locale
Normal file
File diff suppressed because it is too large
Load Diff
437
final/include/__mutex_base
Normal file
437
final/include/__mutex_base
Normal file
@ -0,0 +1,437 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___MUTEX_BASE
|
||||
#define _LIBCPP___MUTEX_BASE
|
||||
|
||||
#include <__config>
|
||||
#include <chrono>
|
||||
#include <system_error>
|
||||
#include <pthread.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#ifdef _LIBCPP_SHARED_LOCK
|
||||
|
||||
namespace ting {
|
||||
template <class _Mutex> class shared_lock;
|
||||
template <class _Mutex> class upgrade_lock;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_SHARED_LOCK
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_VISIBLE mutex
|
||||
{
|
||||
pthread_mutex_t __m_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
|
||||
~mutex();
|
||||
|
||||
private:
|
||||
mutex(const mutex&);// = delete;
|
||||
mutex& operator=(const mutex&);// = delete;
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
|
||||
};
|
||||
|
||||
struct _LIBCPP_VISIBLE defer_lock_t {};
|
||||
struct _LIBCPP_VISIBLE try_to_lock_t {};
|
||||
struct _LIBCPP_VISIBLE adopt_lock_t {};
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
defer_lock_t defer_lock;
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
try_to_lock_t try_to_lock;
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
adopt_lock_t adopt_lock;
|
||||
|
||||
template <class _Mutex>
|
||||
class _LIBCPP_VISIBLE lock_guard
|
||||
{
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
|
||||
private:
|
||||
mutex_type& __m_;
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit lock_guard(mutex_type& __m)
|
||||
: __m_(__m) {__m_.lock();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
lock_guard(mutex_type& __m, adopt_lock_t)
|
||||
: __m_(__m) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~lock_guard() {__m_.unlock();}
|
||||
|
||||
private:
|
||||
lock_guard(lock_guard const&);// = delete;
|
||||
lock_guard& operator=(lock_guard const&);// = delete;
|
||||
};
|
||||
|
||||
template <class _Mutex>
|
||||
class _LIBCPP_VISIBLE unique_lock
|
||||
{
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
|
||||
private:
|
||||
mutex_type* __m_;
|
||||
bool __owns_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock() : __m_(nullptr), __owns_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit unique_lock(mutex_type& __m)
|
||||
: __m_(&__m), __owns_(true) {__m_->lock();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, defer_lock_t)
|
||||
: __m_(&__m), __owns_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, try_to_lock_t)
|
||||
: __m_(&__m), __owns_(__m.try_lock()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, adopt_lock_t)
|
||||
: __m_(&__m), __owns_(true) {}
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t)
|
||||
: __m_(&__m), __owns_(__m.try_lock_until(__t)) {}
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d)
|
||||
: __m_(&__m), __owns_(__m.try_lock_for(__d)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~unique_lock()
|
||||
{
|
||||
if (__owns_)
|
||||
__m_->unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
unique_lock(unique_lock const&); // = delete;
|
||||
unique_lock& operator=(unique_lock const&); // = delete;
|
||||
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(unique_lock&& __u)
|
||||
: __m_(__u.__m_), __owns_(__u.__owns_)
|
||||
{__u.__m_ = nullptr; __u.__owns_ = false;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock& operator=(unique_lock&& __u)
|
||||
{
|
||||
if (__owns_)
|
||||
__m_->unlock();
|
||||
__m_ = __u.__m_;
|
||||
__owns_ = __u.__owns_;
|
||||
__u.__m_ = nullptr;
|
||||
__u.__owns_ = false;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_SHARED_LOCK
|
||||
|
||||
unique_lock(ting::shared_lock<mutex_type>&&, try_to_lock_t);
|
||||
template <class _Clock, class _Duration>
|
||||
unique_lock(ting::shared_lock<mutex_type>&&,
|
||||
const chrono::time_point<_Clock, _Duration>&);
|
||||
template <class _Rep, class _Period>
|
||||
unique_lock(ting::shared_lock<mutex_type>&&,
|
||||
const chrono::duration<_Rep, _Period>&);
|
||||
|
||||
explicit unique_lock(ting::upgrade_lock<mutex_type>&&);
|
||||
unique_lock(ting::upgrade_lock<mutex_type>&&, try_to_lock_t);
|
||||
template <class _Clock, class _Duration>
|
||||
unique_lock(ting::upgrade_lock<mutex_type>&&,
|
||||
const chrono::time_point<_Clock, _Duration>&);
|
||||
template <class _Rep, class _Period>
|
||||
unique_lock(ting::upgrade_lock<mutex_type>&&,
|
||||
const chrono::duration<_Rep, _Period>&);
|
||||
|
||||
#endif // _LIBCPP_SHARED_LOCK
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d);
|
||||
template <class _Clock, class _Duration>
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
||||
void unlock();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(unique_lock& __u)
|
||||
{
|
||||
_VSTD::swap(__m_, __u.__m_);
|
||||
_VSTD::swap(__owns_, __u.__owns_);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* release()
|
||||
{
|
||||
mutex_type* __m = __m_;
|
||||
__m_ = nullptr;
|
||||
__owns_ = false;
|
||||
return __m;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool owns_lock() const {return __owns_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
// explicit
|
||||
operator bool () const {return __owns_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* mutex() const {return __m_;}
|
||||
};
|
||||
|
||||
template <class _Mutex>
|
||||
void
|
||||
unique_lock<_Mutex>::lock()
|
||||
{
|
||||
if (__m_ == nullptr)
|
||||
__throw_system_error(EPERM, "unique_lock::lock: references null mutex");
|
||||
if (__owns_)
|
||||
__throw_system_error(EDEADLK, "unique_lock::lock: already locked");
|
||||
__m_->lock();
|
||||
__owns_ = true;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
bool
|
||||
unique_lock<_Mutex>::try_lock()
|
||||
{
|
||||
if (__m_ == nullptr)
|
||||
__throw_system_error(EPERM, "unique_lock::try_lock: references null mutex");
|
||||
if (__owns_)
|
||||
__throw_system_error(EDEADLK, "unique_lock::try_lock: already locked");
|
||||
__owns_ = __m_->try_lock();
|
||||
return __owns_;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
template <class _Rep, class _Period>
|
||||
bool
|
||||
unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
if (__m_ == nullptr)
|
||||
__throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex");
|
||||
if (__owns_)
|
||||
__throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked");
|
||||
__owns_ = __m_->try_lock_for(__d);
|
||||
return __owns_;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
template <class _Clock, class _Duration>
|
||||
bool
|
||||
unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
if (__m_ == nullptr)
|
||||
__throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex");
|
||||
if (__owns_)
|
||||
__throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked");
|
||||
__owns_ = __m_->try_lock_until(__t);
|
||||
return __owns_;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
void
|
||||
unique_lock<_Mutex>::unlock()
|
||||
{
|
||||
if (!__owns_)
|
||||
__throw_system_error(EPERM, "unique_lock::unlock: not locked");
|
||||
__m_->unlock();
|
||||
__owns_ = false;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);}
|
||||
|
||||
struct _LIBCPP_VISIBLE cv_status
|
||||
{
|
||||
enum _ {
|
||||
no_timeout,
|
||||
timeout
|
||||
};
|
||||
|
||||
_ __v_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
|
||||
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
|
||||
|
||||
};
|
||||
|
||||
class _LIBCPP_VISIBLE condition_variable
|
||||
{
|
||||
pthread_cond_t __cv_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
|
||||
~condition_variable();
|
||||
|
||||
private:
|
||||
condition_variable(const condition_variable&); // = delete;
|
||||
condition_variable& operator=(const condition_variable&); // = delete;
|
||||
|
||||
public:
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
|
||||
void wait(unique_lock<mutex>& __lk);
|
||||
template <class _Predicate>
|
||||
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
|
||||
|
||||
template <class _Duration>
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<chrono::system_clock, _Duration>& __t);
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
||||
template <class _Clock, class _Duration, class _Predicate>
|
||||
bool
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred);
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
cv_status
|
||||
wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d);
|
||||
|
||||
template <class _Rep, class _Period, class _Predicate>
|
||||
bool
|
||||
wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred);
|
||||
|
||||
typedef pthread_cond_t* native_handle_type;
|
||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;}
|
||||
|
||||
private:
|
||||
void __do_timed_wait(unique_lock<mutex>& __lk,
|
||||
chrono::time_point<chrono::system_clock, chrono::nanoseconds>);
|
||||
};
|
||||
|
||||
template <class _To, class _Rep, class _Period>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
chrono::__is_duration<_To>::value,
|
||||
_To
|
||||
>::type
|
||||
__ceil(chrono::duration<_Rep, _Period> __d)
|
||||
{
|
||||
using namespace chrono;
|
||||
_To __r = duration_cast<_To>(__d);
|
||||
if (__r < __d)
|
||||
++__r;
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Predicate>
|
||||
void
|
||||
condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
|
||||
{
|
||||
while (!__pred())
|
||||
wait(__lk);
|
||||
}
|
||||
|
||||
template <class _Duration>
|
||||
cv_status
|
||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<chrono::system_clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
typedef time_point<system_clock, nanoseconds> __nano_sys_tmpt;
|
||||
__do_timed_wait(__lk,
|
||||
__nano_sys_tmpt(__ceil<nanoseconds>(__t.time_since_epoch())));
|
||||
return system_clock::now() < __t ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
}
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
cv_status
|
||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
system_clock::time_point __s_now = system_clock::now();
|
||||
typename _Clock::time_point __c_now = _Clock::now();
|
||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__t - __c_now));
|
||||
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
|
||||
}
|
||||
|
||||
template <class _Clock, class _Duration, class _Predicate>
|
||||
bool
|
||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred)
|
||||
{
|
||||
while (!__pred())
|
||||
{
|
||||
if (wait_until(__lk, __t) == cv_status::timeout)
|
||||
return __pred();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
cv_status
|
||||
condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
using namespace chrono;
|
||||
system_clock::time_point __s_now = system_clock::now();
|
||||
steady_clock::time_point __c_now = steady_clock::now();
|
||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
||||
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
}
|
||||
|
||||
template <class _Rep, class _Period, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lk, chrono::steady_clock::now() + __d,
|
||||
_VSTD::move(__pred));
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___MUTEX_BASE
|
648
final/include/__split_buffer
Normal file
648
final/include/__split_buffer
Normal file
@ -0,0 +1,648 @@
|
||||
// -*- C++ -*-
|
||||
#ifndef _LIBCPP_SPLIT_BUFFER
|
||||
#define _LIBCPP_SPLIT_BUFFER
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <bool>
|
||||
class __split_buffer_common
|
||||
{
|
||||
protected:
|
||||
void __throw_length_error() const;
|
||||
void __throw_out_of_range() const;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Allocator = allocator<_Tp> >
|
||||
struct __split_buffer
|
||||
: private __split_buffer_common<true>
|
||||
{
|
||||
private:
|
||||
__split_buffer(const __split_buffer&);
|
||||
__split_buffer& operator=(const __split_buffer&);
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef typename remove_reference<allocator_type>::type __alloc_rr;
|
||||
typedef allocator_traits<__alloc_rr> __alloc_traits;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef typename __alloc_traits::size_type size_type;
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
typedef typename __alloc_traits::pointer pointer;
|
||||
typedef typename __alloc_traits::const_pointer const_pointer;
|
||||
typedef pointer iterator;
|
||||
typedef const_pointer const_iterator;
|
||||
|
||||
pointer __first_;
|
||||
pointer __begin_;
|
||||
pointer __end_;
|
||||
__compressed_pair<pointer, allocator_type> __end_cap_;
|
||||
|
||||
typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref;
|
||||
typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
|
||||
|
||||
__split_buffer()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
||||
explicit __split_buffer(__alloc_rr& __a);
|
||||
explicit __split_buffer(const __alloc_rr& __a);
|
||||
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
|
||||
~__split_buffer();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
|
||||
__split_buffer& operator=(__split_buffer&& __c)
|
||||
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value) ||
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __end_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __end_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT
|
||||
{__destruct_at_end(__begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type __front_spare() const {return static_cast<size_type>(__begin_ - __first_);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type __back_spare() const {return static_cast<size_type>(__end_cap() - __end_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference front() {return *__begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return *__begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference back() {return *(__end_ - 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);}
|
||||
|
||||
void reserve(size_type __n);
|
||||
void shrink_to_fit() _NOEXCEPT;
|
||||
void push_front(const_reference __x);
|
||||
void push_back(const_reference __x);
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
void push_front(value_type&& __x);
|
||||
void push_back(value_type&& __x);
|
||||
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class... _Args>
|
||||
void emplace_back(_Args&&... __args);
|
||||
#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
|
||||
|
||||
void __construct_at_end(size_type __n);
|
||||
void __construct_at_end(size_type __n, const_reference __x);
|
||||
template <class _InputIter>
|
||||
typename enable_if
|
||||
<
|
||||
__is_input_iterator<_InputIter>::value &&
|
||||
!__is_forward_iterator<_InputIter>::value,
|
||||
void
|
||||
>::type
|
||||
__construct_at_end(_InputIter __first, _InputIter __last);
|
||||
template <class _ForwardIterator>
|
||||
typename enable_if
|
||||
<
|
||||
__is_forward_iterator<_ForwardIterator>::value,
|
||||
void
|
||||
>::type
|
||||
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
|
||||
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
|
||||
void __destruct_at_begin(pointer __new_begin, false_type);
|
||||
void __destruct_at_begin(pointer __new_begin, true_type);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __destruct_at_end(pointer __new_last) _NOEXCEPT
|
||||
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
|
||||
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
|
||||
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
|
||||
|
||||
void swap(__split_buffer& __x)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value);
|
||||
|
||||
bool __invariants() const;
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__split_buffer& __c, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
||||
{
|
||||
__alloc() = _VSTD::move(__c.__alloc());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__split_buffer& __c, false_type) _NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_swap::value>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
bool
|
||||
__split_buffer<_Tp, _Allocator>::__invariants() const
|
||||
{
|
||||
if (__first_ == nullptr)
|
||||
{
|
||||
if (__begin_ != nullptr)
|
||||
return false;
|
||||
if (__end_ != nullptr)
|
||||
return false;
|
||||
if (__end_cap() != nullptr)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__begin_ < __first_)
|
||||
return false;
|
||||
if (__end_ < __begin_)
|
||||
return false;
|
||||
if (__end_cap() < __end_)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Default constructs __n objects starting at __end_
|
||||
// throws if construction throws
|
||||
// Precondition: __n > 0
|
||||
// Precondition: size() + __n <= capacity()
|
||||
// Postcondition: size() == size() + __n
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
do
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
|
||||
++this->__end_;
|
||||
--__n;
|
||||
} while (__n > 0);
|
||||
}
|
||||
|
||||
// Copy constructs __n objects starting at __end_ from __x
|
||||
// throws if construction throws
|
||||
// Precondition: __n > 0
|
||||
// Precondition: size() + __n <= capacity()
|
||||
// Postcondition: size() == old size() + __n
|
||||
// Postcondition: [i] == __x for all i in [size() - __n, __n)
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
do
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
|
||||
++this->__end_;
|
||||
--__n;
|
||||
} while (__n > 0);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _InputIter>
|
||||
typename enable_if
|
||||
<
|
||||
__is_input_iterator<_InputIter>::value &&
|
||||
!__is_forward_iterator<_InputIter>::value,
|
||||
void
|
||||
>::type
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
for (; __first != __last; ++__first)
|
||||
{
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
size_type __old_cap = __end_cap() - __first_;
|
||||
size_type __new_cap = _VSTD::max<size_type>(2 * __old_cap, 8);
|
||||
__split_buffer __buf(__new_cap, 0, __a);
|
||||
for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
|
||||
__alloc_traits::construct(__buf.__alloc(),
|
||||
_VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));
|
||||
swap(__buf);
|
||||
}
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
|
||||
++this->__end_;
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _ForwardIterator>
|
||||
typename enable_if
|
||||
<
|
||||
__is_forward_iterator<_ForwardIterator>::value,
|
||||
void
|
||||
>::type
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
for (; __first != __last; ++__first)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
|
||||
++this->__end_;
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
|
||||
{
|
||||
while (__begin_ < __new_begin)
|
||||
__alloc_traits::destroy(__alloc(), __begin_++);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
|
||||
{
|
||||
__begin_ = __new_begin;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
|
||||
{
|
||||
while (__new_last < __end_)
|
||||
__alloc_traits::destroy(__alloc(), --__end_);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
|
||||
{
|
||||
__end_ = __new_last;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
|
||||
: __end_cap_(0, __a)
|
||||
{
|
||||
__first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
|
||||
__begin_ = __end_ = __first_ + __start;
|
||||
__end_cap() = __first_ + __cap;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __first_(0), __begin_(0), __end_(0), __end_cap_(0)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
|
||||
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
|
||||
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::~__split_buffer()
|
||||
{
|
||||
clear();
|
||||
if (__first_)
|
||||
__alloc_traits::deallocate(__alloc(), __first_, capacity());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
: __first_(_VSTD::move(__c.__first_)),
|
||||
__begin_(_VSTD::move(__c.__begin_)),
|
||||
__end_(_VSTD::move(__c.__end_)),
|
||||
__end_cap_(_VSTD::move(__c.__end_cap_))
|
||||
{
|
||||
__c.__first_ = nullptr;
|
||||
__c.__begin_ = nullptr;
|
||||
__c.__end_ = nullptr;
|
||||
__c.__end_cap() = nullptr;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
|
||||
: __end_cap_(__a)
|
||||
{
|
||||
if (__a == __c.__alloc())
|
||||
{
|
||||
__first_ = __c.__first_;
|
||||
__begin_ = __c.__begin_;
|
||||
__end_ = __c.__end_;
|
||||
__end_cap() = __c.__end_cap();
|
||||
__c.__first_ = nullptr;
|
||||
__c.__begin_ = nullptr;
|
||||
__c.__end_ = nullptr;
|
||||
__c.__end_cap() = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __cap = __c.size();
|
||||
__first_ = __alloc_traits::allocate(__alloc(), __cap);
|
||||
__begin_ = __end_ = __first_;
|
||||
__end_cap() = __first_ + __cap;
|
||||
typedef move_iterator<iterator> _I;
|
||||
__construct_at_end(_I(__c.begin()), _I(__c.end()));
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>&
|
||||
__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
|
||||
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value) ||
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value)
|
||||
{
|
||||
clear();
|
||||
shrink_to_fit();
|
||||
__first_ = __c.__first_;
|
||||
__begin_ = __c.__begin_;
|
||||
__end_ = __c.__end_;
|
||||
__end_cap() = __c.__end_cap();
|
||||
__move_assign_alloc(__c,
|
||||
integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_move_assignment::value>());
|
||||
__c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{
|
||||
_VSTD::swap(__first_, __x.__first_);
|
||||
_VSTD::swap(__begin_, __x.__begin_);
|
||||
_VSTD::swap(__end_, __x.__end_);
|
||||
_VSTD::swap(__end_cap(), __x.__end_cap());
|
||||
__swap_alloc(__alloc(), __x.__alloc());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::reserve(size_type __n)
|
||||
{
|
||||
if (__n < capacity())
|
||||
{
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
|
||||
{
|
||||
if (capacity() > size())
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
__t.__end_ = __t.__begin_ + (__end_ - __begin_);
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
||||
{
|
||||
if (__begin_ == __first_)
|
||||
{
|
||||
if (__end_ < __end_cap())
|
||||
{
|
||||
difference_type __d = __end_cap() - __end_;
|
||||
__d = (__d + 1) / 2;
|
||||
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__end_ += __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x);
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
{
|
||||
if (__begin_ == __first_)
|
||||
{
|
||||
if (__end_ < __end_cap())
|
||||
{
|
||||
difference_type __d = __end_cap() - __end_;
|
||||
__d = (__d + 1) / 2;
|
||||
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__end_ += __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1),
|
||||
_VSTD::move(__x));
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
{
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
if (__begin_ > __first_)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x);
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
||||
{
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
if (__begin_ > __first_)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
|
||||
_VSTD::move(__x));
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
{
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
if (__begin_ > __first_)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_SPLIT_BUFFER
|
75
final/include/__sso_allocator
Normal file
75
final/include/__sso_allocator
Normal file
@ -0,0 +1,75 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___SSO_ALLOCATOR
|
||||
#define _LIBCPP___SSO_ALLOCATOR
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
#include <new>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, size_t _N> class _LIBCPP_HIDDEN __sso_allocator;
|
||||
|
||||
template <size_t _N>
|
||||
class _LIBCPP_HIDDEN __sso_allocator<void, _N>
|
||||
{
|
||||
public:
|
||||
typedef const void* const_pointer;
|
||||
typedef void value_type;
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _N>
|
||||
class _LIBCPP_HIDDEN __sso_allocator
|
||||
{
|
||||
typename aligned_storage<sizeof(_Tp) * _N>::type buf_;
|
||||
bool __allocated_;
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef _Tp* pointer;
|
||||
typedef _Tp value_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _N>&) throw()
|
||||
: __allocated_(false) {}
|
||||
private:
|
||||
__sso_allocator& operator=(const __sso_allocator&);
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _N>::const_pointer = 0)
|
||||
{
|
||||
if (!__allocated_ && __n <= _N)
|
||||
{
|
||||
__allocated_ = true;
|
||||
return (pointer)&buf_;
|
||||
}
|
||||
return static_cast<pointer>(::operator new(__n * sizeof(_Tp)));
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type)
|
||||
{
|
||||
if (__p == (pointer)&buf_)
|
||||
__allocated_ = false;
|
||||
else
|
||||
::operator delete(__p);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(__sso_allocator& __a) const {return &buf_ == &__a.buf_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(__sso_allocator& __a) const {return &buf_ != &__a.buf_;}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___SSO_ALLOCATOR
|
313
final/include/__std_stream
Normal file
313
final/include/__std_stream
Normal file
@ -0,0 +1,313 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___STD_STREAM
|
||||
#define _LIBCPP___STD_STREAM
|
||||
|
||||
#include <__config>
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
#include <__locale>
|
||||
#include <cstdio>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
static const unsigned __limit = 8;
|
||||
|
||||
// __stdinbuf
|
||||
|
||||
template <class _CharT>
|
||||
class _LIBCPP_HIDDEN __stdinbuf
|
||||
: public basic_streambuf<_CharT, char_traits<_CharT> >
|
||||
{
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
typedef char_traits<char_type> traits_type;
|
||||
typedef typename traits_type::int_type int_type;
|
||||
typedef typename traits_type::pos_type pos_type;
|
||||
typedef typename traits_type::off_type off_type;
|
||||
typedef typename traits_type::state_type state_type;
|
||||
|
||||
explicit __stdinbuf(FILE* __fp);
|
||||
|
||||
protected:
|
||||
virtual int_type underflow();
|
||||
virtual int_type uflow();
|
||||
virtual int_type pbackfail(int_type __c = traits_type::eof());
|
||||
virtual void imbue(const locale& __loc);
|
||||
|
||||
private:
|
||||
|
||||
FILE* __file_;
|
||||
const codecvt<char_type, char, state_type>* __cv_;
|
||||
state_type __st_;
|
||||
int __encoding_;
|
||||
bool __always_noconv_;
|
||||
|
||||
__stdinbuf(const __stdinbuf&);
|
||||
__stdinbuf& operator=(const __stdinbuf&);
|
||||
|
||||
int_type __getchar(bool __consume);
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp)
|
||||
: __file_(__fp),
|
||||
__st_()
|
||||
{
|
||||
imbue(this->getloc());
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
void
|
||||
__stdinbuf<_CharT>::imbue(const locale& __loc)
|
||||
{
|
||||
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
|
||||
__encoding_ = __cv_->encoding();
|
||||
__always_noconv_ = __cv_->always_noconv();
|
||||
if (__encoding_ > __limit)
|
||||
__throw_runtime_error("unsupported locale for standard input");
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::underflow()
|
||||
{
|
||||
return __getchar(false);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::uflow()
|
||||
{
|
||||
return __getchar(true);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::__getchar(bool __consume)
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
int __nread = _VSTD::max(1, __encoding_);
|
||||
for (int __i = 0; __i < __nread; ++__i)
|
||||
{
|
||||
char __c = getc(__file_);
|
||||
if (__c == EOF)
|
||||
return traits_type::eof();
|
||||
__extbuf[__i] = static_cast<char>(__c);
|
||||
}
|
||||
char_type __1buf;
|
||||
if (__always_noconv_)
|
||||
__1buf = static_cast<char_type>(__extbuf[0]);
|
||||
else
|
||||
{
|
||||
const char* __enxt;
|
||||
char_type* __inxt;
|
||||
codecvt_base::result __r;
|
||||
do
|
||||
{
|
||||
state_type __sv_st = __st_;
|
||||
__r = __cv_->in(__st_, __extbuf, __extbuf + __nread, __enxt,
|
||||
&__1buf, &__1buf + 1, __inxt);
|
||||
switch (__r)
|
||||
{
|
||||
case _VSTD::codecvt_base::ok:
|
||||
break;
|
||||
case codecvt_base::partial:
|
||||
__st_ = __sv_st;
|
||||
if (__nread == sizeof(__extbuf))
|
||||
return traits_type::eof();
|
||||
{
|
||||
char __c = getc(__file_);
|
||||
if (__c == EOF)
|
||||
return traits_type::eof();
|
||||
__extbuf[__nread] = static_cast<char>(__c);
|
||||
}
|
||||
++__nread;
|
||||
break;
|
||||
case codecvt_base::error:
|
||||
return traits_type::eof();
|
||||
case _VSTD::codecvt_base::noconv:
|
||||
__1buf = static_cast<char_type>(__extbuf[0]);
|
||||
break;
|
||||
}
|
||||
} while (__r == _VSTD::codecvt_base::partial);
|
||||
}
|
||||
if (!__consume)
|
||||
{
|
||||
for (int __i = __nread; __i > 0;)
|
||||
{
|
||||
if (ungetc(__extbuf[--__i], __file_) == EOF)
|
||||
return traits_type::eof();
|
||||
}
|
||||
}
|
||||
return traits_type::to_int_type(__1buf);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::pbackfail(int_type __c)
|
||||
{
|
||||
if (traits_type::eq_int_type(__c, traits_type::eof()))
|
||||
return __c;
|
||||
char __extbuf[__limit];
|
||||
char* __enxt;
|
||||
const char_type __ci = traits_type::to_char_type(__c);
|
||||
const char_type* __inxt;
|
||||
switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
|
||||
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
|
||||
{
|
||||
case _VSTD::codecvt_base::ok:
|
||||
break;
|
||||
case _VSTD::codecvt_base::noconv:
|
||||
__extbuf[0] = static_cast<char>(__c);
|
||||
__enxt = __extbuf + 1;
|
||||
break;
|
||||
case codecvt_base::partial:
|
||||
case codecvt_base::error:
|
||||
return traits_type::eof();
|
||||
}
|
||||
while (__enxt > __extbuf)
|
||||
if (ungetc(*--__enxt, __file_) == EOF)
|
||||
return traits_type::eof();
|
||||
return traits_type::not_eof(__c);
|
||||
}
|
||||
|
||||
// __stdoutbuf
|
||||
|
||||
template <class _CharT>
|
||||
class _LIBCPP_HIDDEN __stdoutbuf
|
||||
: public basic_streambuf<_CharT, char_traits<_CharT> >
|
||||
{
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
typedef char_traits<char_type> traits_type;
|
||||
typedef typename traits_type::int_type int_type;
|
||||
typedef typename traits_type::pos_type pos_type;
|
||||
typedef typename traits_type::off_type off_type;
|
||||
typedef typename traits_type::state_type state_type;
|
||||
|
||||
explicit __stdoutbuf(FILE* __fp);
|
||||
|
||||
protected:
|
||||
virtual int_type overflow (int_type __c = traits_type::eof());
|
||||
virtual int sync();
|
||||
virtual void imbue(const locale& __loc);
|
||||
|
||||
private:
|
||||
FILE* __file_;
|
||||
const codecvt<char_type, char, state_type>* __cv_;
|
||||
state_type __st_;
|
||||
bool __always_noconv_;
|
||||
|
||||
__stdoutbuf(const __stdoutbuf&);
|
||||
__stdoutbuf& operator=(const __stdoutbuf&);
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp)
|
||||
: __file_(__fp),
|
||||
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
|
||||
__st_(),
|
||||
__always_noconv_(__cv_->always_noconv())
|
||||
{
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdoutbuf<_CharT>::int_type
|
||||
__stdoutbuf<_CharT>::overflow(int_type __c)
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
char_type __1buf;
|
||||
if (!traits_type::eq_int_type(__c, traits_type::eof()))
|
||||
{
|
||||
this->setp(&__1buf, &__1buf+1);
|
||||
*this->pptr() = traits_type::to_char_type(__c);
|
||||
this->pbump(1);
|
||||
if (__always_noconv_)
|
||||
{
|
||||
if (fwrite(this->pbase(), sizeof(char_type), 1, __file_) != 1)
|
||||
return traits_type::eof();
|
||||
}
|
||||
else
|
||||
{
|
||||
char* __extbe = __extbuf;
|
||||
codecvt_base::result __r;
|
||||
do
|
||||
{
|
||||
const char_type* __e;
|
||||
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
|
||||
__extbuf,
|
||||
__extbuf + sizeof(__extbuf),
|
||||
__extbe);
|
||||
if (__e == this->pbase())
|
||||
return traits_type::eof();
|
||||
if (__r == codecvt_base::noconv)
|
||||
{
|
||||
if (fwrite(this->pbase(), 1, 1, __file_) != 1)
|
||||
return traits_type::eof();
|
||||
}
|
||||
else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
|
||||
{
|
||||
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
|
||||
if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
|
||||
return traits_type::eof();
|
||||
if (__r == codecvt_base::partial)
|
||||
{
|
||||
this->setp((char_type*)__e, this->pptr());
|
||||
this->pbump(this->epptr() - this->pbase());
|
||||
}
|
||||
}
|
||||
else
|
||||
return traits_type::eof();
|
||||
} while (__r == codecvt_base::partial);
|
||||
}
|
||||
this->setp(0, 0);
|
||||
}
|
||||
return traits_type::not_eof(__c);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
int
|
||||
__stdoutbuf<_CharT>::sync()
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
codecvt_base::result __r;
|
||||
do
|
||||
{
|
||||
char* __extbe;
|
||||
__r = __cv_->unshift(__st_, __extbuf,
|
||||
__extbuf + sizeof(__extbuf),
|
||||
__extbe);
|
||||
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
|
||||
if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
|
||||
return -1;
|
||||
} while (__r == codecvt_base::partial);
|
||||
if (__r == codecvt_base::error)
|
||||
return -1;
|
||||
if (fflush(__file_))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
void
|
||||
__stdoutbuf<_CharT>::imbue(const locale& __loc)
|
||||
{
|
||||
sync();
|
||||
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
|
||||
__always_noconv_ = __cv_->always_noconv();
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___STD_STREAM
|
2291
final/include/__tree
Normal file
2291
final/include/__tree
Normal file
File diff suppressed because it is too large
Load Diff
267
final/include/__tuple
Normal file
267
final/include/__tuple
Normal file
@ -0,0 +1,267 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___TUPLE
|
||||
#define _LIBCPP___TUPLE
|
||||
|
||||
#include <__config>
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#include <__tuple_03>
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<const _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<volatile _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<const volatile _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, volatile _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const volatile _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
|
||||
template <class _T1, class _T2> class _LIBCPP_VISIBLE pair;
|
||||
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
|
||||
|
||||
template <class _Tp> struct __tuple_like : false_type {};
|
||||
|
||||
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
|
||||
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
|
||||
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
|
||||
|
||||
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
|
||||
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
|
||||
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(tuple<_Tp...>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(const tuple<_Tp...>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||
get(tuple<_Tp...>&&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(const pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||
get(pair<_T1, _T2>&&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_Tp&
|
||||
get(array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&&) _NOEXCEPT;
|
||||
|
||||
// __make_tuple_indices
|
||||
|
||||
template <size_t...> struct __tuple_indices {};
|
||||
|
||||
template <size_t _Sp, class _IntTuple, size_t _Ep>
|
||||
struct __make_indices_imp;
|
||||
|
||||
template <size_t _Sp, size_t ..._Indices, size_t _Ep>
|
||||
struct __make_indices_imp<_Sp, __tuple_indices<_Indices...>, _Ep>
|
||||
{
|
||||
typedef typename __make_indices_imp<_Sp+1, __tuple_indices<_Indices..., _Sp>, _Ep>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ep, size_t ..._Indices>
|
||||
struct __make_indices_imp<_Ep, __tuple_indices<_Indices...>, _Ep>
|
||||
{
|
||||
typedef __tuple_indices<_Indices...> type;
|
||||
};
|
||||
|
||||
template <size_t _Ep, size_t _Sp = 0>
|
||||
struct __make_tuple_indices
|
||||
{
|
||||
static_assert(_Sp <= _Ep, "__make_tuple_indices input error");
|
||||
typedef typename __make_indices_imp<_Sp, __tuple_indices<>, _Ep>::type type;
|
||||
};
|
||||
|
||||
// __tuple_types
|
||||
|
||||
template <class ..._Tp> struct __tuple_types {};
|
||||
|
||||
template <size_t _Ip>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<> >
|
||||
{
|
||||
public:
|
||||
static_assert(_Ip == 0, "tuple_element index out of range");
|
||||
static_assert(_Ip != 0, "tuple_element index out of range");
|
||||
};
|
||||
|
||||
template <class _Hp, class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<0, __tuple_types<_Hp, _Tp...> >
|
||||
{
|
||||
public:
|
||||
typedef _Hp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Hp, class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
|
||||
{
|
||||
public:
|
||||
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
|
||||
};
|
||||
|
||||
template <class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...> >
|
||||
: public integral_constant<size_t, sizeof...(_Tp)>
|
||||
{
|
||||
};
|
||||
|
||||
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {};
|
||||
|
||||
// __make_tuple_types
|
||||
|
||||
// __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a
|
||||
// __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep).
|
||||
// _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a
|
||||
// lvalue_reference type, then __tuple_types<_Types&...> is the result.
|
||||
|
||||
template <class _TupleTypes, class _Tp, size_t _Sp, size_t _Ep>
|
||||
struct __make_tuple_types_imp;
|
||||
|
||||
template <class ..._Types, class _Tp, size_t _Sp, size_t _Ep>
|
||||
struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
|
||||
{
|
||||
typedef typename remove_reference<_Tp>::type _Tpr;
|
||||
typedef typename __make_tuple_types_imp<__tuple_types<_Types...,
|
||||
typename conditional<is_lvalue_reference<_Tp>::value,
|
||||
typename tuple_element<_Sp, _Tpr>::type&,
|
||||
typename tuple_element<_Sp, _Tpr>::type>::type>,
|
||||
_Tp, _Sp+1, _Ep>::type type;
|
||||
};
|
||||
|
||||
template <class ..._Types, class _Tp, size_t _Ep>
|
||||
struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Ep, _Ep>
|
||||
{
|
||||
typedef __tuple_types<_Types...> type;
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, size_t _Sp = 0>
|
||||
struct __make_tuple_types
|
||||
{
|
||||
static_assert(_Sp <= _Ep, "__make_tuple_types input error");
|
||||
typedef typename __make_tuple_types_imp<__tuple_types<>, _Tp, _Sp, _Ep>::type type;
|
||||
};
|
||||
|
||||
// __tuple_convertible
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
struct __tuple_convertible_imp : public false_type {};
|
||||
|
||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
: public integral_constant<bool,
|
||||
is_constructible<_Up0, _Tp0>::value &&
|
||||
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
bool = __tuple_like<_Up>::value>
|
||||
struct __tuple_convertible
|
||||
: public false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_convertible<_Tp, _Up, true, true>
|
||||
: public __tuple_convertible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
{};
|
||||
|
||||
// __tuple_assignable
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
struct __tuple_assignable_imp : public false_type {};
|
||||
|
||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||
struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
: public integral_constant<bool,
|
||||
is_assignable<_Up0&, _Tp0>::value &&
|
||||
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
bool = __tuple_like<_Up>::value>
|
||||
struct __tuple_assignable
|
||||
: public false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_assignable<_Tp, _Up, true, true>
|
||||
: public __tuple_assignable_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
{};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#endif // _LIBCPP___TUPLE
|
25
final/include/__tuple_03
Normal file
25
final/include/__tuple_03
Normal file
@ -0,0 +1,25 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___TUPLE_03
|
||||
#define _LIBCPP___TUPLE_03
|
||||
|
||||
#include <__config>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
|
||||
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___TUPLE_03
|
5352
final/include/algorithm
Normal file
5352
final/include/algorithm
Normal file
File diff suppressed because it is too large
Load Diff
336
final/include/array
Normal file
336
final/include/array
Normal file
@ -0,0 +1,336 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- array -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_ARRAY
|
||||
#define _LIBCPP_ARRAY
|
||||
|
||||
/*
|
||||
array synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <class T, size_t N >
|
||||
struct array
|
||||
{
|
||||
// types:
|
||||
typedef T & reference;
|
||||
typedef const T & const_reference;
|
||||
typedef implementation defined iterator;
|
||||
typedef implementation defined const_iterator;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
void fill(const T& u);
|
||||
void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>())));
|
||||
|
||||
// iterators:
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// capacity:
|
||||
constexpr size_type size() const noexcept;
|
||||
constexpr size_type max_size() const noexcept;
|
||||
bool empty() const noexcept;
|
||||
|
||||
// element access:
|
||||
reference operator[](size_type n);
|
||||
const_reference operator[](size_type n) const;
|
||||
const_reference at(size_type n) const;
|
||||
reference at(size_type n);
|
||||
|
||||
reference front();
|
||||
const_reference front() const;
|
||||
reference back();
|
||||
const_reference back() const;
|
||||
|
||||
T* data() noexcept;
|
||||
const T* data() const noexcept;
|
||||
};
|
||||
|
||||
template <class T, size_t N>
|
||||
bool operator==(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator!=(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator<(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator>(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator<=(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator>=(const array<T,N>& x, const array<T,N>& y);
|
||||
|
||||
template <class T, size_t N >
|
||||
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class T> class tuple_size;
|
||||
template <int I, class T> class tuple_element;
|
||||
template <class T, size_t N> struct tuple_size<array<T, N>>;
|
||||
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
|
||||
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept;
|
||||
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept;
|
||||
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
#if defined(_LIBCPP_NO_EXCEPTIONS)
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
struct _LIBCPP_VISIBLE array
|
||||
{
|
||||
// types:
|
||||
typedef array __self;
|
||||
typedef _Tp value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef value_type* iterator;
|
||||
typedef const value_type* const_iterator;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
value_type __elems_[_Size > 0 ? _Size : 1];
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
|
||||
{_VSTD::fill_n(__elems_, _Size, __u);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{_VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
|
||||
|
||||
// iterators:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT {return iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const _NOEXCEPT {return begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const _NOEXCEPT {return end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
|
||||
|
||||
// capacity:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/ size_type size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const _NOEXCEPT {return _Size == 0;}
|
||||
|
||||
// element access:
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const {return __elems_[__n];}
|
||||
reference at(size_type __n);
|
||||
const_reference at(size_type __n) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return __elems_[0];}
|
||||
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type* data() _NOEXCEPT {return __elems_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const value_type* data() const _NOEXCEPT {return __elems_;}
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
typename array<_Tp, _Size>::reference
|
||||
array<_Tp, _Size>::at(size_type __n)
|
||||
{
|
||||
if (__n >= _Size)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw out_of_range("array::at");
|
||||
#else
|
||||
assert(!"array::at out_of_range");
|
||||
#endif
|
||||
return __elems_[__n];
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
typename array<_Tp, _Size>::const_reference
|
||||
array<_Tp, _Size>::at(size_type __n) const
|
||||
{
|
||||
if (__n >= _Size)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw out_of_range("array::at");
|
||||
#else
|
||||
assert(!"array::at out_of_range");
|
||||
#endif
|
||||
return __elems_[__n];
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return _VSTD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return _VSTD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
typename enable_if
|
||||
<
|
||||
__is_swappable<_Tp>::value,
|
||||
void
|
||||
>::type
|
||||
swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
class _LIBCPP_VISIBLE tuple_size<array<_Tp, _Size> >
|
||||
: public integral_constant<size_t, _Size> {};
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
class _LIBCPP_VISIBLE tuple_size<const array<_Tp, _Size> >
|
||||
: public integral_constant<size_t, _Size> {};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, array<_Tp, _Size> >
|
||||
{
|
||||
public:
|
||||
typedef _Tp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const array<_Tp, _Size> >
|
||||
{
|
||||
public:
|
||||
typedef const _Tp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
_Tp&
|
||||
get(array<_Tp, _Size>& __a) _NOEXCEPT
|
||||
{
|
||||
return __a[_Ip];
|
||||
}
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>& __a) _NOEXCEPT
|
||||
{
|
||||
return __a[_Ip];
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&& __a) _NOEXCEPT
|
||||
{
|
||||
return _VSTD::move(__a[_Ip]);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_ARRAY
|
1513
final/include/atomic
Normal file
1513
final/include/atomic
Normal file
File diff suppressed because it is too large
Load Diff
1046
final/include/bitset
Normal file
1046
final/include/bitset
Normal file
File diff suppressed because it is too large
Load Diff
23
final/include/cassert
Normal file
23
final/include/cassert
Normal file
@ -0,0 +1,23 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- cassert -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/*
|
||||
cassert synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
assert
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <assert.h>
|
||||
|
||||
#pragma GCC system_header
|
27
final/include/ccomplex
Normal file
27
final/include/ccomplex
Normal file
@ -0,0 +1,27 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- ccomplex ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CCOMPLEX
|
||||
#define _LIBCPP_CCOMPLEX
|
||||
|
||||
/*
|
||||
ccomplex synopsis
|
||||
|
||||
#include <complex>
|
||||
|
||||
*/
|
||||
|
||||
#include <complex>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
// hh 080623 Created
|
||||
|
||||
#endif // _LIBCPP_CCOMPLEX
|
159
final/include/cctype
Normal file
159
final/include/cctype
Normal file
@ -0,0 +1,159 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- cctype ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CCTYPE
|
||||
#define _LIBCPP_CCTYPE
|
||||
|
||||
/*
|
||||
cctype synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
int isalnum(int c);
|
||||
int isalpha(int c);
|
||||
int isblank(int c); // C99
|
||||
int iscntrl(int c);
|
||||
int isdigit(int c);
|
||||
int isgraph(int c);
|
||||
int islower(int c);
|
||||
int isprint(int c);
|
||||
int ispunct(int c);
|
||||
int isspace(int c);
|
||||
int isupper(int c);
|
||||
int isxdigit(int c);
|
||||
int tolower(int c);
|
||||
int toupper(int c);
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <ctype.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifdef isalnum
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalnum(int __c) {return isalnum(__c);}
|
||||
#undef isalnum
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isalnum(int __c) {return __libcpp_isalnum(__c);}
|
||||
#else // isalnum
|
||||
using ::isalnum;
|
||||
#endif // isalnum
|
||||
|
||||
#ifdef isalpha
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalpha(int __c) {return isalpha(__c);}
|
||||
#undef isalpha
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isalpha(int __c) {return __libcpp_isalpha(__c);}
|
||||
#else // isalpha
|
||||
using ::isalpha;
|
||||
#endif // isalpha
|
||||
|
||||
#ifdef isblank
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isblank(int __c) {return isblank(__c);}
|
||||
#undef isblank
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isblank(int __c) {return __libcpp_isblank(__c);}
|
||||
#else // isblank
|
||||
using ::isblank;
|
||||
#endif // isblank
|
||||
|
||||
#ifdef iscntrl
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iscntrl(int __c) {return iscntrl(__c);}
|
||||
#undef iscntrl
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iscntrl(int __c) {return __libcpp_iscntrl(__c);}
|
||||
#else // iscntrl
|
||||
using ::iscntrl;
|
||||
#endif // iscntrl
|
||||
|
||||
#ifdef isdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isdigit(int __c) {return isdigit(__c);}
|
||||
#undef isdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isdigit(int __c) {return __libcpp_isdigit(__c);}
|
||||
#else // isdigit
|
||||
using ::isdigit;
|
||||
#endif // isdigit
|
||||
|
||||
#ifdef isgraph
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isgraph(int __c) {return isgraph(__c);}
|
||||
#undef isgraph
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isgraph(int __c) {return __libcpp_isgraph(__c);}
|
||||
#else // isgraph
|
||||
using ::isgraph;
|
||||
#endif // isgraph
|
||||
|
||||
#ifdef islower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_islower(int __c) {return islower(__c);}
|
||||
#undef islower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int islower(int __c) {return __libcpp_islower(__c);}
|
||||
#else // islower
|
||||
using ::islower;
|
||||
#endif // islower
|
||||
|
||||
#ifdef isprint
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isprint(int __c) {return isprint(__c);}
|
||||
#undef isprint
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isprint(int __c) {return __libcpp_isprint(__c);}
|
||||
#else // isprint
|
||||
using ::isprint;
|
||||
#endif // isprint
|
||||
|
||||
#ifdef ispunct
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ispunct(int __c) {return ispunct(__c);}
|
||||
#undef ispunct
|
||||
inline _LIBCPP_INLINE_VISIBILITY int ispunct(int __c) {return __libcpp_ispunct(__c);}
|
||||
#else // ispunct
|
||||
using ::ispunct;
|
||||
#endif // ispunct
|
||||
|
||||
#ifdef isspace
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isspace(int __c) {return isspace(__c);}
|
||||
#undef isspace
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isspace(int __c) {return __libcpp_isspace(__c);}
|
||||
#else // isspace
|
||||
using ::isspace;
|
||||
#endif // isspace
|
||||
|
||||
#ifdef isupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isupper(int __c) {return isupper(__c);}
|
||||
#undef isupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isupper(int __c) {return __libcpp_isupper(__c);}
|
||||
#else // isupper
|
||||
using ::isupper;
|
||||
#endif // isupper
|
||||
|
||||
#ifdef isxdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isxdigit(int __c) {return isxdigit(__c);}
|
||||
#undef isxdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isxdigit(int __c) {return __libcpp_isxdigit(__c);}
|
||||
#else // isxdigit
|
||||
using ::isxdigit;
|
||||
#endif // isxdigit
|
||||
|
||||
#ifdef tolower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_tolower(int __c) {return tolower(__c);}
|
||||
#undef tolower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int tolower(int __c) {return __libcpp_tolower(__c);}
|
||||
#else // tolower
|
||||
using ::tolower;
|
||||
#endif // tolower
|
||||
|
||||
#ifdef toupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_toupper(int __c) {return toupper(__c);}
|
||||
#undef toupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int toupper(int __c) {return __libcpp_toupper(__c);}
|
||||
#else // toupper
|
||||
using ::toupper;
|
||||
#endif // toupper
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CCTYPE
|
391
final/include/cerrno
Normal file
391
final/include/cerrno
Normal file
@ -0,0 +1,391 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- cerrno ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CERRNO
|
||||
#define _LIBCPP_CERRNO
|
||||
|
||||
/*
|
||||
cerrno synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
EDOM
|
||||
EILSEQ // C99
|
||||
ERANGE
|
||||
errno
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <errno.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||
|
||||
#ifdef ELAST
|
||||
|
||||
const int __elast1 = ELAST+1;
|
||||
const int __elast2 = ELAST+2;
|
||||
|
||||
#else
|
||||
|
||||
const int __elast1 = 104;
|
||||
const int __elast2 = 105;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENOTRECOVERABLE
|
||||
|
||||
#define EOWNERDEAD __elast1
|
||||
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST EOWNERDEAD
|
||||
#endif
|
||||
|
||||
#elif defined(EOWNERDEAD)
|
||||
|
||||
#define ENOTRECOVERABLE __elast1
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST ENOTRECOVERABLE
|
||||
#endif
|
||||
|
||||
#else // defined(EOWNERDEAD)
|
||||
|
||||
#define EOWNERDEAD __elast1
|
||||
#define ENOTRECOVERABLE __elast2
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST ENOTRECOVERABLE
|
||||
#endif
|
||||
|
||||
#endif // defined(EOWNERDEAD)
|
||||
|
||||
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||
|
||||
// supply errno values likely to be missing, particularly on Windows
|
||||
|
||||
#ifndef EAFNOSUPPORT
|
||||
#define EAFNOSUPPORT 9901
|
||||
#endif
|
||||
|
||||
#ifndef EADDRINUSE
|
||||
#define EADDRINUSE 9902
|
||||
#endif
|
||||
|
||||
#ifndef EADDRNOTAVAIL
|
||||
#define EADDRNOTAVAIL 9903
|
||||
#endif
|
||||
|
||||
#ifndef EISCONN
|
||||
#define EISCONN 9904
|
||||
#endif
|
||||
|
||||
#ifndef EBADMSG
|
||||
#define EBADMSG 9905
|
||||
#endif
|
||||
|
||||
#ifndef ECONNABORTED
|
||||
#define ECONNABORTED 9906
|
||||
#endif
|
||||
|
||||
#ifndef EALREADY
|
||||
#define EALREADY 9907
|
||||
#endif
|
||||
|
||||
#ifndef ECONNREFUSED
|
||||
#define ECONNREFUSED 9908
|
||||
#endif
|
||||
|
||||
#ifndef ECONNRESET
|
||||
#define ECONNRESET 9909
|
||||
#endif
|
||||
|
||||
#ifndef EDESTADDRREQ
|
||||
#define EDESTADDRREQ 9910
|
||||
#endif
|
||||
|
||||
#ifndef EHOSTUNREACH
|
||||
#define EHOSTUNREACH 9911
|
||||
#endif
|
||||
|
||||
#ifndef EIDRM
|
||||
#define EIDRM 9912
|
||||
#endif
|
||||
|
||||
#ifndef EMSGSIZE
|
||||
#define EMSGSIZE 9913
|
||||
#endif
|
||||
|
||||
#ifndef ENETDOWN
|
||||
#define ENETDOWN 9914
|
||||
#endif
|
||||
|
||||
#ifndef ENETRESET
|
||||
#define ENETRESET 9915
|
||||
#endif
|
||||
|
||||
#ifndef ENETUNREACH
|
||||
#define ENETUNREACH 9916
|
||||
#endif
|
||||
|
||||
#ifndef ENOBUFS
|
||||
#define ENOBUFS 9917
|
||||
#endif
|
||||
|
||||
#ifndef ENOLINK
|
||||
#define ENOLINK 9918
|
||||
#endif
|
||||
|
||||
#ifndef ENODATA
|
||||
#define ENODATA 9919
|
||||
#endif
|
||||
|
||||
#ifndef ENOMSG
|
||||
#define ENOMSG 9920
|
||||
#endif
|
||||
|
||||
#ifndef ENOPROTOOPT
|
||||
#define ENOPROTOOPT 9921
|
||||
#endif
|
||||
|
||||
#ifndef ENOSR
|
||||
#define ENOSR 9922
|
||||
#endif
|
||||
|
||||
#ifndef ENOTSOCK
|
||||
#define ENOTSOCK 9923
|
||||
#endif
|
||||
|
||||
#ifndef ENOSTR
|
||||
#define ENOSTR 9924
|
||||
#endif
|
||||
|
||||
#ifndef ENOTCONN
|
||||
#define ENOTCONN 9925
|
||||
#endif
|
||||
|
||||
#ifndef ENOTSUP
|
||||
#define ENOTSUP 9926
|
||||
#endif
|
||||
|
||||
#ifndef ECANCELED
|
||||
#define ECANCELED 9927
|
||||
#endif
|
||||
|
||||
#ifndef EINPROGRESS
|
||||
#define EINPROGRESS 9928
|
||||
#endif
|
||||
|
||||
#ifndef EOPNOTSUPP
|
||||
#define EOPNOTSUPP 9929
|
||||
#endif
|
||||
|
||||
#ifndef EWOULDBLOCK
|
||||
#define EWOULDBLOCK 9930
|
||||
#endif
|
||||
|
||||
#ifndef EOWNERDEAD
|
||||
#define EOWNERDEAD 9931
|
||||
#endif
|
||||
|
||||
#ifndef EPROTO
|
||||
#define EPROTO 9932
|
||||
#endif
|
||||
|
||||
#ifndef EPROTONOSUPPORT
|
||||
#define EPROTONOSUPPORT 9933
|
||||
#endif
|
||||
|
||||
#ifndef ENOTRECOVERABLE
|
||||
#define ENOTRECOVERABLE 9934
|
||||
#endif
|
||||
|
||||
#ifndef ETIME
|
||||
#define ETIME 9935
|
||||
#endif
|
||||
|
||||
#ifndef ETXTBSY
|
||||
#define ETXTBSY 9936
|
||||
#endif
|
||||
|
||||
#ifndef ETIMEDOUT
|
||||
#define ETIMEDOUT 9938
|
||||
#endif
|
||||
|
||||
#ifndef ELOOP
|
||||
#define ELOOP 9939
|
||||
#endif
|
||||
|
||||
#ifndef EOVERFLOW
|
||||
#define EOVERFLOW 9940
|
||||
#endif
|
||||
|
||||
#ifndef EPROTOTYPE
|
||||
#define EPROTOTYPE 9941
|
||||
#endif
|
||||
|
||||
#ifndef ENOSYS
|
||||
#define ENOSYS 9942
|
||||
#endif
|
||||
|
||||
#ifndef EINVAL
|
||||
#define EINVAL 9943
|
||||
#endif
|
||||
|
||||
#ifndef ERANGE
|
||||
#define ERANGE 9944
|
||||
#endif
|
||||
|
||||
#ifndef EILSEQ
|
||||
#define EILSEQ 9945
|
||||
#endif
|
||||
|
||||
// Windows Mobile doesn't appear to define these:
|
||||
|
||||
#ifndef E2BIG
|
||||
#define E2BIG 9946
|
||||
#endif
|
||||
|
||||
#ifndef EDOM
|
||||
#define EDOM 9947
|
||||
#endif
|
||||
|
||||
#ifndef EFAULT
|
||||
#define EFAULT 9948
|
||||
#endif
|
||||
|
||||
#ifndef EBADF
|
||||
#define EBADF 9949
|
||||
#endif
|
||||
|
||||
#ifndef EPIPE
|
||||
#define EPIPE 9950
|
||||
#endif
|
||||
|
||||
#ifndef EXDEV
|
||||
#define EXDEV 9951
|
||||
#endif
|
||||
|
||||
#ifndef EBUSY
|
||||
#define EBUSY 9952
|
||||
#endif
|
||||
|
||||
#ifndef ENOTEMPTY
|
||||
#define ENOTEMPTY 9953
|
||||
#endif
|
||||
|
||||
#ifndef ENOEXEC
|
||||
#define ENOEXEC 9954
|
||||
#endif
|
||||
|
||||
#ifndef EEXIST
|
||||
#define EEXIST 9955
|
||||
#endif
|
||||
|
||||
#ifndef EFBIG
|
||||
#define EFBIG 9956
|
||||
#endif
|
||||
|
||||
#ifndef ENAMETOOLONG
|
||||
#define ENAMETOOLONG 9957
|
||||
#endif
|
||||
|
||||
#ifndef ENOTTY
|
||||
#define ENOTTY 9958
|
||||
#endif
|
||||
|
||||
#ifndef EINTR
|
||||
#define EINTR 9959
|
||||
#endif
|
||||
|
||||
#ifndef ESPIPE
|
||||
#define ESPIPE 9960
|
||||
#endif
|
||||
|
||||
#ifndef EIO
|
||||
#define EIO 9961
|
||||
#endif
|
||||
|
||||
#ifndef EISDIR
|
||||
#define EISDIR 9962
|
||||
#endif
|
||||
|
||||
#ifndef ECHILD
|
||||
#define ECHILD 9963
|
||||
#endif
|
||||
|
||||
#ifndef ENOLCK
|
||||
#define ENOLCK 9964
|
||||
#endif
|
||||
|
||||
#ifndef ENOSPC
|
||||
#define ENOSPC 9965
|
||||
#endif
|
||||
|
||||
#ifndef ENXIO
|
||||
#define ENXIO 9966
|
||||
#endif
|
||||
|
||||
#ifndef ENODEV
|
||||
#define ENODEV 9967
|
||||
#endif
|
||||
|
||||
#ifndef ENOENT
|
||||
#define ENOENT 9968
|
||||
#endif
|
||||
|
||||
#ifndef ESRCH
|
||||
#define ESRCH 9969
|
||||
#endif
|
||||
|
||||
#ifndef ENOTDIR
|
||||
#define ENOTDIR 9970
|
||||
#endif
|
||||
|
||||
#ifndef ENOMEM
|
||||
#define ENOMEM 9971
|
||||
#endif
|
||||
|
||||
#ifndef EPERM
|
||||
#define EPERM 9972
|
||||
#endif
|
||||
|
||||
#ifndef EACCES
|
||||
#define EACCES 9973
|
||||
#endif
|
||||
|
||||
#ifndef EROFS
|
||||
#define EROFS 9974
|
||||
#endif
|
||||
|
||||
#ifndef EDEADLK
|
||||
#define EDEADLK 9975
|
||||
#endif
|
||||
|
||||
#ifndef EAGAIN
|
||||
#define EAGAIN 9976
|
||||
#endif
|
||||
|
||||
#ifndef ENFILE
|
||||
#define ENFILE 9977
|
||||
#endif
|
||||
|
||||
#ifndef EMFILE
|
||||
#define EMFILE 9978
|
||||
#endif
|
||||
|
||||
#ifndef EMLINK
|
||||
#define EMLINK 9979
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CERRNO
|
80
final/include/cfenv
Normal file
80
final/include/cfenv
Normal file
@ -0,0 +1,80 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- cctype ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CFENV
|
||||
#define _LIBCPP_CFENV
|
||||
|
||||
/*
|
||||
cfenv synopsis
|
||||
|
||||
This entire header is C99 / C++0X
|
||||
|
||||
Macros:
|
||||
|
||||
FE_DIVBYZERO
|
||||
FE_INEXACT
|
||||
FE_INVALID
|
||||
FE_OVERFLOW
|
||||
FE_UNDERFLOW
|
||||
FE_ALL_EXCEPT
|
||||
FE_DOWNWARD
|
||||
FE_TONEAREST
|
||||
FE_TOWARDZERO
|
||||
FE_UPWARD
|
||||
FE_DFL_ENV
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
fenv_t
|
||||
fexcept_t
|
||||
|
||||
int feclearexcept(int excepts);
|
||||
int fegetexceptflag(fexcept_t* flagp, int excepts);
|
||||
int feraiseexcept(int excepts);
|
||||
int fesetexceptflag(const fexcept_t* flagp, int excepts);
|
||||
int fetestexcept(int excepts);
|
||||
int fegetround();
|
||||
int fesetround(int round);
|
||||
int fegetenv(fenv_t* envp);
|
||||
int feholdexcept(fenv_t* envp);
|
||||
int fesetenv(const fenv_t* envp);
|
||||
int feupdateenv(const fenv_t* envp);
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <fenv.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::fenv_t;
|
||||
using ::fexcept_t;
|
||||
|
||||
using ::feclearexcept;
|
||||
using ::fegetexceptflag;
|
||||
using ::feraiseexcept;
|
||||
using ::fesetexceptflag;
|
||||
using ::fetestexcept;
|
||||
using ::fegetround;
|
||||
using ::fesetround;
|
||||
using ::fegetenv;
|
||||
using ::feholdexcept;
|
||||
using ::fesetenv;
|
||||
using ::feupdateenv;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CFENV
|
76
final/include/cfloat
Normal file
76
final/include/cfloat
Normal file
@ -0,0 +1,76 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cfloat -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CFLOAT
|
||||
#define _LIBCPP_CFLOAT
|
||||
|
||||
/*
|
||||
cfloat synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
FLT_ROUNDS
|
||||
FLT_EVAL_METHOD // C99
|
||||
FLT_RADIX
|
||||
|
||||
FLT_MANT_DIG
|
||||
DBL_MANT_DIG
|
||||
LDBL_MANT_DIG
|
||||
|
||||
DECIMAL_DIG // C99
|
||||
|
||||
FLT_DIG
|
||||
DBL_DIG
|
||||
LDBL_DIG
|
||||
|
||||
FLT_MIN_EXP
|
||||
DBL_MIN_EXP
|
||||
LDBL_MIN_EXP
|
||||
|
||||
FLT_MIN_10_EXP
|
||||
DBL_MIN_10_EXP
|
||||
LDBL_MIN_10_EXP
|
||||
|
||||
FLT_MAX_EXP
|
||||
DBL_MAX_EXP
|
||||
LDBL_MAX_EXP
|
||||
|
||||
FLT_MAX_10_EXP
|
||||
DBL_MAX_10_EXP
|
||||
LDBL_MAX_10_EXP
|
||||
|
||||
FLT_MAX
|
||||
DBL_MAX
|
||||
LDBL_MAX
|
||||
|
||||
FLT_EPSILON
|
||||
DBL_EPSILON
|
||||
LDBL_EPSILON
|
||||
|
||||
FLT_MIN
|
||||
DBL_MIN
|
||||
LDBL_MIN
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <float.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#ifndef FLT_EVAL_METHOD
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
#endif
|
||||
|
||||
#ifndef DECIMAL_DIG
|
||||
#define DECIMAL_DIG __DECIMAL_DIG__
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CFLOAT
|
871
final/include/chrono
Normal file
871
final/include/chrono
Normal file
@ -0,0 +1,871 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- chrono ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CHRONO
|
||||
#define _LIBCPP_CHRONO
|
||||
|
||||
/*
|
||||
chrono synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
namespace chrono
|
||||
{
|
||||
|
||||
template <class ToDuration, class Rep, class Period>
|
||||
ToDuration
|
||||
duration_cast(const duration<Rep, Period>& fd);
|
||||
|
||||
template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {};
|
||||
|
||||
template <class Rep>
|
||||
struct duration_values
|
||||
{
|
||||
public:
|
||||
static Rep zero();
|
||||
static Rep max();
|
||||
static Rep min();
|
||||
};
|
||||
|
||||
// duration
|
||||
|
||||
template <class Rep, class Period = ratio<1>>
|
||||
class duration
|
||||
{
|
||||
static_assert(!__is_duration<Rep>::value, "A duration representation can not be a duration");
|
||||
static_assert(__is_ratio<Period>::value, "Second template parameter of duration must be a std::ratio");
|
||||
static_assert(Period::num > 0, "duration period must be positive");
|
||||
public:
|
||||
typedef Rep rep;
|
||||
typedef Period period;
|
||||
|
||||
duration() = default;
|
||||
template <class Rep2>
|
||||
explicit duration(const Rep2& r,
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<Rep2, rep>::value &&
|
||||
(treat_as_floating_point<rep>::value ||
|
||||
!treat_as_floating_point<rep>::value && !treat_as_floating_point<Rep2>::value)
|
||||
>::type* = 0);
|
||||
|
||||
// conversions
|
||||
template <class Rep2, class Period2>
|
||||
duration(const duration<Rep2, Period2>& d,
|
||||
typename enable_if
|
||||
<
|
||||
treat_as_floating_point<rep>::value ||
|
||||
ratio_divide<Period2, period>::type::den == 1
|
||||
>::type* = 0);
|
||||
|
||||
// observer
|
||||
|
||||
rep count() const;
|
||||
|
||||
// arithmetic
|
||||
|
||||
duration operator+() const;
|
||||
duration operator-() const;
|
||||
duration& operator++();
|
||||
duration operator++(int);
|
||||
duration& operator--();
|
||||
duration operator--(int);
|
||||
|
||||
duration& operator+=(const duration& d);
|
||||
duration& operator-=(const duration& d);
|
||||
|
||||
duration& operator*=(const rep& rhs);
|
||||
duration& operator/=(const rep& rhs);
|
||||
|
||||
// special values
|
||||
|
||||
static duration zero();
|
||||
static duration min();
|
||||
static duration max();
|
||||
};
|
||||
|
||||
typedef duration<long long, nano> nanoseconds;
|
||||
typedef duration<long long, micro> microseconds;
|
||||
typedef duration<long long, milli> milliseconds;
|
||||
typedef duration<long long > seconds;
|
||||
typedef duration< long, ratio< 60> > minutes;
|
||||
typedef duration< long, ratio<3600> > hours;
|
||||
|
||||
template <class Clock, class Duration = typename Clock::duration>
|
||||
class time_point
|
||||
{
|
||||
public:
|
||||
typedef Clock clock;
|
||||
typedef Duration duration;
|
||||
typedef typename duration::rep rep;
|
||||
typedef typename duration::period period;
|
||||
private:
|
||||
duration d_; // exposition only
|
||||
|
||||
public:
|
||||
time_point(); // has value "epoch"
|
||||
explicit time_point(const duration& d); // same as time_point() + d
|
||||
|
||||
// conversions
|
||||
template <class Duration2>
|
||||
time_point(const time_point<clock, Duration2>& t);
|
||||
|
||||
// observer
|
||||
|
||||
duration time_since_epoch() const;
|
||||
|
||||
// arithmetic
|
||||
|
||||
time_point& operator+=(const duration& d);
|
||||
time_point& operator-=(const duration& d);
|
||||
|
||||
// special values
|
||||
|
||||
static constexpr time_point min();
|
||||
static constexpr time_point max();
|
||||
};
|
||||
|
||||
} // chrono
|
||||
|
||||
// common_type traits
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>;
|
||||
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>;
|
||||
|
||||
namespace chrono {
|
||||
|
||||
// duration arithmetic
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
||||
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
||||
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period, class Rep2>
|
||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||
operator*(const duration<Rep1, Period>& d, const Rep2& s);
|
||||
template <class Rep1, class Period, class Rep2>
|
||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||
operator*(const Rep1& s, const duration<Rep2, Period>& d);
|
||||
template <class Rep1, class Period, class Rep2>
|
||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||
operator/(const duration<Rep1, Period>& d, const Rep2& s);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
typename common_type<Rep1, Rep2>::type
|
||||
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
|
||||
// duration comparisons
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
|
||||
// duration_cast
|
||||
template <class ToDuration, class Rep, class Period>
|
||||
ToDuration duration_cast(const duration<Rep, Period>& d);
|
||||
|
||||
// time_point arithmetic
|
||||
template <class Clock, class Duration1, class Rep2, class Period2>
|
||||
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
|
||||
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Clock, class Duration2>
|
||||
time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type>
|
||||
operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
template <class Clock, class Duration1, class Rep2, class Period2>
|
||||
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
|
||||
operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
typename common_type<Duration1, Duration2>::type
|
||||
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
|
||||
// time_point comparisons
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
bool operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
bool operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
bool operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
bool operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
|
||||
// time_point_cast
|
||||
|
||||
template <class ToDuration, class Clock, class Duration>
|
||||
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
|
||||
|
||||
// Clocks
|
||||
|
||||
class system_clock
|
||||
{
|
||||
public:
|
||||
typedef microseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<system_clock> time_point;
|
||||
static const bool is_steady = false;
|
||||
|
||||
static time_point now() noexcept;
|
||||
static time_t to_time_t (const time_point& __t) noexcept;
|
||||
static time_point from_time_t(time_t __t) noexcept;
|
||||
};
|
||||
|
||||
class steady_clock
|
||||
{
|
||||
public:
|
||||
typedef nanoseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||
static const bool is_steady = true;
|
||||
|
||||
static time_point now() noexcept;
|
||||
};
|
||||
|
||||
typedef steady_clock high_resolution_clock;
|
||||
|
||||
} // chrono
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <ctime>
|
||||
#include <type_traits>
|
||||
#include <ratio>
|
||||
#include <limits>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
namespace chrono
|
||||
{
|
||||
|
||||
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_VISIBLE duration;
|
||||
|
||||
template <class _Tp>
|
||||
struct __is_duration : false_type {};
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
struct __is_duration<duration<_Rep, _Period> > : true_type {};
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
struct __is_duration<const duration<_Rep, _Period> > : true_type {};
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
struct __is_duration<volatile duration<_Rep, _Period> > : true_type {};
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
|
||||
|
||||
} // chrono
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
struct _LIBCPP_VISIBLE common_type<chrono::duration<_Rep1, _Period1>,
|
||||
chrono::duration<_Rep2, _Period2> >
|
||||
{
|
||||
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
|
||||
typename __ratio_gcd<_Period1, _Period2>::type> type;
|
||||
};
|
||||
|
||||
namespace chrono {
|
||||
|
||||
// duration_cast
|
||||
|
||||
template <class _FromDuration, class _ToDuration,
|
||||
class _Period = typename ratio_divide<typename _FromDuration::period, typename _ToDuration::period>::type,
|
||||
bool = _Period::num == 1,
|
||||
bool = _Period::den == 1>
|
||||
struct __duration_cast;
|
||||
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||
return _ToDuration(static_cast<typename _ToDuration::rep>(
|
||||
static_cast<_Ct>(__fd.count()) / static_cast<_Ct>(_Period::den)));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||
return _ToDuration(static_cast<typename _ToDuration::rep>(
|
||||
static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||
return _ToDuration(static_cast<typename _ToDuration::rep>(
|
||||
static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)
|
||||
/ static_cast<_Ct>(_Period::den)));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _ToDuration, class _Rep, class _Period>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
__is_duration<_ToDuration>::value,
|
||||
_ToDuration
|
||||
>::type
|
||||
duration_cast(const duration<_Rep, _Period>& __fd)
|
||||
{
|
||||
return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
|
||||
}
|
||||
|
||||
template <class _Rep>
|
||||
struct _LIBCPP_VISIBLE treat_as_floating_point : is_floating_point<_Rep> {};
|
||||
|
||||
template <class _Rep>
|
||||
struct _LIBCPP_VISIBLE duration_values
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _Rep max() {return numeric_limits<_Rep>::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _Rep min() {return numeric_limits<_Rep>::lowest();}
|
||||
};
|
||||
|
||||
// duration
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
class _LIBCPP_VISIBLE duration
|
||||
{
|
||||
static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
|
||||
static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
|
||||
static_assert(_Period::num > 0, "duration period must be positive");
|
||||
public:
|
||||
typedef _Rep rep;
|
||||
typedef _Period period;
|
||||
private:
|
||||
rep __rep_;
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration() {} // = default;
|
||||
template <class _Rep2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit duration(const _Rep2& __r,
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Rep2, rep>::value &&
|
||||
(treat_as_floating_point<rep>::value ||
|
||||
!treat_as_floating_point<_Rep2>::value)
|
||||
>::type* = 0)
|
||||
: __rep_(__r) {}
|
||||
|
||||
// conversions
|
||||
template <class _Rep2, class _Period2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
duration(const duration<_Rep2, _Period2>& __d,
|
||||
typename enable_if
|
||||
<
|
||||
treat_as_floating_point<rep>::value ||
|
||||
(ratio_divide<_Period2, period>::type::den == 1 &&
|
||||
!treat_as_floating_point<_Rep2>::value)
|
||||
>::type* = 0)
|
||||
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
|
||||
|
||||
// observer
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
|
||||
|
||||
// arithmetic
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator--(int) {return duration(__rep_--);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator+=(const duration& __d) {__rep_ += __d.count(); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator-=(const duration& __d) {__rep_ -= __d.count(); return *this;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator*=(const rep& rhs) {__rep_ *= rhs; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator/=(const rep& rhs) {__rep_ /= rhs; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator%=(const rep& rhs) {__rep_ %= rhs; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator%=(const duration& rhs) {__rep_ %= rhs.count(); return *this;}
|
||||
|
||||
// special values
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values<rep>::zero());}
|
||||
_LIBCPP_INLINE_VISIBILITY static duration min() {return duration(duration_values<rep>::min());}
|
||||
_LIBCPP_INLINE_VISIBILITY static duration max() {return duration(duration_values<rep>::max());}
|
||||
};
|
||||
|
||||
typedef duration<long long, nano> nanoseconds;
|
||||
typedef duration<long long, micro> microseconds;
|
||||
typedef duration<long long, milli> milliseconds;
|
||||
typedef duration<long long > seconds;
|
||||
typedef duration< long, ratio< 60> > minutes;
|
||||
typedef duration< long, ratio<3600> > hours;
|
||||
|
||||
// Duration ==
|
||||
|
||||
template <class _LhsDuration, class _RhsDuration>
|
||||
struct __duration_eq
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
|
||||
{
|
||||
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
||||
return _Ct(__lhs).count() == _Ct(__rhs).count();
|
||||
}
|
||||
};
|
||||
|
||||
template <class _LhsDuration>
|
||||
struct __duration_eq<_LhsDuration, _LhsDuration>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
|
||||
{return __lhs.count() == __rhs.count();}
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return __duration_eq<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
|
||||
}
|
||||
|
||||
// Duration !=
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
|
||||
// Duration <
|
||||
|
||||
template <class _LhsDuration, class _RhsDuration>
|
||||
struct __duration_lt
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
|
||||
{
|
||||
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
||||
return _Ct(__lhs).count() < _Ct(__rhs).count();
|
||||
}
|
||||
};
|
||||
|
||||
template <class _LhsDuration>
|
||||
struct __duration_lt<_LhsDuration, _LhsDuration>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
|
||||
{return __lhs.count() < __rhs.count();}
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return __duration_lt<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
|
||||
}
|
||||
|
||||
// Duration >
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return __rhs < __lhs;
|
||||
}
|
||||
|
||||
// Duration <=
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return !(__rhs < __lhs);
|
||||
}
|
||||
|
||||
// Duration >=
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return !(__lhs < __rhs);
|
||||
}
|
||||
|
||||
// Duration +
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||
__r += __rhs;
|
||||
return __r;
|
||||
}
|
||||
|
||||
// Duration -
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||
__r -= __rhs;
|
||||
return __r;
|
||||
}
|
||||
|
||||
// Duration *
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
|
||||
duration<typename common_type<_Rep1, _Rep2>::type, _Period>
|
||||
>::type
|
||||
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||
{
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
duration<_Cr, _Period> __r = __d;
|
||||
__r *= static_cast<_Cr>(__s);
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
|
||||
duration<typename common_type<_Rep1, _Rep2>::type, _Period>
|
||||
>::type
|
||||
operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
|
||||
{
|
||||
return __d * __s;
|
||||
}
|
||||
|
||||
// Duration /
|
||||
|
||||
template <class _Duration, class _Rep, bool = __is_duration<_Rep>::value>
|
||||
struct __duration_divide_result
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Duration, class _Rep2,
|
||||
bool = is_convertible<_Rep2,
|
||||
typename common_type<typename _Duration::rep, _Rep2>::type>::value>
|
||||
struct __duration_divide_imp
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
struct __duration_divide_imp<duration<_Rep1, _Period>, _Rep2, true>
|
||||
{
|
||||
typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period> type;
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
|
||||
: __duration_divide_imp<duration<_Rep1, _Period>, _Rep2>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
||||
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||
{
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
duration<_Cr, _Period> __r = __d;
|
||||
__r /= static_cast<_Cr>(__s);
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename common_type<_Rep1, _Rep2>::type
|
||||
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Ct;
|
||||
return _Ct(__lhs).count() / _Ct(__rhs).count();
|
||||
}
|
||||
|
||||
// Duration %
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
||||
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||
{
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
duration<_Cr, _Period> __r = __d;
|
||||
__r %= static_cast<_Cr>(__s);
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||
__r %= __rhs;
|
||||
return __r;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
///////////////////// time_point /////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
template <class _Clock, class _Duration = typename _Clock::duration>
|
||||
class _LIBCPP_VISIBLE time_point
|
||||
{
|
||||
static_assert(__is_duration<_Duration>::value,
|
||||
"Second template parameter of time_point must be a std::chrono::duration");
|
||||
public:
|
||||
typedef _Clock clock;
|
||||
typedef _Duration duration;
|
||||
typedef typename duration::rep rep;
|
||||
typedef typename duration::period period;
|
||||
private:
|
||||
duration __d_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY time_point() : __d_(duration::zero()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit time_point(const duration& __d) : __d_(__d) {}
|
||||
|
||||
// conversions
|
||||
template <class _Duration2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
time_point(const time_point<clock, _Duration2>& t,
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Duration2, duration>::value
|
||||
>::type* = 0)
|
||||
: __d_(t.time_since_epoch()) {}
|
||||
|
||||
// observer
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration time_since_epoch() const {return __d_;}
|
||||
|
||||
// arithmetic
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d;}
|
||||
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d;}
|
||||
|
||||
// special values
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY static time_point min() {return time_point(duration::min());}
|
||||
_LIBCPP_INLINE_VISIBILITY static time_point max() {return time_point(duration::max());}
|
||||
};
|
||||
|
||||
} // chrono
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
struct _LIBCPP_VISIBLE common_type<chrono::time_point<_Clock, _Duration1>,
|
||||
chrono::time_point<_Clock, _Duration2> >
|
||||
{
|
||||
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
|
||||
};
|
||||
|
||||
namespace chrono {
|
||||
|
||||
template <class _ToDuration, class _Clock, class _Duration>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
time_point<_Clock, _ToDuration>
|
||||
time_point_cast(const time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
|
||||
}
|
||||
|
||||
// time_point ==
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return __lhs.time_since_epoch() == __rhs.time_since_epoch();
|
||||
}
|
||||
|
||||
// time_point !=
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
|
||||
// time_point <
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return __lhs.time_since_epoch() < __rhs.time_since_epoch();
|
||||
}
|
||||
|
||||
// time_point >
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return __rhs < __lhs;
|
||||
}
|
||||
|
||||
// time_point <=
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return !(__rhs < __lhs);
|
||||
}
|
||||
|
||||
// time_point >=
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return !(__lhs < __rhs);
|
||||
}
|
||||
|
||||
// time_point operator+(time_point x, duration y);
|
||||
|
||||
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
|
||||
operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
|
||||
_Tr __r(__lhs.time_since_epoch());
|
||||
__r += __rhs;
|
||||
return __r;
|
||||
}
|
||||
|
||||
// time_point operator+(duration x, time_point y);
|
||||
|
||||
template <class _Rep1, class _Period1, class _Clock, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
|
||||
operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return __rhs + __lhs;
|
||||
}
|
||||
|
||||
// time_point operator-(time_point x, duration y);
|
||||
|
||||
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
|
||||
operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return __lhs + (-__rhs);
|
||||
}
|
||||
|
||||
// duration operator-(time_point x, time_point y);
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename common_type<_Duration1, _Duration2>::type
|
||||
operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return __lhs.time_since_epoch() - __rhs.time_since_epoch();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
/////////////////////// clocks ///////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
class _LIBCPP_VISIBLE system_clock
|
||||
{
|
||||
public:
|
||||
typedef microseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<system_clock> time_point;
|
||||
static const bool is_steady = false;
|
||||
|
||||
static time_point now() _NOEXCEPT;
|
||||
static time_t to_time_t (const time_point& __t) _NOEXCEPT;
|
||||
static time_point from_time_t(time_t __t) _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_VISIBLE steady_clock
|
||||
{
|
||||
public:
|
||||
typedef nanoseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||
static const bool is_steady = true;
|
||||
|
||||
static time_point now() _NOEXCEPT;
|
||||
};
|
||||
|
||||
typedef steady_clock high_resolution_clock;
|
||||
|
||||
} // chrono
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CHRONO
|
257
final/include/cinttypes
Normal file
257
final/include/cinttypes
Normal file
@ -0,0 +1,257 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cinttypes --------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CINTTYPES
|
||||
#define _LIBCPP_CINTTYPES
|
||||
|
||||
/*
|
||||
cinttypes synopsis
|
||||
|
||||
This entire header is C99 / C++0X
|
||||
|
||||
#include <cstdint> // <cinttypes> includes <cstdint>
|
||||
|
||||
Macros:
|
||||
|
||||
PRId8
|
||||
PRId16
|
||||
PRId32
|
||||
PRId64
|
||||
|
||||
PRIdLEAST8
|
||||
PRIdLEAST16
|
||||
PRIdLEAST32
|
||||
PRIdLEAST64
|
||||
|
||||
PRIdFAST8
|
||||
PRIdFAST16
|
||||
PRIdFAST32
|
||||
PRIdFAST64
|
||||
|
||||
PRIdMAX
|
||||
PRIdPTR
|
||||
|
||||
PRIi8
|
||||
PRIi16
|
||||
PRIi32
|
||||
PRIi64
|
||||
|
||||
PRIiLEAST8
|
||||
PRIiLEAST16
|
||||
PRIiLEAST32
|
||||
PRIiLEAST64
|
||||
|
||||
PRIiFAST8
|
||||
PRIiFAST16
|
||||
PRIiFAST32
|
||||
PRIiFAST64
|
||||
|
||||
PRIiMAX
|
||||
PRIiPTR
|
||||
|
||||
PRIo8
|
||||
PRIo16
|
||||
PRIo32
|
||||
PRIo64
|
||||
|
||||
PRIoLEAST8
|
||||
PRIoLEAST16
|
||||
PRIoLEAST32
|
||||
PRIoLEAST64
|
||||
|
||||
PRIoFAST8
|
||||
PRIoFAST16
|
||||
PRIoFAST32
|
||||
PRIoFAST64
|
||||
|
||||
PRIoMAX
|
||||
PRIoPTR
|
||||
|
||||
PRIu8
|
||||
PRIu16
|
||||
PRIu32
|
||||
PRIu64
|
||||
|
||||
PRIuLEAST8
|
||||
PRIuLEAST16
|
||||
PRIuLEAST32
|
||||
PRIuLEAST64
|
||||
|
||||
PRIuFAST8
|
||||
PRIuFAST16
|
||||
PRIuFAST32
|
||||
PRIuFAST64
|
||||
|
||||
PRIuMAX
|
||||
PRIuPTR
|
||||
|
||||
PRIx8
|
||||
PRIx16
|
||||
PRIx32
|
||||
PRIx64
|
||||
|
||||
PRIxLEAST8
|
||||
PRIxLEAST16
|
||||
PRIxLEAST32
|
||||
PRIxLEAST64
|
||||
|
||||
PRIxFAST8
|
||||
PRIxFAST16
|
||||
PRIxFAST32
|
||||
PRIxFAST64
|
||||
|
||||
PRIxMAX
|
||||
PRIxPTR
|
||||
|
||||
PRIX8
|
||||
PRIX16
|
||||
PRIX32
|
||||
PRIX64
|
||||
|
||||
PRIXLEAST8
|
||||
PRIXLEAST16
|
||||
PRIXLEAST32
|
||||
PRIXLEAST64
|
||||
|
||||
PRIXFAST8
|
||||
PRIXFAST16
|
||||
PRIXFAST32
|
||||
PRIXFAST64
|
||||
|
||||
PRIXMAX
|
||||
PRIXPTR
|
||||
|
||||
SCNd8
|
||||
SCNd16
|
||||
SCNd32
|
||||
SCNd64
|
||||
|
||||
SCNdLEAST8
|
||||
SCNdLEAST16
|
||||
SCNdLEAST32
|
||||
SCNdLEAST64
|
||||
|
||||
SCNdFAST8
|
||||
SCNdFAST16
|
||||
SCNdFAST32
|
||||
SCNdFAST64
|
||||
|
||||
SCNdMAX
|
||||
SCNdPTR
|
||||
|
||||
SCNi8
|
||||
SCNi16
|
||||
SCNi32
|
||||
SCNi64
|
||||
|
||||
SCNiLEAST8
|
||||
SCNiLEAST16
|
||||
SCNiLEAST32
|
||||
SCNiLEAST64
|
||||
|
||||
SCNiFAST8
|
||||
SCNiFAST16
|
||||
SCNiFAST32
|
||||
SCNiFAST64
|
||||
|
||||
SCNiMAX
|
||||
SCNiPTR
|
||||
|
||||
SCNo8
|
||||
SCNo16
|
||||
SCNo32
|
||||
SCNo64
|
||||
|
||||
SCNoLEAST8
|
||||
SCNoLEAST16
|
||||
SCNoLEAST32
|
||||
SCNoLEAST64
|
||||
|
||||
SCNoFAST8
|
||||
SCNoFAST16
|
||||
SCNoFAST32
|
||||
SCNoFAST64
|
||||
|
||||
SCNoMAX
|
||||
SCNoPTR
|
||||
|
||||
SCNu8
|
||||
SCNu16
|
||||
SCNu32
|
||||
SCNu64
|
||||
|
||||
SCNuLEAST8
|
||||
SCNuLEAST16
|
||||
SCNuLEAST32
|
||||
SCNuLEAST64
|
||||
|
||||
SCNuFAST8
|
||||
SCNuFAST16
|
||||
SCNuFAST32
|
||||
SCNuFAST64
|
||||
|
||||
SCNuMAX
|
||||
SCNuPTR
|
||||
|
||||
SCNx8
|
||||
SCNx16
|
||||
SCNx32
|
||||
SCNx64
|
||||
|
||||
SCNxLEAST8
|
||||
SCNxLEAST16
|
||||
SCNxLEAST32
|
||||
SCNxLEAST64
|
||||
|
||||
SCNxFAST8
|
||||
SCNxFAST16
|
||||
SCNxFAST32
|
||||
SCNxFAST64
|
||||
|
||||
SCNxMAX
|
||||
SCNxPTR
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
imaxdiv_t
|
||||
|
||||
intmax_t imaxabs(intmax_t j);
|
||||
imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
|
||||
intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base);
|
||||
uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base);
|
||||
intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
|
||||
uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cstdint>
|
||||
#include <inttypes.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using::imaxdiv_t;
|
||||
|
||||
using::imaxabs;
|
||||
using::imaxdiv;
|
||||
using::strtoimax;
|
||||
using::strtoumax;
|
||||
using::wcstoimax;
|
||||
using::wcstoumax;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CINTTYPES
|
23
final/include/ciso646
Normal file
23
final/include/ciso646
Normal file
@ -0,0 +1,23 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- ciso646 ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CISO646
|
||||
#define _LIBCPP_CISO646
|
||||
|
||||
/*
|
||||
ciso646 synopsis
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#endif // _LIBCPP_CISO646
|
46
final/include/climits
Normal file
46
final/include/climits
Normal file
@ -0,0 +1,46 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- climits ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CLIMITS
|
||||
#define _LIBCPP_CLIMITS
|
||||
|
||||
/*
|
||||
climits synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
CHAR_BIT
|
||||
SCHAR_MIN
|
||||
SCHAR_MAX
|
||||
UCHAR_MAX
|
||||
CHAR_MIN
|
||||
CHAR_MAX
|
||||
MB_LEN_MAX
|
||||
SHRT_MIN
|
||||
SHRT_MAX
|
||||
USHRT_MAX
|
||||
INT_MIN
|
||||
INT_MAX
|
||||
UINT_MAX
|
||||
LONG_MIN
|
||||
LONG_MAX
|
||||
ULONG_MAX
|
||||
LLONG_MIN // C99
|
||||
LLONG_MAX // C99
|
||||
ULLONG_MAX // C99
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <limits.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#endif // _LIBCPP_CLIMITS
|
51
final/include/clocale
Normal file
51
final/include/clocale
Normal file
@ -0,0 +1,51 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- clocale ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CLOCALE
|
||||
#define _LIBCPP_CLOCALE
|
||||
|
||||
/*
|
||||
clocale synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
LC_ALL
|
||||
LC_COLLATE
|
||||
LC_CTYPE
|
||||
LC_MONETARY
|
||||
LC_NUMERIC
|
||||
LC_TIME
|
||||
NULL
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
struct lconv;
|
||||
char* setlocale(int category, const char* locale);
|
||||
lconv* localeconv();
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <locale.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::lconv;
|
||||
using ::setlocale;
|
||||
using ::localeconv;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CLOCALE
|
1574
final/include/cmath
Normal file
1574
final/include/cmath
Normal file
File diff suppressed because it is too large
Load Diff
545
final/include/codecvt
Normal file
545
final/include/codecvt
Normal file
@ -0,0 +1,545 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- codecvt -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CODECVT
|
||||
#define _LIBCPP_CODECVT
|
||||
|
||||
/*
|
||||
codecvt synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
enum codecvt_mode
|
||||
{
|
||||
consume_header = 4,
|
||||
generate_header = 2,
|
||||
little_endian = 1
|
||||
};
|
||||
|
||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
codecvt_mode Mode = (codecvt_mode)0>
|
||||
class codecvt_utf8
|
||||
: public codecvt<Elem, char, mbstate_t>
|
||||
{
|
||||
// unspecified
|
||||
};
|
||||
|
||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
codecvt_mode Mode = (codecvt_mode)0>
|
||||
class codecvt_utf16
|
||||
: public codecvt<Elem, char, mbstate_t>
|
||||
{
|
||||
// unspecified
|
||||
};
|
||||
|
||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
codecvt_mode Mode = (codecvt_mode)0>
|
||||
class codecvt_utf8_utf16
|
||||
: public codecvt<Elem, char, mbstate_t>
|
||||
{
|
||||
// unspecified
|
||||
};
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__locale>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
enum codecvt_mode
|
||||
{
|
||||
consume_header = 4,
|
||||
generate_header = 2,
|
||||
little_endian = 1
|
||||
};
|
||||
|
||||
// codecvt_utf8
|
||||
|
||||
template <class _Elem> class __codecvt_utf8;
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8<wchar_t>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8<char16_t>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8<char32_t>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class _LIBCPP_VISIBLE codecvt_utf8
|
||||
: public __codecvt_utf8<_Elem>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_utf8(size_t __refs = 0)
|
||||
: __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf8() {}
|
||||
};
|
||||
|
||||
// codecvt_utf16
|
||||
|
||||
template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<wchar_t, false>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<wchar_t, true>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<char16_t, false>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<char16_t, true>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<char32_t, false>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<char32_t, true>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class _LIBCPP_VISIBLE codecvt_utf16
|
||||
: public __codecvt_utf16<_Elem, _Mode & little_endian>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_utf16(size_t __refs = 0)
|
||||
: __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf16() {}
|
||||
};
|
||||
|
||||
// codecvt_utf8_utf16
|
||||
|
||||
template <class _Elem> class __codecvt_utf8_utf16;
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8_utf16<wchar_t>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8_utf16<char32_t>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8_utf16<char16_t>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class _LIBCPP_VISIBLE codecvt_utf8_utf16
|
||||
: public __codecvt_utf8_utf16<_Elem>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_utf8_utf16(size_t __refs = 0)
|
||||
: __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf8_utf16() {}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CODECVT
|
1514
final/include/complex
Normal file
1514
final/include/complex
Normal file
File diff suppressed because it is too large
Load Diff
33
final/include/complex.h
Normal file
33
final/include/complex.h
Normal file
@ -0,0 +1,33 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- complex.h --------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_COMPLEX_H
|
||||
#define _LIBCPP_COMPLEX_H
|
||||
|
||||
/*
|
||||
complex.h synopsis
|
||||
|
||||
#include <ccomplex>
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <ccomplex>
|
||||
|
||||
#else // __cplusplus
|
||||
|
||||
#include_next <complex.h>
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#endif // _LIBCPP_COMPLEX_H
|
254
final/include/condition_variable
Normal file
254
final/include/condition_variable
Normal file
@ -0,0 +1,254 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------- condition_variable ----------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CONDITION_VARIABLE
|
||||
#define _LIBCPP_CONDITION_VARIABLE
|
||||
|
||||
/*
|
||||
condition_variable synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
enum class cv_status { no_timeout, timeout };
|
||||
|
||||
class condition_variable
|
||||
{
|
||||
public:
|
||||
condition_variable();
|
||||
~condition_variable();
|
||||
|
||||
condition_variable(const condition_variable&) = delete;
|
||||
condition_variable& operator=(const condition_variable&) = delete;
|
||||
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
|
||||
void wait(unique_lock<mutex>& lock);
|
||||
template <class Predicate>
|
||||
void wait(unique_lock<mutex>& lock, Predicate pred);
|
||||
|
||||
template <class Clock, class Duration>
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& lock,
|
||||
const chrono::time_point<Clock, Duration>& abs_time);
|
||||
|
||||
template <class Clock, class Duration, class Predicate>
|
||||
bool
|
||||
wait_until(unique_lock<mutex>& lock,
|
||||
const chrono::time_point<Clock, Duration>& abs_time,
|
||||
Predicate pred);
|
||||
|
||||
template <class Rep, class Period>
|
||||
cv_status
|
||||
wait_for(unique_lock<mutex>& lock,
|
||||
const chrono::duration<Rep, Period>& rel_time);
|
||||
|
||||
template <class Rep, class Period, class Predicate>
|
||||
bool
|
||||
wait_for(unique_lock<mutex>& lock,
|
||||
const chrono::duration<Rep, Period>& rel_time,
|
||||
Predicate pred);
|
||||
|
||||
typedef pthread_cond_t* native_handle_type;
|
||||
native_handle_type native_handle();
|
||||
};
|
||||
|
||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
class condition_variable_any
|
||||
{
|
||||
public:
|
||||
condition_variable_any();
|
||||
~condition_variable_any();
|
||||
|
||||
condition_variable_any(const condition_variable_any&) = delete;
|
||||
condition_variable_any& operator=(const condition_variable_any&) = delete;
|
||||
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
|
||||
template <class Lock>
|
||||
void wait(Lock& lock);
|
||||
template <class Lock, class Predicate>
|
||||
void wait(Lock& lock, Predicate pred);
|
||||
|
||||
template <class Lock, class Clock, class Duration>
|
||||
cv_status
|
||||
wait_until(Lock& lock,
|
||||
const chrono::time_point<Clock, Duration>& abs_time);
|
||||
|
||||
template <class Lock, class Clock, class Duration, class Predicate>
|
||||
bool
|
||||
wait_until(Lock& lock,
|
||||
const chrono::time_point<Clock, Duration>& abs_time,
|
||||
Predicate pred);
|
||||
|
||||
template <class Lock, class Rep, class Period>
|
||||
cv_status
|
||||
wait_for(Lock& lock,
|
||||
const chrono::duration<Rep, Period>& rel_time);
|
||||
|
||||
template <class Lock, class Rep, class Period, class Predicate>
|
||||
bool
|
||||
wait_for(Lock& lock,
|
||||
const chrono::duration<Rep, Period>& rel_time,
|
||||
Predicate pred);
|
||||
};
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__mutex_base>
|
||||
#include <memory>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_VISIBLE condition_variable_any
|
||||
{
|
||||
condition_variable __cv_;
|
||||
shared_ptr<mutex> __mut_;
|
||||
public:
|
||||
condition_variable_any();
|
||||
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
|
||||
template <class _Lock>
|
||||
void wait(_Lock& __lock);
|
||||
template <class _Lock, class _Predicate>
|
||||
void wait(_Lock& __lock, _Predicate __pred);
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration>
|
||||
cv_status
|
||||
wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
||||
bool
|
||||
wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred);
|
||||
|
||||
template <class _Lock, class _Rep, class _Period>
|
||||
cv_status
|
||||
wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d);
|
||||
|
||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||
bool
|
||||
wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred);
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
condition_variable_any::condition_variable_any()
|
||||
: __mut_(make_shared<mutex>()) {}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::notify_one()
|
||||
{
|
||||
{lock_guard<mutex> _(*__mut_);}
|
||||
__cv_.notify_one();
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::notify_all()
|
||||
{
|
||||
{lock_guard<mutex> _(*__mut_);}
|
||||
__cv_.notify_all();
|
||||
}
|
||||
|
||||
struct __lock_external
|
||||
{
|
||||
template <class _Lock>
|
||||
void operator()(_Lock* __m) {__m->lock();}
|
||||
};
|
||||
|
||||
template <class _Lock>
|
||||
void
|
||||
condition_variable_any::wait(_Lock& __lock)
|
||||
{
|
||||
shared_ptr<mutex> __mut = __mut_;
|
||||
unique_lock<mutex> __lk(*__mut);
|
||||
__lock.unlock();
|
||||
unique_ptr<_Lock, __lock_external> __(&__lock);
|
||||
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
|
||||
__cv_.wait(__lk);
|
||||
} // __mut_.unlock(), __lock.lock()
|
||||
|
||||
template <class _Lock, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
|
||||
{
|
||||
while (!__pred())
|
||||
wait(__lock);
|
||||
}
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration>
|
||||
cv_status
|
||||
condition_variable_any::wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
shared_ptr<mutex> __mut = __mut_;
|
||||
unique_lock<mutex> __lk(*__mut);
|
||||
__lock.unlock();
|
||||
unique_ptr<_Lock, __lock_external> __(&__lock);
|
||||
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
|
||||
return __cv_.wait_until(__lk, __t);
|
||||
} // __mut_.unlock(), __lock.lock()
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable_any::wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred)
|
||||
{
|
||||
while (!__pred())
|
||||
if (wait_until(__lock, __t) == cv_status::timeout)
|
||||
return __pred();
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Lock, class _Rep, class _Period>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
cv_status
|
||||
condition_variable_any::wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d);
|
||||
}
|
||||
|
||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable_any::wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d,
|
||||
_VSTD::move(__pred));
|
||||
}
|
||||
|
||||
_LIBCPP_VISIBLE
|
||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CONDITION_VARIABLE
|
50
final/include/csetjmp
Normal file
50
final/include/csetjmp
Normal file
@ -0,0 +1,50 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- csetjmp ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSETJMP
|
||||
#define _LIBCPP_CSETJMP
|
||||
|
||||
/*
|
||||
csetjmp synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
setjmp
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
jmp_buf
|
||||
|
||||
void longjmp(jmp_buf env, int val);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <setjmp.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#ifndef setjmp
|
||||
#define setjmp(env) setjmp(env)
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::jmp_buf;
|
||||
using ::longjmp;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSETJMP
|
56
final/include/csignal
Normal file
56
final/include/csignal
Normal file
@ -0,0 +1,56 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- csignal ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSIGNAL
|
||||
#define _LIBCPP_CSIGNAL
|
||||
|
||||
/*
|
||||
csignal synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
SIG_DFL
|
||||
SIG_ERR
|
||||
SIG_IGN
|
||||
SIGABRT
|
||||
SIGFPE
|
||||
SIGILL
|
||||
SIGINT
|
||||
SIGSEGV
|
||||
SIGTERM
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
sig_atomic_t
|
||||
|
||||
void (*signal(int sig, void (*func)(int)))(int);
|
||||
int raise(int sig);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <signal.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::sig_atomic_t;
|
||||
using ::signal;
|
||||
using ::raise;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSIGNAL
|
46
final/include/cstdarg
Normal file
46
final/include/cstdarg
Normal file
@ -0,0 +1,46 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cstdarg ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDARG
|
||||
#define _LIBCPP_CSTDARG
|
||||
|
||||
/*
|
||||
cstdarg synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
type va_arg(va_list ap, type);
|
||||
void va_copy(va_list dest, va_list src); // C99
|
||||
void va_end(va_list ap);
|
||||
void va_start(va_list ap, parmN);
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
va_list
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <stdarg.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::va_list;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTDARG
|
30
final/include/cstdbool
Normal file
30
final/include/cstdbool
Normal file
@ -0,0 +1,30 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cstdbool ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDBOOL
|
||||
#define _LIBCPP_CSTDBOOL
|
||||
|
||||
/*
|
||||
cstdbool synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
__bool_true_false_are_defined
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#undef __bool_true_false_are_defined
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif // _LIBCPP_CSTDBOOL
|
100
final/include/cstddef
Normal file
100
final/include/cstddef
Normal file
@ -0,0 +1,100 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cstddef ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDDEF
|
||||
#define _LIBCPP_CSTDDEF
|
||||
|
||||
/*
|
||||
cstddef synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
offsetof(type,member-designator)
|
||||
NULL
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
ptrdiff_t
|
||||
size_t
|
||||
max_align_t
|
||||
nullptr_t
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
|
||||
#ifdef __GLIBC__
|
||||
#define __need_NULL
|
||||
#define __need_ptrdiff_t
|
||||
#define __need_size_t
|
||||
#endif // __GLIBC__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::ptrdiff_t;
|
||||
using ::size_t;
|
||||
|
||||
typedef long double max_align_t;
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
struct _LIBCPP_VISIBLE nullptr_t
|
||||
{
|
||||
void* _;
|
||||
|
||||
struct __nat {int __for_bool_;};
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
operator _Tp* () const {return 0;}
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
operator _Tp _Up::* () const {return 0;}
|
||||
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
|
||||
};
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||
|
||||
#define nullptr _VSTD::__get_nullptr_t()
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
namespace std
|
||||
{
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
#endif // _LIBCPP_CSTDDEF
|
189
final/include/cstdint
Normal file
189
final/include/cstdint
Normal file
@ -0,0 +1,189 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cstdint ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDINT
|
||||
#define _LIBCPP_CSTDINT
|
||||
|
||||
/*
|
||||
cstdint synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
INT8_MIN
|
||||
INT16_MIN
|
||||
INT32_MIN
|
||||
INT64_MIN
|
||||
|
||||
INT8_MAX
|
||||
INT16_MAX
|
||||
INT32_MAX
|
||||
INT64_MAX
|
||||
|
||||
UINT8_MAX
|
||||
UINT16_MAX
|
||||
UINT32_MAX
|
||||
UINT64_MAX
|
||||
|
||||
INT_LEAST8_MIN
|
||||
INT_LEAST16_MIN
|
||||
INT_LEAST32_MIN
|
||||
INT_LEAST64_MIN
|
||||
|
||||
INT_LEAST8_MAX
|
||||
INT_LEAST16_MAX
|
||||
INT_LEAST32_MAX
|
||||
INT_LEAST64_MAX
|
||||
|
||||
UINT_LEAST8_MAX
|
||||
UINT_LEAST16_MAX
|
||||
UINT_LEAST32_MAX
|
||||
UINT_LEAST64_MAX
|
||||
|
||||
INT_FAST8_MIN
|
||||
INT_FAST16_MIN
|
||||
INT_FAST32_MIN
|
||||
INT_FAST64_MIN
|
||||
|
||||
INT_FAST8_MAX
|
||||
INT_FAST16_MAX
|
||||
INT_FAST32_MAX
|
||||
INT_FAST64_MAX
|
||||
|
||||
UINT_FAST8_MAX
|
||||
UINT_FAST16_MAX
|
||||
UINT_FAST32_MAX
|
||||
UINT_FAST64_MAX
|
||||
|
||||
INTPTR_MIN
|
||||
INTPTR_MAX
|
||||
UINTPTR_MAX
|
||||
|
||||
INTMAX_MIN
|
||||
INTMAX_MAX
|
||||
|
||||
UINTMAX_MAX
|
||||
|
||||
PTRDIFF_MIN
|
||||
PTRDIFF_MAX
|
||||
|
||||
SIG_ATOMIC_MIN
|
||||
SIG_ATOMIC_MAX
|
||||
|
||||
SIZE_MAX
|
||||
|
||||
WCHAR_MIN
|
||||
WCHAR_MAX
|
||||
|
||||
WINT_MIN
|
||||
WINT_MAX
|
||||
|
||||
INT8_C(value)
|
||||
INT16_C(value)
|
||||
INT32_C(value)
|
||||
INT64_C(value)
|
||||
|
||||
UINT8_C(value)
|
||||
UINT16_C(value)
|
||||
UINT32_C(value)
|
||||
UINT64_C(value)
|
||||
|
||||
INTMAX_C(value)
|
||||
UINTMAX_C(value)
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
int8_t
|
||||
int16_t
|
||||
int32_t
|
||||
int64_t
|
||||
|
||||
uint8_t
|
||||
uint16_t
|
||||
uint32_t
|
||||
uint64_t
|
||||
|
||||
int_least8_t
|
||||
int_least16_t
|
||||
int_least32_t
|
||||
int_least64_t
|
||||
|
||||
uint_least8_t
|
||||
uint_least16_t
|
||||
uint_least32_t
|
||||
uint_least64_t
|
||||
|
||||
int_fast8_t
|
||||
int_fast16_t
|
||||
int_fast32_t
|
||||
int_fast64_t
|
||||
|
||||
uint_fast8_t
|
||||
uint_fast16_t
|
||||
uint_fast32_t
|
||||
uint_fast64_t
|
||||
|
||||
intptr_t
|
||||
uintptr_t
|
||||
|
||||
intmax_t
|
||||
uintmax_t
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <stdint.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using::int8_t;
|
||||
using::int16_t;
|
||||
using::int32_t;
|
||||
using::int64_t;
|
||||
|
||||
using::uint8_t;
|
||||
using::uint16_t;
|
||||
using::uint32_t;
|
||||
using::uint64_t;
|
||||
|
||||
using::int_least8_t;
|
||||
using::int_least16_t;
|
||||
using::int_least32_t;
|
||||
using::int_least64_t;
|
||||
|
||||
using::uint_least8_t;
|
||||
using::uint_least16_t;
|
||||
using::uint_least32_t;
|
||||
using::uint_least64_t;
|
||||
|
||||
using::int_fast8_t;
|
||||
using::int_fast16_t;
|
||||
using::int_fast32_t;
|
||||
using::int_fast64_t;
|
||||
|
||||
using::uint_fast8_t;
|
||||
using::uint_fast16_t;
|
||||
using::uint_fast32_t;
|
||||
using::uint_fast64_t;
|
||||
|
||||
using::intptr_t;
|
||||
using::uintptr_t;
|
||||
|
||||
using::intmax_t;
|
||||
using::uintmax_t;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTDINT
|
159
final/include/cstdio
Normal file
159
final/include/cstdio
Normal file
@ -0,0 +1,159 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- cstdio ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDIO
|
||||
#define _LIBCPP_CSTDIO
|
||||
|
||||
/*
|
||||
cstdio synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
BUFSIZ
|
||||
EOF
|
||||
FILENAME_MAX
|
||||
FOPEN_MAX
|
||||
L_tmpnam
|
||||
NULL
|
||||
SEEK_CUR
|
||||
SEEK_END
|
||||
SEEK_SET
|
||||
TMP_MAX
|
||||
_IOFBF
|
||||
_IOLBF
|
||||
_IONBF
|
||||
stderr
|
||||
stdin
|
||||
stdout
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
FILE
|
||||
fpos_t
|
||||
size_t
|
||||
|
||||
int remove(const char* filename);
|
||||
int rename(const char* old, const char* new);
|
||||
FILE* tmpfile(void);
|
||||
char* tmpnam(char* s);
|
||||
int fclose(FILE* stream);
|
||||
int fflush(FILE* stream);
|
||||
FILE* fopen(const char* restrict filename, const char* restrict mode);
|
||||
FILE* freopen(const char* restrict filename, const char * restrict mode,
|
||||
FILE * restrict stream);
|
||||
void setbuf(FILE* restrict stream, char* restrict buf);
|
||||
int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
|
||||
int fprintf(FILE* restrict stream, const char* restrict format, ...);
|
||||
int fscanf(FILE* restrict stream, const char * restrict format, ...);
|
||||
int printf(const char* restrict format, ...);
|
||||
int scanf(const char* restrict format, ...);
|
||||
int snprintf(char* restrict s, size_t n, const char* restrict format, ...); // C99
|
||||
int sprintf(char* restrict s, const char* restrict format, ...);
|
||||
int sscanf(const char* restrict s, const char* restrict format, ...);
|
||||
int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
|
||||
int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); // C99
|
||||
int vprintf(const char* restrict format, va_list arg);
|
||||
int vscanf(const char* restrict format, va_list arg); // C99
|
||||
int vsnprintf(char* restrict s, size_t n, const char* restrict format, // C99
|
||||
va_list arg);
|
||||
int vsprintf(char* restrict s, const char* restrict format, va_list arg);
|
||||
int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
|
||||
int fgetc(FILE* stream);
|
||||
char* fgets(char* restrict s, int n, FILE* restrict stream);
|
||||
int fputc(int c, FILE* stream);
|
||||
int fputs(const char* restrict s, FILE* restrict stream);
|
||||
int getc(FILE* stream);
|
||||
int getchar(void);
|
||||
char* gets(char* s);
|
||||
int putc(int c, FILE* stream);
|
||||
int putchar(int c);
|
||||
int puts(const char* s);
|
||||
int ungetc(int c, FILE* stream);
|
||||
size_t fread(void* restrict ptr, size_t size, size_t nmemb,
|
||||
FILE* restrict stream);
|
||||
size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
|
||||
FILE* restrict stream);
|
||||
int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
|
||||
int fseek(FILE* stream, long offset, int whence);
|
||||
int fsetpos(FILE*stream, const fpos_t* pos);
|
||||
long ftell(FILE* stream);
|
||||
void rewind(FILE* stream);
|
||||
void clearerr(FILE* stream);
|
||||
int feof(FILE* stream);
|
||||
int ferror(FILE* stream);
|
||||
void perror(const char* s);
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <stdio.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::FILE;
|
||||
using ::fpos_t;
|
||||
using ::size_t;
|
||||
|
||||
using ::remove;
|
||||
using ::rename;
|
||||
using ::tmpfile;
|
||||
using ::tmpnam;
|
||||
using ::fclose;
|
||||
using ::fflush;
|
||||
using ::fopen;
|
||||
using ::freopen;
|
||||
using ::setbuf;
|
||||
using ::setvbuf;
|
||||
using ::fprintf;
|
||||
using ::fscanf;
|
||||
using ::printf;
|
||||
using ::scanf;
|
||||
using ::snprintf;
|
||||
using ::sprintf;
|
||||
using ::sscanf;
|
||||
using ::vfprintf;
|
||||
using ::vfscanf;
|
||||
using ::vprintf;
|
||||
using ::vscanf;
|
||||
using ::vsnprintf;
|
||||
using ::vsprintf;
|
||||
using ::vsscanf;
|
||||
using ::fgetc;
|
||||
using ::fgets;
|
||||
using ::fputc;
|
||||
using ::fputs;
|
||||
using ::getc;
|
||||
using ::getchar;
|
||||
using ::gets;
|
||||
using ::putc;
|
||||
using ::putchar;
|
||||
using ::puts;
|
||||
using ::ungetc;
|
||||
using ::fread;
|
||||
using ::fwrite;
|
||||
using ::fgetpos;
|
||||
using ::fseek;
|
||||
using ::fsetpos;
|
||||
using ::ftell;
|
||||
using ::rewind;
|
||||
using ::clearerr;
|
||||
using ::feof;
|
||||
using ::ferror;
|
||||
using ::perror;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTDIO
|
138
final/include/cstdlib
Normal file
138
final/include/cstdlib
Normal file
@ -0,0 +1,138 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cstdlib ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDLIB
|
||||
#define _LIBCPP_CSTDLIB
|
||||
|
||||
/*
|
||||
cstdlib synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
EXIT_FAILURE
|
||||
EXIT_SUCCESS
|
||||
MB_CUR_MAX
|
||||
NULL
|
||||
RAND_MAX
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
size_t
|
||||
div_t
|
||||
ldiv_t
|
||||
lldiv_t // C99
|
||||
|
||||
double atof (const char* nptr);
|
||||
int atoi (const char* nptr);
|
||||
long atol (const char* nptr);
|
||||
long long atoll(const char* nptr); // C99
|
||||
double strtod (const char* restrict nptr, char** restrict endptr);
|
||||
float strtof (const char* restrict nptr, char** restrict endptr); // C99
|
||||
long double strtold (const char* restrict nptr, char** restrict endptr); // C99
|
||||
long strtol (const char* restrict nptr, char** restrict endptr, int base);
|
||||
long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99
|
||||
unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base);
|
||||
unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99
|
||||
int rand(void);
|
||||
void srand(unsigned int seed);
|
||||
void* calloc(size_t nmemb, size_t size);
|
||||
void free(void* ptr);
|
||||
void* malloc(size_t size);
|
||||
void* realloc(void* ptr, size_t size);
|
||||
void abort(void);
|
||||
int atexit(void (*func)(void));
|
||||
void exit(int status);
|
||||
void _Exit(int status);
|
||||
char* getenv(const char* name);
|
||||
int system(const char* string);
|
||||
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
|
||||
int (*compar)(const void *, const void *));
|
||||
void qsort(void* base, size_t nmemb, size_t size,
|
||||
int (*compar)(const void *, const void *));
|
||||
int abs( int j);
|
||||
long abs( long j);
|
||||
long long abs(long long j); // C++0X
|
||||
long labs( long j);
|
||||
long long llabs(long long j); // C99
|
||||
div_t div( int numer, int denom);
|
||||
ldiv_t div( long numer, long denom);
|
||||
lldiv_t div(long long numer, long long denom); // C++0X
|
||||
ldiv_t ldiv( long numer, long denom);
|
||||
lldiv_t lldiv(long long numer, long long denom); // C99
|
||||
int mblen(const char* s, size_t n);
|
||||
int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
|
||||
int wctomb(char* s, wchar_t wchar);
|
||||
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
|
||||
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <stdlib.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::size_t;
|
||||
using ::div_t;
|
||||
using ::ldiv_t;
|
||||
using ::lldiv_t;
|
||||
using ::atof;
|
||||
using ::atoi;
|
||||
using ::atol;
|
||||
using ::atoll;
|
||||
using ::strtod;
|
||||
using ::strtof;
|
||||
using ::strtold;
|
||||
using ::strtol;
|
||||
using ::strtoll;
|
||||
using ::strtoul;
|
||||
using ::strtoull;
|
||||
using ::rand;
|
||||
using ::srand;
|
||||
using ::calloc;
|
||||
using ::free;
|
||||
using ::malloc;
|
||||
using ::realloc;
|
||||
using ::abort;
|
||||
using ::atexit;
|
||||
using ::exit;
|
||||
using ::_Exit;
|
||||
using ::getenv;
|
||||
using ::system;
|
||||
using ::bsearch;
|
||||
using ::qsort;
|
||||
using ::abs;
|
||||
using ::labs;
|
||||
using ::llabs;
|
||||
using ::div;
|
||||
using ::ldiv;
|
||||
using ::lldiv;
|
||||
using ::mblen;
|
||||
using ::mbtowc;
|
||||
using ::wctomb;
|
||||
using ::mbstowcs;
|
||||
using ::wcstombs;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) {return labs(__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) {return ldiv(__x, __y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTDLIB
|
109
final/include/cstring
Normal file
109
final/include/cstring
Normal file
@ -0,0 +1,109 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cstring ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTRING
|
||||
#define _LIBCPP_CSTRING
|
||||
|
||||
/*
|
||||
cstring synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
NULL
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
size_t
|
||||
|
||||
void* memcpy(void* restrict s1, const void* restrict s2, size_t n);
|
||||
void* memmove(void* s1, const void* s2, size_t n);
|
||||
char* strcpy (char* restrict s1, const char* restrict s2);
|
||||
char* strncpy(char* restrict s1, const char* restrict s2, size_t n);
|
||||
char* strcat (char* restrict s1, const char* restrict s2);
|
||||
char* strncat(char* restrict s1, const char* restrict s2, size_t n);
|
||||
int memcmp(const void* s1, const void* s2, size_t n);
|
||||
int strcmp (const char* s1, const char* s2);
|
||||
int strncmp(const char* s1, const char* s2, size_t n);
|
||||
int strcoll(const char* s1, const char* s2);
|
||||
size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n);
|
||||
const void* memchr(const void* s, int c, size_t n);
|
||||
void* memchr( void* s, int c, size_t n);
|
||||
const char* strchr(const char* s, int c);
|
||||
char* strchr( char* s, int c);
|
||||
size_t strcspn(const char* s1, const char* s2);
|
||||
const char* strpbrk(const char* s1, const char* s2);
|
||||
char* strpbrk( char* s1, const char* s2);
|
||||
const char* strrchr(const char* s, int c);
|
||||
char* strrchr( char* s, int c);
|
||||
size_t strspn(const char* s1, const char* s2);
|
||||
const char* strstr(const char* s1, const char* s2);
|
||||
char* strstr( char* s1, const char* s2);
|
||||
char* strtok(char* restrict s1, const char* restrict s2);
|
||||
void* memset(void* s, int c, size_t n);
|
||||
char* strerror(int errnum);
|
||||
size_t strlen(const char* s);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <string.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::size_t;
|
||||
using ::memcpy;
|
||||
using ::memmove;
|
||||
using ::strcpy;
|
||||
using ::strncpy;
|
||||
using ::strcat;
|
||||
using ::strncat;
|
||||
using ::memcmp;
|
||||
using ::strcmp;
|
||||
using ::strncmp;
|
||||
using ::strcoll;
|
||||
using ::strxfrm;
|
||||
|
||||
using ::memchr;
|
||||
|
||||
using ::strchr;
|
||||
|
||||
using ::strcspn;
|
||||
|
||||
using ::strpbrk;
|
||||
|
||||
using ::strrchr;
|
||||
|
||||
using ::strspn;
|
||||
|
||||
using ::strstr;
|
||||
|
||||
#ifndef __GLIBC__ // GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
|
||||
#endif
|
||||
|
||||
using ::strtok;
|
||||
using ::memset;
|
||||
using ::strerror;
|
||||
using ::strlen;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTRING
|
27
final/include/ctgmath
Normal file
27
final/include/ctgmath
Normal file
@ -0,0 +1,27 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- ctgmath -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CTGMATH
|
||||
#define _LIBCPP_CTGMATH
|
||||
|
||||
/*
|
||||
ctgmath synopsis
|
||||
|
||||
#include <ccomplex>
|
||||
#include <cmath>
|
||||
|
||||
*/
|
||||
|
||||
#include <ccomplex>
|
||||
#include <cmath>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#endif // _LIBCPP_CTGMATH
|
70
final/include/ctime
Normal file
70
final/include/ctime
Normal file
@ -0,0 +1,70 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- ctime -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CTIME
|
||||
#define _LIBCPP_CTIME
|
||||
|
||||
/*
|
||||
ctime synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
NULL
|
||||
CLOCKS_PER_SEC
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
clock_t
|
||||
size_t
|
||||
time_t
|
||||
tm
|
||||
|
||||
clock_t clock();
|
||||
double difftime(time_t time1, time_t time0);
|
||||
time_t mktime(tm* timeptr);
|
||||
time_t time(time_t* timer);
|
||||
char* asctime(const tm* timeptr);
|
||||
char* ctime(const time_t* timer);
|
||||
tm* gmtime(const time_t* timer);
|
||||
tm* localtime(const time_t* timer);
|
||||
size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
|
||||
const tm* restrict timeptr);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <time.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::clock_t;
|
||||
using ::size_t;
|
||||
using ::time_t;
|
||||
using ::tm;
|
||||
using ::clock;
|
||||
using ::difftime;
|
||||
using ::mktime;
|
||||
using ::time;
|
||||
using ::asctime;
|
||||
using ::ctime;
|
||||
using ::gmtime;
|
||||
using ::localtime;
|
||||
using ::strftime;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CTIME
|
198
final/include/cwchar
Normal file
198
final/include/cwchar
Normal file
@ -0,0 +1,198 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cwchar -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CWCHAR
|
||||
#define _LIBCPP_CWCHAR
|
||||
|
||||
/*
|
||||
cwchar synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
NULL
|
||||
WCHAR_MAX
|
||||
WCHAR_MIN
|
||||
WEOF
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
mbstate_t
|
||||
size_t
|
||||
tm
|
||||
wint_t
|
||||
|
||||
int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
|
||||
int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
|
||||
int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
|
||||
int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
|
||||
int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
|
||||
int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99
|
||||
int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
|
||||
int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99
|
||||
int vwprintf(const wchar_t* restrict format, va_list arg);
|
||||
int vwscanf(const wchar_t* restrict format, va_list arg); // C99
|
||||
int wprintf(const wchar_t* restrict format, ...);
|
||||
int wscanf(const wchar_t* restrict format, ...);
|
||||
wint_t fgetwc(FILE* stream);
|
||||
wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
|
||||
wint_t fputwc(wchar_t c, FILE* stream);
|
||||
int fputws(const wchar_t* restrict s, FILE* restrict stream);
|
||||
int fwide(FILE* stream, int mode);
|
||||
wint_t getwc(FILE* stream);
|
||||
wint_t getwchar();
|
||||
wint_t putwc(wchar_t c, FILE* stream);
|
||||
wint_t putwchar(wchar_t c);
|
||||
wint_t ungetwc(wint_t c, FILE* stream);
|
||||
double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
|
||||
float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
|
||||
long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
|
||||
long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
|
||||
long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
|
||||
unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
|
||||
unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
|
||||
wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
|
||||
wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
||||
wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
|
||||
wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
||||
int wcscmp(const wchar_t* s1, const wchar_t* s2);
|
||||
int wcscoll(const wchar_t* s1, const wchar_t* s2);
|
||||
int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
|
||||
size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
||||
const wchar_t* wcschr(const wchar_t* s, wchar_t c);
|
||||
wchar_t* wcschr( wchar_t* s, wchar_t c);
|
||||
size_t wcscspn(const wchar_t* s1, const wchar_t* s2);
|
||||
size_t wcslen(const wchar_t* s);
|
||||
const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
|
||||
wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2);
|
||||
const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
|
||||
wchar_t* wcsrchr( wchar_t* s, wchar_t c);
|
||||
size_t wcsspn(const wchar_t* s1, const wchar_t* s2);
|
||||
const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
|
||||
wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2);
|
||||
wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
|
||||
const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
|
||||
wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n);
|
||||
int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
||||
wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
||||
wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
|
||||
wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
|
||||
size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
|
||||
const tm* restrict timeptr);
|
||||
wint_t btowc(int c);
|
||||
int wctob(wint_t c);
|
||||
int mbsinit(const mbstate_t* ps);
|
||||
size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
|
||||
size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
|
||||
size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
|
||||
size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
|
||||
mbstate_t* restrict ps);
|
||||
size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
|
||||
mbstate_t* restrict ps);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cwctype>
|
||||
#include <wchar.h>
|
||||
#if _WIN32
|
||||
#include <support/win32/support.h> // pull in *swprintf defines
|
||||
#endif // _WIN32
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::mbstate_t;
|
||||
using ::size_t;
|
||||
using ::tm;
|
||||
using ::wint_t;
|
||||
using ::FILE;
|
||||
using ::fwprintf;
|
||||
using ::fwscanf;
|
||||
using ::swprintf;
|
||||
using ::swscanf;
|
||||
using ::vfwprintf;
|
||||
using ::vfwscanf;
|
||||
using ::vswprintf;
|
||||
using ::vswscanf;
|
||||
using ::vwprintf;
|
||||
using ::vwscanf;
|
||||
using ::wprintf;
|
||||
using ::wscanf;
|
||||
using ::fgetwc;
|
||||
using ::fgetws;
|
||||
using ::fputwc;
|
||||
using ::fputws;
|
||||
using ::fwide;
|
||||
using ::getwc;
|
||||
using ::getwchar;
|
||||
using ::putwc;
|
||||
using ::putwchar;
|
||||
using ::ungetwc;
|
||||
using ::wcstod;
|
||||
using ::wcstof;
|
||||
using ::wcstold;
|
||||
using ::wcstol;
|
||||
using ::wcstoll;
|
||||
using ::wcstoul;
|
||||
using ::wcstoull;
|
||||
using ::wcscpy;
|
||||
using ::wcsncpy;
|
||||
using ::wcscat;
|
||||
using ::wcsncat;
|
||||
using ::wcscmp;
|
||||
using ::wcscoll;
|
||||
using ::wcsncmp;
|
||||
using ::wcsxfrm;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
|
||||
|
||||
using ::wcscspn;
|
||||
using ::wcslen;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
|
||||
|
||||
using ::wcsspn;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
|
||||
|
||||
using ::wcstok;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
|
||||
|
||||
using ::wmemcmp;
|
||||
using ::wmemcpy;
|
||||
using ::wmemmove;
|
||||
using ::wmemset;
|
||||
using ::wcsftime;
|
||||
using ::btowc;
|
||||
using ::wctob;
|
||||
using ::mbsinit;
|
||||
using ::mbrlen;
|
||||
using ::mbrtowc;
|
||||
using ::wcrtomb;
|
||||
using ::mbsrtowcs;
|
||||
using ::wcsrtombs;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CWCHAR
|
211
final/include/cwctype
Normal file
211
final/include/cwctype
Normal file
@ -0,0 +1,211 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cwctype ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CWCTYPE
|
||||
#define _LIBCPP_CWCTYPE
|
||||
|
||||
/*
|
||||
cwctype synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
WEOF
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
wint_t
|
||||
wctrans_t
|
||||
wctype_t
|
||||
|
||||
int iswalnum(wint_t wc);
|
||||
int iswalpha(wint_t wc);
|
||||
int iswblank(wint_t wc); // C99
|
||||
int iswcntrl(wint_t wc);
|
||||
int iswdigit(wint_t wc);
|
||||
int iswgraph(wint_t wc);
|
||||
int iswlower(wint_t wc);
|
||||
int iswprint(wint_t wc);
|
||||
int iswpunct(wint_t wc);
|
||||
int iswspace(wint_t wc);
|
||||
int iswupper(wint_t wc);
|
||||
int iswxdigit(wint_t wc);
|
||||
int iswctype(wint_t wc, wctype_t desc);
|
||||
wctype_t wctype(const char* property);
|
||||
wint_t towlower(wint_t wc);
|
||||
wint_t towupper(wint_t wc);
|
||||
wint_t towctrans(wint_t wc, wctrans_t desc);
|
||||
wctrans_t wctrans(const char* property);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cctype>
|
||||
#include <wctype.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::wint_t;
|
||||
using ::wctrans_t;
|
||||
using ::wctype_t;
|
||||
|
||||
#ifdef iswalnum
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalnum(wint_t __wc) {return iswalnum(__wc);}
|
||||
#undef iswalnum
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswalnum(wint_t __wc) {return __libcpp_iswalnum(__wc);}
|
||||
#else // iswalnum
|
||||
using ::iswalnum;
|
||||
#endif
|
||||
|
||||
#ifdef iswalpha
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalpha(wint_t __wc) {return iswalpha(__wc);}
|
||||
#undef iswalpha
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswalpha(wint_t __wc) {return __libcpp_iswalpha(__wc);}
|
||||
#else // iswalpha
|
||||
using ::iswalpha;
|
||||
#endif
|
||||
|
||||
#ifdef iswblank
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswblank(wint_t __wc) {return iswblank(__wc);}
|
||||
#undef iswblank
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswblank(wint_t __wc) {return __libcpp_iswblank(__wc);}
|
||||
#else // iswblank
|
||||
using ::iswblank;
|
||||
#endif
|
||||
|
||||
#ifdef iswcntrl
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswcntrl(wint_t __wc) {return iswcntrl(__wc);}
|
||||
#undef iswcntrl
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswcntrl(wint_t __wc) {return __libcpp_iswcntrl(__wc);}
|
||||
#else // iswcntrl
|
||||
using ::iswcntrl;
|
||||
#endif
|
||||
|
||||
#ifdef iswdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswdigit(wint_t __wc) {return iswdigit(__wc);}
|
||||
#undef iswdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswdigit(wint_t __wc) {return __libcpp_iswdigit(__wc);}
|
||||
#else // iswdigit
|
||||
using ::iswdigit;
|
||||
#endif
|
||||
|
||||
#ifdef iswgraph
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswgraph(wint_t __wc) {return iswgraph(__wc);}
|
||||
#undef iswgraph
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswgraph(wint_t __wc) {return __libcpp_iswgraph(__wc);}
|
||||
#else // iswgraph
|
||||
using ::iswgraph;
|
||||
#endif
|
||||
|
||||
#ifdef iswlower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswlower(wint_t __wc) {return iswlower(__wc);}
|
||||
#undef iswlower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswlower(wint_t __wc) {return __libcpp_iswlower(__wc);}
|
||||
#else // iswlower
|
||||
using ::iswlower;
|
||||
#endif
|
||||
|
||||
#ifdef iswprint
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswprint(wint_t __wc) {return iswprint(__wc);}
|
||||
#undef iswprint
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswprint(wint_t __wc) {return __libcpp_iswprint(__wc);}
|
||||
#else // iswprint
|
||||
using ::iswprint;
|
||||
#endif
|
||||
|
||||
#ifdef iswpunct
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswpunct(wint_t __wc) {return iswpunct(__wc);}
|
||||
#undef iswpunct
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswpunct(wint_t __wc) {return __libcpp_iswpunct(__wc);}
|
||||
#else // iswpunct
|
||||
using ::iswpunct;
|
||||
#endif
|
||||
|
||||
#ifdef iswspace
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswspace(wint_t __wc) {return iswspace(__wc);}
|
||||
#undef iswspace
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswspace(wint_t __wc) {return __libcpp_iswspace(__wc);}
|
||||
#else // iswspace
|
||||
using ::iswspace;
|
||||
#endif
|
||||
|
||||
#ifdef iswupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswupper(wint_t __wc) {return iswupper(__wc);}
|
||||
#undef iswupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswupper(wint_t __wc) {return __libcpp_iswupper(__wc);}
|
||||
#else // iswupper
|
||||
using ::iswupper;
|
||||
#endif
|
||||
|
||||
#ifdef iswxdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswxdigit(wint_t __wc) {return iswxdigit(__wc);}
|
||||
#undef iswxdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswxdigit(wint_t __wc) {return __libcpp_iswxdigit(__wc);}
|
||||
#else // iswxdigit
|
||||
using ::iswxdigit;
|
||||
#endif
|
||||
|
||||
#ifdef iswctype
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswctype(wint_t __w, wctype_t __d) {return iswctype(__w, __d);}
|
||||
#undef iswctype
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswctype(wint_t __w, wctype_t __d) {return __libcpp_iswctype(__w, __d);}
|
||||
#else // iswctype
|
||||
using ::iswctype;
|
||||
#endif
|
||||
|
||||
#ifdef wctype
|
||||
inline _LIBCPP_INLINE_VISIBILITY wctype_t __libcpp_wctype(const char* __p) {return wctype(__p);}
|
||||
#undef wctype
|
||||
inline _LIBCPP_INLINE_VISIBILITY wctype_t wctype(const char* __p) {return __libcpp_wctype(__p);}
|
||||
#else // wctype
|
||||
using ::wctype;
|
||||
#endif
|
||||
|
||||
#ifdef towlower
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towlower(wint_t __wc) {return towlower(__wc);}
|
||||
#undef towlower
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t towlower(wint_t __wc) {return __libcpp_towlower(__wc);}
|
||||
#else // towlower
|
||||
using ::towlower;
|
||||
#endif
|
||||
|
||||
#ifdef towupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towupper(wint_t __wc) {return towupper(__wc);}
|
||||
#undef towupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t towupper(wint_t __wc) {return __libcpp_towupper(__wc);}
|
||||
#else // towupper
|
||||
using ::towupper;
|
||||
#endif
|
||||
|
||||
#ifdef towctrans
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towctrans(wint_t __wc, wctype_t __d) {return towctrans(__wc, __d);}
|
||||
#undef towctrans
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t towctrans(wint_t __wc, wctype_t __d) {return __libcpp_towctrans(__wc, __d);}
|
||||
#else // towctrans
|
||||
using ::towctrans;
|
||||
#endif
|
||||
|
||||
#ifdef wctrans
|
||||
inline _LIBCPP_INLINE_VISIBILITY wctrans_t __libcpp_wctrans(const char* __p) {return wctrans(__p);}
|
||||
#undef wctrans
|
||||
inline _LIBCPP_INLINE_VISIBILITY wctrans_t wctrans(const char* __p) {return __libcpp_wctrans(__p);}
|
||||
#else // wctrans
|
||||
using ::wctrans;
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CWCTYPE
|
2840
final/include/deque
Normal file
2840
final/include/deque
Normal file
File diff suppressed because it is too large
Load Diff
248
final/include/exception
Normal file
248
final/include/exception
Normal file
@ -0,0 +1,248 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- exception ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXCEPTION
|
||||
#define _LIBCPP_EXCEPTION
|
||||
|
||||
/*
|
||||
exception synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
class exception
|
||||
{
|
||||
public:
|
||||
exception() noexcept;
|
||||
exception(const exception&) noexcept;
|
||||
exception& operator=(const exception&) noexcept;
|
||||
virtual ~exception() noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
class bad_exception
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_exception() noexcept;
|
||||
bad_exception(const bad_exception&) noexcept;
|
||||
bad_exception& operator=(const bad_exception&) noexcept;
|
||||
virtual ~bad_exception() noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
typedef void (*unexpected_handler)();
|
||||
unexpected_handler set_unexpected(unexpected_handler f ) noexcept;
|
||||
unexpected_handler get_unexpected() noexcept;
|
||||
[[noreturn]] void unexpected();
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
terminate_handler set_terminate(terminate_handler f ) noexcept;
|
||||
terminate_handler get_terminate() noexcept;
|
||||
[[noreturn]] void terminate() noexcept;
|
||||
|
||||
bool uncaught_exception() noexcept;
|
||||
|
||||
typedef unspecified exception_ptr;
|
||||
|
||||
exception_ptr current_exception() noexcept;
|
||||
void rethrow_exception [[noreturn]] (exception_ptr p);
|
||||
template<class E> exception_ptr make_exception_ptr(E e) noexcept;
|
||||
|
||||
class nested_exception
|
||||
{
|
||||
public:
|
||||
nested_exception() noexcept;
|
||||
nested_exception(const nested_exception&) noexcept = default;
|
||||
nested_exception& operator=(const nested_exception&) noexcept = default;
|
||||
virtual ~nested_exception() = default;
|
||||
|
||||
// access functions
|
||||
[[noreturn]] void rethrow_nested() const;
|
||||
exception_ptr nested_ptr() const noexcept;
|
||||
};
|
||||
|
||||
template <class T> [[noreturn]] void throw_with_nested(T&& t);
|
||||
template <class E> void rethrow_if_nested(const E& e);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI exception
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {}
|
||||
virtual ~exception() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_exception
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {}
|
||||
virtual ~bad_exception() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
typedef void (*unexpected_handler)();
|
||||
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT;
|
||||
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void unexpected();
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT;
|
||||
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void terminate() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT;
|
||||
|
||||
class exception_ptr;
|
||||
|
||||
exception_ptr current_exception() _NOEXCEPT;
|
||||
_ATTRIBUTE(noreturn) void rethrow_exception(exception_ptr);
|
||||
|
||||
class _LIBCPP_VISIBLE exception_ptr
|
||||
{
|
||||
void* __ptr_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
|
||||
exception_ptr(const exception_ptr&) _NOEXCEPT;
|
||||
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
|
||||
~exception_ptr() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
// explicit
|
||||
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
|
||||
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||
{return __x.__ptr_ == __y.__ptr_;}
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||
{return !(__x == __y);}
|
||||
|
||||
friend exception_ptr current_exception() _NOEXCEPT;
|
||||
_ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr);
|
||||
};
|
||||
|
||||
template<class _E>
|
||||
exception_ptr
|
||||
make_exception_ptr(_E __e) _NOEXCEPT
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
throw __e;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return current_exception();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
|
||||
// nested_exception
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI nested_exception
|
||||
{
|
||||
exception_ptr __ptr_;
|
||||
public:
|
||||
nested_exception() _NOEXCEPT;
|
||||
// nested_exception(const nested_exception&) noexcept = default;
|
||||
// nested_exception& operator=(const nested_exception&) noexcept = default;
|
||||
virtual ~nested_exception() _NOEXCEPT;
|
||||
|
||||
// access functions
|
||||
_ATTRIBUTE(noreturn) void rethrow_nested() const;
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __nested
|
||||
: public _Tp,
|
||||
public nested_exception
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_ATTRIBUTE(noreturn)
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
is_class<typename remove_reference<_Tp>::type>::value &&
|
||||
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
is_class<_Tp>::value && !is_base_of<nested_exception, _Tp>::value
|
||||
>::type* = 0)
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t));
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_ATTRIBUTE(noreturn)
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
!is_class<typename remove_reference<_Tp>::type>::value ||
|
||||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
!is_class<_Tp>::value || is_base_of<nested_exception, _Tp>::value
|
||||
>::type* = 0)
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw _VSTD::forward<_Tp>(__t);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _E>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _E& __e, typename enable_if<
|
||||
is_polymorphic<_E>::value
|
||||
>::type* = 0)
|
||||
{
|
||||
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
|
||||
if (__nep)
|
||||
__nep->rethrow_nested();
|
||||
}
|
||||
|
||||
template <class _E>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _E& __e, typename enable_if<
|
||||
!is_polymorphic<_E>::value
|
||||
>::type* = 0)
|
||||
{
|
||||
}
|
||||
|
||||
} // std
|
||||
|
||||
#endif // _LIBCPP_EXCEPTION
|
46
final/include/ext/__hash
Normal file
46
final/include/ext/__hash
Normal file
@ -0,0 +1,46 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------------- hash_set ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXT_HASH
|
||||
#define _LIBCPP_EXT_HASH
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
namespace __gnu_cxx {
|
||||
using namespace std;
|
||||
|
||||
template <typename T> struct _LIBCPP_VISIBLE hash : public std::hash<T>
|
||||
{ };
|
||||
|
||||
template <> struct _LIBCPP_VISIBLE hash<const char*>
|
||||
: public unary_function<const char*, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const char *__c) const _NOEXCEPT
|
||||
{
|
||||
return __do_string_hash(__c, __c + strlen(__c));
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct _LIBCPP_VISIBLE hash<char *>
|
||||
: public unary_function<char*, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char *__c) const _NOEXCEPT
|
||||
{
|
||||
return __do_string_hash<const char *>(__c, __c + strlen(__c));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif _LIBCPP_EXT_HASH
|
995
final/include/ext/hash_map
Normal file
995
final/include/ext/hash_map
Normal file
@ -0,0 +1,995 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- hash_map ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_HASH_MAP
|
||||
#define _LIBCPP_HASH_MAP
|
||||
|
||||
/*
|
||||
|
||||
hash_map synopsis
|
||||
|
||||
namespace __gnu_cxx
|
||||
{
|
||||
|
||||
template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
|
||||
class Alloc = allocator<pair<const Key, T>>>
|
||||
class hash_map
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef Key key_type;
|
||||
typedef T mapped_type;
|
||||
typedef Hash hasher;
|
||||
typedef Pred key_equal;
|
||||
typedef Alloc allocator_type;
|
||||
typedef pair<const key_type, mapped_type> value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef typename allocator_traits<allocator_type>::pointer pointer;
|
||||
typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
|
||||
typedef typename allocator_traits<allocator_type>::size_type size_type;
|
||||
typedef typename allocator_traits<allocator_type>::difference_type difference_type;
|
||||
|
||||
typedef /unspecified/ iterator;
|
||||
typedef /unspecified/ const_iterator;
|
||||
|
||||
explicit hash_map(size_type n = 193, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
template <class InputIterator>
|
||||
hash_map(InputIterator f, InputIterator l,
|
||||
size_type n = 193, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
hash_map(const hash_map&);
|
||||
~hash_map();
|
||||
hash_map& operator=(const hash_map&);
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
pair<iterator, bool> insert(const value_type& obj);
|
||||
template <class InputIterator>
|
||||
void insert(InputIterator first, InputIterator last);
|
||||
|
||||
void erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
void erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
|
||||
void swap(hash_map&);
|
||||
|
||||
hasher hash_funct() const;
|
||||
key_equal key_eq() const;
|
||||
|
||||
iterator find(const key_type& k);
|
||||
const_iterator find(const key_type& k) const;
|
||||
size_type count(const key_type& k) const;
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
|
||||
mapped_type& operator[](const key_type& k);
|
||||
|
||||
size_type bucket_count() const;
|
||||
size_type max_bucket_count() const;
|
||||
|
||||
size_type elems_in_bucket(size_type n) const;
|
||||
|
||||
void resize(size_type n);
|
||||
};
|
||||
|
||||
template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
void swap(hash_map<Key, T, Hash, Pred, Alloc>& x,
|
||||
hash_map<Key, T, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
operator==(const hash_map<Key, T, Hash, Pred, Alloc>& x,
|
||||
const hash_map<Key, T, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
operator!=(const hash_map<Key, T, Hash, Pred, Alloc>& x,
|
||||
const hash_map<Key, T, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
|
||||
class Alloc = allocator<pair<const Key, T>>>
|
||||
class hash_multimap
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef Key key_type;
|
||||
typedef T mapped_type;
|
||||
typedef Hash hasher;
|
||||
typedef Pred key_equal;
|
||||
typedef Alloc allocator_type;
|
||||
typedef pair<const key_type, mapped_type> value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef typename allocator_traits<allocator_type>::pointer pointer;
|
||||
typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
|
||||
typedef typename allocator_traits<allocator_type>::size_type size_type;
|
||||
typedef typename allocator_traits<allocator_type>::difference_type difference_type;
|
||||
|
||||
typedef /unspecified/ iterator;
|
||||
typedef /unspecified/ const_iterator;
|
||||
|
||||
explicit hash_multimap(size_type n = 193, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
template <class InputIterator>
|
||||
hash_multimap(InputIterator f, InputIterator l,
|
||||
size_type n = 193, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
explicit hash_multimap(const allocator_type&);
|
||||
hash_multimap(const hash_multimap&);
|
||||
~hash_multimap();
|
||||
hash_multimap& operator=(const hash_multimap&);
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
iterator insert(const value_type& obj);
|
||||
template <class InputIterator>
|
||||
void insert(InputIterator first, InputIterator last);
|
||||
|
||||
void erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
void erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
|
||||
void swap(hash_multimap&);
|
||||
|
||||
hasher hash_funct() const;
|
||||
key_equal key_eq() const;
|
||||
|
||||
iterator find(const key_type& k);
|
||||
const_iterator find(const key_type& k) const;
|
||||
size_type count(const key_type& k) const;
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
|
||||
size_type bucket_count() const;
|
||||
size_type max_bucket_count() const;
|
||||
|
||||
size_type elems_in_bucket(size_type n) const;
|
||||
|
||||
void resize(size_type n);
|
||||
};
|
||||
|
||||
template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
void swap(hash_multimap<Key, T, Hash, Pred, Alloc>& x,
|
||||
hash_multimap<Key, T, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
operator==(const hash_multimap<Key, T, Hash, Pred, Alloc>& x,
|
||||
const hash_multimap<Key, T, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
operator!=(const hash_multimap<Key, T, Hash, Pred, Alloc>& x,
|
||||
const hash_multimap<Key, T, Hash, Pred, Alloc>& y);
|
||||
|
||||
} // __gnu_cxx
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__hash_table>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
#include <ext/__hash>
|
||||
|
||||
#if __DEPRECATED
|
||||
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
|
||||
#endif
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
namespace __gnu_cxx {
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <class _Tp, class _Hash, bool = is_empty<_Hash>::value>
|
||||
class __hash_map_hasher
|
||||
: private _Hash
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : _Hash() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _Tp& __x) const
|
||||
{return static_cast<const _Hash&>(*this)(__x.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const typename _Tp::first_type& __x) const
|
||||
{return static_cast<const _Hash&>(*this)(__x);}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Hash>
|
||||
class __hash_map_hasher<_Tp, _Hash, false>
|
||||
{
|
||||
_Hash __hash_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : __hash_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return __hash_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _Tp& __x) const
|
||||
{return __hash_(__x.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const typename _Tp::first_type& __x) const
|
||||
{return __hash_(__x);}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Pred, bool = is_empty<_Pred>::value>
|
||||
class __hash_map_equal
|
||||
: private _Pred
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_equal() : _Pred() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : _Pred(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const _Tp& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x.first, __y);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Tp::first_type& __x,
|
||||
const typename _Tp::first_type& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x, __y);}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Pred>
|
||||
class __hash_map_equal<_Tp, _Pred, false>
|
||||
{
|
||||
_Pred __pred_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_equal() : __pred_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : __pred_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return __pred_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const _Tp& __y) const
|
||||
{return __pred_(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
|
||||
{return __pred_(__x, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
|
||||
{return __pred_(__x.first, __y);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Tp::first_type& __x,
|
||||
const typename _Tp::first_type& __y) const
|
||||
{return __pred_(__x, __y);}
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
class __hash_map_node_destructor
|
||||
{
|
||||
typedef _Alloc allocator_type;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
typedef typename __alloc_traits::value_type::value_type value_type;
|
||||
public:
|
||||
typedef typename __alloc_traits::pointer pointer;
|
||||
private:
|
||||
typedef typename value_type::first_type first_type;
|
||||
typedef typename value_type::second_type second_type;
|
||||
|
||||
allocator_type& __na_;
|
||||
|
||||
__hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
|
||||
|
||||
public:
|
||||
bool __first_constructed;
|
||||
bool __second_constructed;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __hash_map_node_destructor(allocator_type& __na)
|
||||
: __na_(__na),
|
||||
__first_constructed(false),
|
||||
__second_constructed(false)
|
||||
{}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
|
||||
: __na_(__x.__na_),
|
||||
__first_constructed(__x.__value_constructed),
|
||||
__second_constructed(__x.__value_constructed)
|
||||
{
|
||||
__x.__value_constructed = false;
|
||||
}
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
|
||||
: __na_(__x.__na_),
|
||||
__first_constructed(__x.__value_constructed),
|
||||
__second_constructed(__x.__value_constructed)
|
||||
{
|
||||
const_cast<bool&>(__x.__value_constructed) = false;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()(pointer __p)
|
||||
{
|
||||
if (__second_constructed)
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
|
||||
if (__first_constructed)
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
|
||||
if (__p)
|
||||
__alloc_traits::deallocate(__na_, __p, 1);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _HashIterator>
|
||||
class _LIBCPP_VISIBLE __hash_map_iterator
|
||||
{
|
||||
_HashIterator __i_;
|
||||
|
||||
typedef pointer_traits<typename _HashIterator::pointer> __pointer_traits;
|
||||
typedef const typename _HashIterator::value_type::first_type key_type;
|
||||
typedef typename _HashIterator::value_type::second_type mapped_type;
|
||||
public:
|
||||
typedef forward_iterator_tag iterator_category;
|
||||
typedef pair<key_type, mapped_type> value_type;
|
||||
typedef typename _HashIterator::difference_type difference_type;
|
||||
typedef value_type& reference;
|
||||
typedef typename __pointer_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind<value_type>
|
||||
#else
|
||||
rebind<value_type>::other
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator(_HashIterator __i) : __i_(__i) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *operator->();}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return (pointer)__i_.operator->();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator& operator++() {++__i_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_iterator operator++(int)
|
||||
{
|
||||
__hash_map_iterator __t(*this);
|
||||
++(*this);
|
||||
return __t;
|
||||
}
|
||||
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
||||
{return __x.__i_ == __y.__i_;}
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
||||
{return __x.__i_ != __y.__i_;}
|
||||
|
||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
|
||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
|
||||
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
|
||||
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
|
||||
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
|
||||
};
|
||||
|
||||
template <class _HashIterator>
|
||||
class _LIBCPP_VISIBLE __hash_map_const_iterator
|
||||
{
|
||||
_HashIterator __i_;
|
||||
|
||||
typedef pointer_traits<typename _HashIterator::pointer> __pointer_traits;
|
||||
typedef const typename _HashIterator::value_type::first_type key_type;
|
||||
typedef typename _HashIterator::value_type::second_type mapped_type;
|
||||
public:
|
||||
typedef forward_iterator_tag iterator_category;
|
||||
typedef pair<key_type, mapped_type> value_type;
|
||||
typedef typename _HashIterator::difference_type difference_type;
|
||||
typedef const value_type& reference;
|
||||
typedef typename __pointer_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind<value_type>
|
||||
#else
|
||||
rebind<value_type>::other
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator(
|
||||
__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
|
||||
: __i_(__i.__i_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return *operator->();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {return (pointer)__i_.operator->();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator& operator++() {++__i_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator operator++(int)
|
||||
{
|
||||
__hash_map_const_iterator __t(*this);
|
||||
++(*this);
|
||||
return __t;
|
||||
}
|
||||
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
||||
{return __x.__i_ == __y.__i_;}
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
||||
{return __x.__i_ != __y.__i_;}
|
||||
|
||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
|
||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
|
||||
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
|
||||
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
|
||||
};
|
||||
|
||||
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
||||
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
||||
class _LIBCPP_VISIBLE hash_map
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef _Key key_type;
|
||||
typedef _Tp mapped_type;
|
||||
typedef _Tp data_type;
|
||||
typedef _Hash hasher;
|
||||
typedef _Pred key_equal;
|
||||
typedef _Alloc allocator_type;
|
||||
typedef pair<const key_type, mapped_type> value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
private:
|
||||
typedef pair<key_type, mapped_type> __value_type;
|
||||
typedef __hash_map_hasher<__value_type, hasher> __hasher;
|
||||
typedef __hash_map_equal<__value_type, key_equal> __key_equal;
|
||||
typedef typename allocator_traits<allocator_type>::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__value_type>
|
||||
#else
|
||||
rebind_alloc<__value_type>::other
|
||||
#endif
|
||||
__allocator_type;
|
||||
|
||||
typedef __hash_table<__value_type, __hasher,
|
||||
__key_equal, __allocator_type> __table;
|
||||
|
||||
__table __table_;
|
||||
|
||||
typedef typename __table::__node_pointer __node_pointer;
|
||||
typedef typename __table::__node_const_pointer __node_const_pointer;
|
||||
typedef typename __table::__node_traits __node_traits;
|
||||
typedef typename __table::__node_allocator __node_allocator;
|
||||
typedef typename __table::__node __node;
|
||||
typedef __hash_map_node_destructor<__node_allocator> _D;
|
||||
typedef unique_ptr<__node, _D> __node_holder;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
public:
|
||||
typedef typename __alloc_traits::pointer pointer;
|
||||
typedef typename __alloc_traits::const_pointer const_pointer;
|
||||
typedef typename __alloc_traits::size_type size_type;
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
|
||||
typedef __hash_map_iterator<typename __table::iterator> iterator;
|
||||
typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY hash_map() {__table_.rehash(193);}
|
||||
explicit hash_map(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
hash_map(size_type __n, const hasher& __hf,
|
||||
const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
template <class _InputIterator>
|
||||
hash_map(_InputIterator __first, _InputIterator __last);
|
||||
template <class _InputIterator>
|
||||
hash_map(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
template <class _InputIterator>
|
||||
hash_map(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf,
|
||||
const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
hash_map(const hash_map& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(const value_type& __x)
|
||||
{return __table_.__insert_unique(__x);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first.__i_, __last.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_map& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const
|
||||
{return __table_.hash_function().hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const
|
||||
{return __table_.key_eq().key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
|
||||
mapped_type& operator[](const key_type& __k);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const
|
||||
{return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
|
||||
private:
|
||||
__node_holder __construct_node(const key_type& __k);
|
||||
};
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
__table_.rehash(193);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
|
||||
_InputIterator __first, _InputIterator __last, size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
|
||||
_InputIterator __first, _InputIterator __last, size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
|
||||
const hash_map& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
__table_.rehash(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
|
||||
{
|
||||
__node_allocator& __na = __table_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return _VSTD::move(__h);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
__table_.__insert_unique(*__first);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
_Tp&
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
|
||||
{
|
||||
iterator __i = find(__k);
|
||||
if (__i != end())
|
||||
return __i->second;
|
||||
__node_holder __h = __construct_node(__k);
|
||||
pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
|
||||
__h.release();
|
||||
return __r.first->second;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
bool
|
||||
operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
if (__x.size() != __y.size())
|
||||
return false;
|
||||
typedef typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
|
||||
const_iterator;
|
||||
for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
|
||||
__i != __ex; ++__i)
|
||||
{
|
||||
const_iterator __j = __y.find(__i->first);
|
||||
if (__j == __ey || !(*__i == *__j))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
||||
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
||||
class _LIBCPP_VISIBLE hash_multimap
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef _Key key_type;
|
||||
typedef _Tp mapped_type;
|
||||
typedef _Tp data_type;
|
||||
typedef _Hash hasher;
|
||||
typedef _Pred key_equal;
|
||||
typedef _Alloc allocator_type;
|
||||
typedef pair<const key_type, mapped_type> value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
private:
|
||||
typedef pair<key_type, mapped_type> __value_type;
|
||||
typedef __hash_map_hasher<__value_type, hasher> __hasher;
|
||||
typedef __hash_map_equal<__value_type, key_equal> __key_equal;
|
||||
typedef typename allocator_traits<allocator_type>::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__value_type>
|
||||
#else
|
||||
rebind_alloc<__value_type>::other
|
||||
#endif
|
||||
__allocator_type;
|
||||
|
||||
typedef __hash_table<__value_type, __hasher,
|
||||
__key_equal, __allocator_type> __table;
|
||||
|
||||
__table __table_;
|
||||
|
||||
typedef typename __table::__node_traits __node_traits;
|
||||
typedef typename __table::__node_allocator __node_allocator;
|
||||
typedef typename __table::__node __node;
|
||||
typedef __hash_map_node_destructor<__node_allocator> _D;
|
||||
typedef unique_ptr<__node, _D> __node_holder;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
public:
|
||||
typedef typename __alloc_traits::pointer pointer;
|
||||
typedef typename __alloc_traits::const_pointer const_pointer;
|
||||
typedef typename __alloc_traits::size_type size_type;
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
|
||||
typedef __hash_map_iterator<typename __table::iterator> iterator;
|
||||
typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hash_multimap() {__table_.rehash(193);}
|
||||
explicit hash_multimap(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
hash_multimap(size_type __n, const hasher& __hf,
|
||||
const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
template <class _InputIterator>
|
||||
hash_multimap(_InputIterator __first, _InputIterator __last);
|
||||
template <class _InputIterator>
|
||||
hash_multimap(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
template <class _InputIterator>
|
||||
hash_multimap(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf,
|
||||
const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
hash_multimap(const hash_multimap& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first.__i_, __last.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_multimap& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const
|
||||
{return __table_.hash_function().hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const
|
||||
{return __table_.key_eq().key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const
|
||||
{return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
};
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
__table_.rehash(193);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
|
||||
_InputIterator __first, _InputIterator __last, size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
|
||||
_InputIterator __first, _InputIterator __last, size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
|
||||
const hash_multimap& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
__table_.rehash(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
__table_.__insert_multi(*__first);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
bool
|
||||
operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
if (__x.size() != __y.size())
|
||||
return false;
|
||||
typedef typename hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
|
||||
const_iterator;
|
||||
typedef pair<const_iterator, const_iterator> _EqRng;
|
||||
for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
|
||||
{
|
||||
_EqRng __xeq = __x.equal_range(__i->first);
|
||||
_EqRng __yeq = __y.equal_range(__i->first);
|
||||
if (_VSTD::distance(__xeq.first, __xeq.second) !=
|
||||
_VSTD::distance(__yeq.first, __yeq.second) ||
|
||||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
return false;
|
||||
__i = __xeq.second;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
} // __gnu_cxx
|
||||
|
||||
#endif // _LIBCPP_HASH_MAP
|
657
final/include/ext/hash_set
Normal file
657
final/include/ext/hash_set
Normal file
@ -0,0 +1,657 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------------- hash_set ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_HASH_SET
|
||||
#define _LIBCPP_HASH_SET
|
||||
|
||||
/*
|
||||
|
||||
hash_set synopsis
|
||||
|
||||
namespace __gnu_cxx
|
||||
{
|
||||
|
||||
template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
|
||||
class Alloc = allocator<Value>>
|
||||
class hash_set
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef Value key_type;
|
||||
typedef key_type value_type;
|
||||
typedef Hash hasher;
|
||||
typedef Pred key_equal;
|
||||
typedef Alloc allocator_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef typename allocator_traits<allocator_type>::pointer pointer;
|
||||
typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
|
||||
typedef typename allocator_traits<allocator_type>::size_type size_type;
|
||||
typedef typename allocator_traits<allocator_type>::difference_type difference_type;
|
||||
|
||||
typedef /unspecified/ iterator;
|
||||
typedef /unspecified/ const_iterator;
|
||||
|
||||
explicit hash_set(size_type n = 193, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
template <class InputIterator>
|
||||
hash_set(InputIterator f, InputIterator l,
|
||||
size_type n = 193, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
hash_set(const hash_set&);
|
||||
~hash_set();
|
||||
hash_set& operator=(const hash_set&);
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
pair<iterator, bool> insert(const value_type& obj);
|
||||
template <class InputIterator>
|
||||
void insert(InputIterator first, InputIterator last);
|
||||
|
||||
void erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
void erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
|
||||
void swap(hash_set&);
|
||||
|
||||
hasher hash_funct() const;
|
||||
key_equal key_eq() const;
|
||||
|
||||
iterator find(const key_type& k);
|
||||
const_iterator find(const key_type& k) const;
|
||||
size_type count(const key_type& k) const;
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
|
||||
size_type bucket_count() const;
|
||||
size_type max_bucket_count() const;
|
||||
|
||||
size_type elems_in_bucket(size_type n) const;
|
||||
|
||||
void resize(size_type n);
|
||||
};
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
void swap(hash_set<Value, Hash, Pred, Alloc>& x,
|
||||
hash_set<Value, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
operator==(const hash_set<Value, Hash, Pred, Alloc>& x,
|
||||
const hash_set<Value, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
operator!=(const hash_set<Value, Hash, Pred, Alloc>& x,
|
||||
const hash_set<Value, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
|
||||
class Alloc = allocator<Value>>
|
||||
class hash_multiset
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef Value key_type;
|
||||
typedef key_type value_type;
|
||||
typedef Hash hasher;
|
||||
typedef Pred key_equal;
|
||||
typedef Alloc allocator_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef typename allocator_traits<allocator_type>::pointer pointer;
|
||||
typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
|
||||
typedef typename allocator_traits<allocator_type>::size_type size_type;
|
||||
typedef typename allocator_traits<allocator_type>::difference_type difference_type;
|
||||
|
||||
typedef /unspecified/ iterator;
|
||||
typedef /unspecified/ const_iterator;
|
||||
|
||||
explicit hash_multiset(size_type n = 193, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
template <class InputIterator>
|
||||
hash_multiset(InputIterator f, InputIterator l,
|
||||
size_type n = 193, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
hash_multiset(const hash_multiset&);
|
||||
~hash_multiset();
|
||||
hash_multiset& operator=(const hash_multiset&);
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
iterator insert(const value_type& obj);
|
||||
template <class InputIterator>
|
||||
void insert(InputIterator first, InputIterator last);
|
||||
|
||||
void erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
void erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
|
||||
void swap(hash_multiset&);
|
||||
|
||||
hasher hash_funct() const;
|
||||
key_equal key_eq() const;
|
||||
|
||||
iterator find(const key_type& k);
|
||||
const_iterator find(const key_type& k) const;
|
||||
size_type count(const key_type& k) const;
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
|
||||
size_type bucket_count() const;
|
||||
size_type max_bucket_count() const;
|
||||
|
||||
size_type elems_in_bucket(size_type n) const;
|
||||
|
||||
void resize(size_type n);
|
||||
};
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
void swap(hash_multiset<Value, Hash, Pred, Alloc>& x,
|
||||
hash_multiset<Value, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
operator==(const hash_multiset<Value, Hash, Pred, Alloc>& x,
|
||||
const hash_multiset<Value, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
operator!=(const hash_multiset<Value, Hash, Pred, Alloc>& x,
|
||||
const hash_multiset<Value, Hash, Pred, Alloc>& y);
|
||||
} // __gnu_cxx
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__hash_table>
|
||||
#include <functional>
|
||||
#include <ext/__hash>
|
||||
|
||||
#if __DEPRECATED
|
||||
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
|
||||
#endif
|
||||
|
||||
namespace __gnu_cxx {
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
class _Alloc = allocator<_Value> >
|
||||
class _LIBCPP_VISIBLE hash_set
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef _Value key_type;
|
||||
typedef key_type value_type;
|
||||
typedef _Hash hasher;
|
||||
typedef _Pred key_equal;
|
||||
typedef _Alloc allocator_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
private:
|
||||
typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
|
||||
|
||||
__table __table_;
|
||||
|
||||
public:
|
||||
typedef typename __table::pointer pointer;
|
||||
typedef typename __table::const_pointer const_pointer;
|
||||
typedef typename __table::size_type size_type;
|
||||
typedef typename __table::difference_type difference_type;
|
||||
|
||||
typedef typename __table::const_iterator iterator;
|
||||
typedef typename __table::const_iterator const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hash_set() {__table_.rehash(193);}
|
||||
explicit hash_set(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
template <class _InputIterator>
|
||||
hash_set(_InputIterator __first, _InputIterator __last);
|
||||
template <class _InputIterator>
|
||||
hash_set(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
template <class _InputIterator>
|
||||
hash_set(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
hash_set(const hash_set& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(const value_type& __x)
|
||||
{return __table_.__insert_unique(__x);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first, __last);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_set& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const {return __table_.hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const {return __table_.key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
};
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
__table_.rehash(193);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
|
||||
_InputIterator __first, _InputIterator __last, size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
|
||||
_InputIterator __first, _InputIterator __last, size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
|
||||
const hash_set& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
__table_.rehash(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
__table_.__insert_unique(*__first);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
bool
|
||||
operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
if (__x.size() != __y.size())
|
||||
return false;
|
||||
typedef typename hash_set<_Value, _Hash, _Pred, _Alloc>::const_iterator
|
||||
const_iterator;
|
||||
for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
|
||||
__i != __ex; ++__i)
|
||||
{
|
||||
const_iterator __j = __y.find(*__i);
|
||||
if (__j == __ey || !(*__i == *__j))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
class _Alloc = allocator<_Value> >
|
||||
class _LIBCPP_VISIBLE hash_multiset
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef _Value key_type;
|
||||
typedef key_type value_type;
|
||||
typedef _Hash hasher;
|
||||
typedef _Pred key_equal;
|
||||
typedef _Alloc allocator_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
private:
|
||||
typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
|
||||
|
||||
__table __table_;
|
||||
|
||||
public:
|
||||
typedef typename __table::pointer pointer;
|
||||
typedef typename __table::const_pointer const_pointer;
|
||||
typedef typename __table::size_type size_type;
|
||||
typedef typename __table::difference_type difference_type;
|
||||
|
||||
typedef typename __table::const_iterator iterator;
|
||||
typedef typename __table::const_iterator const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hash_multiset() {__table_.rehash(193);}
|
||||
explicit hash_multiset(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
hash_multiset(size_type __n, const hasher& __hf,
|
||||
const key_equal& __eql, const allocator_type& __a);
|
||||
template <class _InputIterator>
|
||||
hash_multiset(_InputIterator __first, _InputIterator __last);
|
||||
template <class _InputIterator>
|
||||
hash_multiset(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
template <class _InputIterator>
|
||||
hash_multiset(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n , const hasher& __hf,
|
||||
const key_equal& __eql, const allocator_type& __a);
|
||||
hash_multiset(const hash_multiset& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first, __last);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_multiset& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const {return __table_.hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const {return __table_.key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
};
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
__table_.rehash(193);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
_InputIterator __first, _InputIterator __last, size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
_InputIterator __first, _InputIterator __last, size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
const hash_multiset& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
__table_.rehash(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
__table_.__insert_multi(*__first);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
bool
|
||||
operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
if (__x.size() != __y.size())
|
||||
return false;
|
||||
typedef typename hash_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
|
||||
const_iterator;
|
||||
typedef pair<const_iterator, const_iterator> _EqRng;
|
||||
for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
|
||||
{
|
||||
_EqRng __xeq = __x.equal_range(*__i);
|
||||
_EqRng __yeq = __y.equal_range(*__i);
|
||||
if (_VSTD::distance(__xeq.first, __xeq.second) !=
|
||||
_VSTD::distance(__yeq.first, __yeq.second) ||
|
||||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
return false;
|
||||
__i = __xeq.second;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
} // __gnu_cxx
|
||||
|
||||
#endif // _LIBCPP_HASH_SET
|
1632
final/include/forward_list
Normal file
1632
final/include/forward_list
Normal file
File diff suppressed because it is too large
Load Diff
1394
final/include/fstream
Normal file
1394
final/include/fstream
Normal file
File diff suppressed because it is too large
Load Diff
1997
final/include/functional
Normal file
1997
final/include/functional
Normal file
File diff suppressed because it is too large
Load Diff
2515
final/include/future
Normal file
2515
final/include/future
Normal file
File diff suppressed because it is too large
Load Diff
103
final/include/initializer_list
Normal file
103
final/include/initializer_list
Normal file
@ -0,0 +1,103 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------- initializer_list -----------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_INITIALIZER_LIST
|
||||
#define _LIBCPP_INITIALIZER_LIST
|
||||
|
||||
/*
|
||||
initializer_list synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template<class E>
|
||||
class initializer_list
|
||||
{
|
||||
public:
|
||||
typedef E value_type;
|
||||
typedef const E& reference;
|
||||
typedef const E& const_reference;
|
||||
typedef size_t size_type;
|
||||
|
||||
typedef const E* iterator;
|
||||
typedef const E* const_iterator;
|
||||
|
||||
initializer_list() noexcept;
|
||||
|
||||
size_t size() const noexcept;
|
||||
const E* begin() const noexcept;
|
||||
const E* end() const noexcept;
|
||||
};
|
||||
|
||||
template<class E> const E* begin(initializer_list<E> il) noexcept;
|
||||
template<class E> const E* end(initializer_list<E> il) noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cstddef>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
namespace std // purposefully not versioned
|
||||
{
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template<class _E>
|
||||
class _LIBCPP_VISIBLE initializer_list
|
||||
{
|
||||
const _E* __begin_;
|
||||
size_t __size_;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
initializer_list(const _E* __b, size_t __s) _NOEXCEPT
|
||||
: __begin_(__b),
|
||||
__size_(__s)
|
||||
{}
|
||||
public:
|
||||
typedef _E value_type;
|
||||
typedef const _E& reference;
|
||||
typedef const _E& const_reference;
|
||||
typedef size_t size_type;
|
||||
|
||||
typedef const _E* iterator;
|
||||
typedef const _E* const_iterator;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE size_t size() const _NOEXCEPT {return __size_;}
|
||||
_LIBCPP_ALWAYS_INLINE const _E* begin() const _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_ALWAYS_INLINE const _E* end() const _NOEXCEPT {return __begin_ + __size_;}
|
||||
};
|
||||
|
||||
template<class _E>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
const _E*
|
||||
begin(initializer_list<_E> __il) _NOEXCEPT
|
||||
{
|
||||
return __il.begin();
|
||||
}
|
||||
|
||||
template<class _E>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
const _E*
|
||||
end(initializer_list<_E> __il) _NOEXCEPT
|
||||
{
|
||||
return __il.end();
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
} // std
|
||||
|
||||
#endif // _LIBCPP_INITIALIZER_LIST
|
502
final/include/iomanip
Normal file
502
final/include/iomanip
Normal file
@ -0,0 +1,502 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- iomanip ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_IOMANIP
|
||||
#define _LIBCPP_IOMANIP
|
||||
|
||||
/*
|
||||
iomanip synopsis
|
||||
|
||||
// types T1, T2, ... are unspecified implementation types
|
||||
T1 resetiosflags(ios_base::fmtflags mask);
|
||||
T2 setiosflags (ios_base::fmtflags mask);
|
||||
T3 setbase(int base);
|
||||
template<charT> T4 setfill(charT c);
|
||||
T5 setprecision(int n);
|
||||
T6 setw(int n);
|
||||
template <class moneyT> T7 get_money(moneyT& mon, bool intl = false);
|
||||
template <class charT, class moneyT> T8 put_money(const moneyT& mon, bool intl = false);
|
||||
template <class charT> T9 get_time(struct tm* tmb, const charT* fmt);
|
||||
template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <istream>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// resetiosflags
|
||||
|
||||
class __iom_t1
|
||||
{
|
||||
ios_base::fmtflags __mask_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x)
|
||||
{
|
||||
__is.unsetf(__x.__mask_);
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x)
|
||||
{
|
||||
__os.unsetf(__x.__mask_);
|
||||
return __os;
|
||||
}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t1
|
||||
resetiosflags(ios_base::fmtflags __mask)
|
||||
{
|
||||
return __iom_t1(__mask);
|
||||
}
|
||||
|
||||
// setiosflags
|
||||
|
||||
class __iom_t2
|
||||
{
|
||||
ios_base::fmtflags __mask_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x)
|
||||
{
|
||||
__is.setf(__x.__mask_);
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x)
|
||||
{
|
||||
__os.setf(__x.__mask_);
|
||||
return __os;
|
||||
}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t2
|
||||
setiosflags(ios_base::fmtflags __mask)
|
||||
{
|
||||
return __iom_t2(__mask);
|
||||
}
|
||||
|
||||
// setbase
|
||||
|
||||
class __iom_t3
|
||||
{
|
||||
int __base_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t3(int __b) : __base_(__b) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x)
|
||||
{
|
||||
__is.setf(__x.__base_ == 8 ? ios_base::oct :
|
||||
__x.__base_ == 10 ? ios_base::dec :
|
||||
__x.__base_ == 16 ? ios_base::hex :
|
||||
ios_base::fmtflags(0), ios_base::basefield);
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x)
|
||||
{
|
||||
__os.setf(__x.__base_ == 8 ? ios_base::oct :
|
||||
__x.__base_ == 10 ? ios_base::dec :
|
||||
__x.__base_ == 16 ? ios_base::hex :
|
||||
ios_base::fmtflags(0), ios_base::basefield);
|
||||
return __os;
|
||||
}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t3
|
||||
setbase(int __base)
|
||||
{
|
||||
return __iom_t3(__base);
|
||||
}
|
||||
|
||||
// setfill
|
||||
|
||||
template<class _CharT>
|
||||
class __iom_t4
|
||||
{
|
||||
_CharT __fill_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t4(_CharT __c) : __fill_(__c) {}
|
||||
|
||||
template <class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x)
|
||||
{
|
||||
__os.fill(__x.__fill_);
|
||||
return __os;
|
||||
}
|
||||
};
|
||||
|
||||
template<class _CharT>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t4<_CharT>
|
||||
setfill(_CharT __c)
|
||||
{
|
||||
return __iom_t4<_CharT>(__c);
|
||||
}
|
||||
|
||||
// setprecision
|
||||
|
||||
class __iom_t5
|
||||
{
|
||||
int __n_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t5(int __n) : __n_(__n) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x)
|
||||
{
|
||||
__is.precision(__x.__n_);
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x)
|
||||
{
|
||||
__os.precision(__x.__n_);
|
||||
return __os;
|
||||
}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t5
|
||||
setprecision(int __n)
|
||||
{
|
||||
return __iom_t5(__n);
|
||||
}
|
||||
|
||||
// setw
|
||||
|
||||
class __iom_t6
|
||||
{
|
||||
int __n_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t6(int __n) : __n_(__n) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x)
|
||||
{
|
||||
__is.width(__x.__n_);
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x)
|
||||
{
|
||||
__os.width(__x.__n_);
|
||||
return __os;
|
||||
}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t6
|
||||
setw(int __n)
|
||||
{
|
||||
return __iom_t6(__n);
|
||||
}
|
||||
|
||||
// get_money
|
||||
|
||||
template <class _MoneyT> class __iom_t7;
|
||||
|
||||
template <class _CharT, class _Traits, class _MoneyT>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x);
|
||||
|
||||
template <class _MoneyT>
|
||||
class __iom_t7
|
||||
{
|
||||
_MoneyT& __mon_;
|
||||
bool __intl_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t7(_MoneyT& __mon, bool __intl)
|
||||
: __mon_(__mon), __intl_(__intl) {}
|
||||
|
||||
template <class _CharT, class _Traits, class _M>
|
||||
friend
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_M>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _MoneyT>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef money_get<_CharT, _I> _F;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
const _F& __mf = use_facet<_F>(__is.getloc());
|
||||
__mf.get(_I(__is), _I(), __x.__intl_, __is, __err, __x.__mon_);
|
||||
__is.setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__is.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _MoneyT>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t7<_MoneyT>
|
||||
get_money(_MoneyT& __mon, bool __intl = false)
|
||||
{
|
||||
return __iom_t7<_MoneyT>(__mon, __intl);
|
||||
}
|
||||
|
||||
// put_money
|
||||
|
||||
template <class _MoneyT> class __iom_t8;
|
||||
|
||||
template <class _CharT, class _Traits, class _MoneyT>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x);
|
||||
|
||||
template <class _MoneyT>
|
||||
class __iom_t8
|
||||
{
|
||||
const _MoneyT& __mon_;
|
||||
bool __intl_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t8(const _MoneyT& __mon, bool __intl)
|
||||
: __mon_(__mon), __intl_(__intl) {}
|
||||
|
||||
template <class _CharT, class _Traits, class _M>
|
||||
friend
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_M>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _MoneyT>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
||||
typedef money_put<_CharT, _O> _F;
|
||||
const _F& __mf = use_facet<_F>(__os.getloc());
|
||||
if (__mf.put(_O(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
|
||||
__os.setstate(ios_base::badbit);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
template <class _MoneyT>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t8<_MoneyT>
|
||||
put_money(const _MoneyT& __mon, bool __intl = false)
|
||||
{
|
||||
return __iom_t8<_MoneyT>(__mon, __intl);
|
||||
}
|
||||
|
||||
// get_time
|
||||
|
||||
template <class _CharT> class __iom_t9;
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x);
|
||||
|
||||
template <class _CharT>
|
||||
class __iom_t9
|
||||
{
|
||||
tm* __tm_;
|
||||
const _CharT* __fmt_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t9(tm* __tm, const _CharT* __fmt)
|
||||
: __tm_(__tm), __fmt_(__fmt) {}
|
||||
|
||||
template <class _C, class _Traits>
|
||||
friend
|
||||
basic_istream<_C, _Traits>&
|
||||
operator>>(basic_istream<_C, _Traits>& __is, const __iom_t9<_C>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef time_get<_CharT, _I> _F;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
const _F& __tf = use_facet<_F>(__is.getloc());
|
||||
__tf.get(_I(__is), _I(), __is, __err, __x.__tm_,
|
||||
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
|
||||
__is.setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__is.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t9<_CharT>
|
||||
get_time(tm* __tm, const _CharT* __fmt)
|
||||
{
|
||||
return __iom_t9<_CharT>(__tm, __fmt);
|
||||
}
|
||||
|
||||
// put_time
|
||||
|
||||
template <class _CharT> class __iom_t10;
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x);
|
||||
|
||||
template <class _CharT>
|
||||
class __iom_t10
|
||||
{
|
||||
const tm* __tm_;
|
||||
const _CharT* __fmt_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t10(const tm* __tm, const _CharT* __fmt)
|
||||
: __tm_(__tm), __fmt_(__fmt) {}
|
||||
|
||||
template <class _C, class _Traits>
|
||||
friend
|
||||
basic_ostream<_C, _Traits>&
|
||||
operator<<(basic_ostream<_C, _Traits>& __os, const __iom_t10<_C>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
||||
typedef time_put<_CharT, _O> _F;
|
||||
const _F& __tf = use_facet<_F>(__os.getloc());
|
||||
if (__tf.put(_O(__os), __os, __os.fill(), __x.__tm_,
|
||||
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
|
||||
__os.setstate(ios_base::badbit);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t10<_CharT>
|
||||
put_time(const tm* __tm, const _CharT* __fmt)
|
||||
{
|
||||
return __iom_t10<_CharT>(__tm, __fmt);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_IOMANIP
|
985
final/include/ios
Normal file
985
final/include/ios
Normal file
@ -0,0 +1,985 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- ios -------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_IOS
|
||||
#define _LIBCPP_IOS
|
||||
|
||||
/*
|
||||
ios synopsis
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
typedef OFF_T streamoff;
|
||||
typedef SZ_T streamsize;
|
||||
template <class stateT> class fpos;
|
||||
|
||||
class ios_base
|
||||
{
|
||||
public:
|
||||
class failure;
|
||||
|
||||
typedef T1 fmtflags;
|
||||
static const fmtflags boolalpha;
|
||||
static const fmtflags dec;
|
||||
static const fmtflags fixed;
|
||||
static const fmtflags hex;
|
||||
static const fmtflags internal;
|
||||
static const fmtflags left;
|
||||
static const fmtflags oct;
|
||||
static const fmtflags right;
|
||||
static const fmtflags scientific;
|
||||
static const fmtflags showbase;
|
||||
static const fmtflags showpoint;
|
||||
static const fmtflags showpos;
|
||||
static const fmtflags skipws;
|
||||
static const fmtflags unitbuf;
|
||||
static const fmtflags uppercase;
|
||||
static const fmtflags adjustfield;
|
||||
static const fmtflags basefield;
|
||||
static const fmtflags floatfield;
|
||||
|
||||
typedef T2 iostate;
|
||||
static const iostate badbit;
|
||||
static const iostate eofbit;
|
||||
static const iostate failbit;
|
||||
static const iostate goodbit;
|
||||
|
||||
typedef T3 openmode;
|
||||
static const openmode app;
|
||||
static const openmode ate;
|
||||
static const openmode binary;
|
||||
static const openmode in;
|
||||
static const openmode out;
|
||||
static const openmode trunc;
|
||||
|
||||
typedef T4 seekdir;
|
||||
static const seekdir beg;
|
||||
static const seekdir cur;
|
||||
static const seekdir end;
|
||||
|
||||
class Init;
|
||||
|
||||
// 27.5.2.2 fmtflags state:
|
||||
fmtflags flags() const;
|
||||
fmtflags flags(fmtflags fmtfl);
|
||||
fmtflags setf(fmtflags fmtfl);
|
||||
fmtflags setf(fmtflags fmtfl, fmtflags mask);
|
||||
void unsetf(fmtflags mask);
|
||||
|
||||
streamsize precision() const;
|
||||
streamsize precision(streamsize prec);
|
||||
streamsize width() const;
|
||||
streamsize width(streamsize wide);
|
||||
|
||||
// 27.5.2.3 locales:
|
||||
locale imbue(const locale& loc);
|
||||
locale getloc() const;
|
||||
|
||||
// 27.5.2.5 storage:
|
||||
static int xalloc();
|
||||
long& iword(int index);
|
||||
void*& pword(int index);
|
||||
|
||||
// destructor
|
||||
virtual ~ios_base();
|
||||
|
||||
// 27.5.2.6 callbacks;
|
||||
enum event { erase_event, imbue_event, copyfmt_event };
|
||||
typedef void (*event_callback)(event, ios_base&, int index);
|
||||
void register_callback(event_callback fn, int index);
|
||||
|
||||
ios_base(const ios_base&) = delete;
|
||||
ios_base& operator=(const ios_base&) = delete;
|
||||
|
||||
static bool sync_with_stdio(bool sync = true);
|
||||
|
||||
protected:
|
||||
ios_base();
|
||||
};
|
||||
|
||||
template <class charT, class traits = char_traits<charT> >
|
||||
class basic_ios
|
||||
: public ios_base
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
typedef charT char_type;
|
||||
typedef typename traits::int_type int_type;
|
||||
typedef typename traits::pos_type pos_type;
|
||||
typedef typename traits::off_type off_type;
|
||||
typedef traits traits_type;
|
||||
|
||||
operator unspecified-bool-type() const;
|
||||
bool operator!() const;
|
||||
iostate rdstate() const;
|
||||
void clear(iostate state = goodbit);
|
||||
void setstate(iostate state);
|
||||
bool good() const;
|
||||
bool eof() const;
|
||||
bool fail() const;
|
||||
bool bad() const;
|
||||
|
||||
iostate exceptions() const;
|
||||
void exceptions(iostate except);
|
||||
|
||||
// 27.5.4.1 Constructor/destructor:
|
||||
explicit basic_ios(basic_streambuf<charT,traits>* sb);
|
||||
virtual ~basic_ios();
|
||||
|
||||
// 27.5.4.2 Members:
|
||||
basic_ostream<charT,traits>* tie() const;
|
||||
basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);
|
||||
|
||||
basic_streambuf<charT,traits>* rdbuf() const;
|
||||
basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);
|
||||
|
||||
basic_ios& copyfmt(const basic_ios& rhs);
|
||||
|
||||
char_type fill() const;
|
||||
char_type fill(char_type ch);
|
||||
|
||||
locale imbue(const locale& loc);
|
||||
|
||||
char narrow(char_type c, char dfault) const;
|
||||
char_type widen(char c) const;
|
||||
|
||||
basic_ios(const basic_ios& ) = delete;
|
||||
basic_ios& operator=(const basic_ios&) = delete;
|
||||
|
||||
protected:
|
||||
basic_ios();
|
||||
void init(basic_streambuf<charT,traits>* sb);
|
||||
void move(basic_ios& rhs);
|
||||
void swap(basic_ios& rhs);
|
||||
void set_rdbuf(basic_streambuf<charT, traits>* sb);
|
||||
};
|
||||
|
||||
// 27.5.5, manipulators:
|
||||
ios_base& boolalpha (ios_base& str);
|
||||
ios_base& noboolalpha(ios_base& str);
|
||||
ios_base& showbase (ios_base& str);
|
||||
ios_base& noshowbase (ios_base& str);
|
||||
ios_base& showpoint (ios_base& str);
|
||||
ios_base& noshowpoint(ios_base& str);
|
||||
ios_base& showpos (ios_base& str);
|
||||
ios_base& noshowpos (ios_base& str);
|
||||
ios_base& skipws (ios_base& str);
|
||||
ios_base& noskipws (ios_base& str);
|
||||
ios_base& uppercase (ios_base& str);
|
||||
ios_base& nouppercase(ios_base& str);
|
||||
ios_base& unitbuf (ios_base& str);
|
||||
ios_base& nounitbuf (ios_base& str);
|
||||
|
||||
// 27.5.5.2 adjustfield:
|
||||
ios_base& internal (ios_base& str);
|
||||
ios_base& left (ios_base& str);
|
||||
ios_base& right (ios_base& str);
|
||||
|
||||
// 27.5.5.3 basefield:
|
||||
ios_base& dec (ios_base& str);
|
||||
ios_base& hex (ios_base& str);
|
||||
ios_base& oct (ios_base& str);
|
||||
|
||||
// 27.5.5.4 floatfield:
|
||||
ios_base& fixed (ios_base& str);
|
||||
ios_base& scientific (ios_base& str);
|
||||
ios_base& hexfloat (ios_base& str);
|
||||
ios_base& defaultfloat(ios_base& str);
|
||||
|
||||
// 27.5.5.5 error reporting:
|
||||
enum class io_errc
|
||||
{
|
||||
stream = 1
|
||||
};
|
||||
|
||||
concept_map ErrorCodeEnum<io_errc> { };
|
||||
error_code make_error_code(io_errc e);
|
||||
error_condition make_error_condition(io_errc e);
|
||||
storage-class-specifier const error_category& iostream_category;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <iosfwd>
|
||||
#include <__locale>
|
||||
#include <system_error>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
typedef ptrdiff_t streamsize;
|
||||
|
||||
class _LIBCPP_VISIBLE ios_base
|
||||
{
|
||||
public:
|
||||
class failure;
|
||||
|
||||
typedef unsigned int fmtflags;
|
||||
static const fmtflags boolalpha = 0x0001;
|
||||
static const fmtflags dec = 0x0002;
|
||||
static const fmtflags fixed = 0x0004;
|
||||
static const fmtflags hex = 0x0008;
|
||||
static const fmtflags internal = 0x0010;
|
||||
static const fmtflags left = 0x0020;
|
||||
static const fmtflags oct = 0x0040;
|
||||
static const fmtflags right = 0x0080;
|
||||
static const fmtflags scientific = 0x0100;
|
||||
static const fmtflags showbase = 0x0200;
|
||||
static const fmtflags showpoint = 0x0400;
|
||||
static const fmtflags showpos = 0x0800;
|
||||
static const fmtflags skipws = 0x1000;
|
||||
static const fmtflags unitbuf = 0x2000;
|
||||
static const fmtflags uppercase = 0x4000;
|
||||
static const fmtflags adjustfield = left | right | internal;
|
||||
static const fmtflags basefield = dec | oct | hex;
|
||||
static const fmtflags floatfield = scientific | fixed;
|
||||
|
||||
typedef unsigned int iostate;
|
||||
typedef iostate io_state;
|
||||
static const iostate badbit = 0x1;
|
||||
static const iostate eofbit = 0x2;
|
||||
static const iostate failbit = 0x4;
|
||||
static const iostate goodbit = 0x0;
|
||||
|
||||
typedef unsigned int openmode;
|
||||
typedef openmode open_mode;
|
||||
static const openmode app = 0x01;
|
||||
static const openmode ate = 0x02;
|
||||
static const openmode binary = 0x04;
|
||||
static const openmode in = 0x08;
|
||||
static const openmode out = 0x10;
|
||||
static const openmode trunc = 0x20;
|
||||
|
||||
enum seekdir {beg, cur, end};
|
||||
typedef seekdir seek_dir;
|
||||
|
||||
typedef _VSTD::streamoff streamoff;
|
||||
typedef _VSTD::streampos streampos;
|
||||
|
||||
class Init;
|
||||
|
||||
// 27.5.2.2 fmtflags state:
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
|
||||
_LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY streamsize precision() const;
|
||||
_LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec);
|
||||
_LIBCPP_INLINE_VISIBILITY streamsize width() const;
|
||||
_LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide);
|
||||
|
||||
// 27.5.2.3 locales:
|
||||
locale imbue(const locale& __loc);
|
||||
locale getloc() const;
|
||||
|
||||
// 27.5.2.5 storage:
|
||||
static int xalloc();
|
||||
long& iword(int __index);
|
||||
void*& pword(int __index);
|
||||
|
||||
// destructor
|
||||
virtual ~ios_base();
|
||||
|
||||
// 27.5.2.6 callbacks;
|
||||
enum event { erase_event, imbue_event, copyfmt_event };
|
||||
typedef void (*event_callback)(event, ios_base&, int __index);
|
||||
void register_callback(event_callback __fn, int __index);
|
||||
|
||||
private:
|
||||
ios_base(const ios_base&); // = delete;
|
||||
ios_base& operator=(const ios_base&); // = delete;
|
||||
|
||||
public:
|
||||
static bool sync_with_stdio(bool __sync = true);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
|
||||
void clear(iostate __state = goodbit);
|
||||
_LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY bool good() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool eof() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool fail() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool bad() const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
|
||||
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except);
|
||||
|
||||
void __set_badbit_and_consider_rethrow();
|
||||
void __set_failbit_and_consider_rethrow();
|
||||
|
||||
protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ios_base() {// purposefully does no initialization
|
||||
}
|
||||
|
||||
void init(void* __sb);
|
||||
_LIBCPP_ALWAYS_INLINE void* rdbuf() const {return __rdbuf_;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void rdbuf(void* __sb)
|
||||
{
|
||||
__rdbuf_ = __sb;
|
||||
clear();
|
||||
}
|
||||
|
||||
void __call_callbacks(event);
|
||||
void copyfmt(const ios_base&);
|
||||
void move(ios_base&);
|
||||
void swap(ios_base&);
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void set_rdbuf(void* __sb)
|
||||
{
|
||||
__rdbuf_ = __sb;
|
||||
}
|
||||
|
||||
private:
|
||||
// All data members must be scalars
|
||||
fmtflags __fmtflags_;
|
||||
streamsize __precision_;
|
||||
streamsize __width_;
|
||||
iostate __rdstate_;
|
||||
iostate __exceptions_;
|
||||
void* __rdbuf_;
|
||||
void* __loc_;
|
||||
event_callback* __fn_;
|
||||
int* __index_;
|
||||
size_t __event_size_;
|
||||
size_t __event_cap_;
|
||||
static int __xindex_;
|
||||
long* __iarray_;
|
||||
size_t __iarray_size_;
|
||||
size_t __iarray_cap_;
|
||||
void** __parray_;
|
||||
size_t __parray_size_;
|
||||
size_t __parray_cap_;
|
||||
};
|
||||
|
||||
//enum class io_errc
|
||||
struct _LIBCPP_VISIBLE io_errc
|
||||
{
|
||||
enum _ {
|
||||
stream = 1
|
||||
};
|
||||
_ __v_;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE io_errc(_ __v) : __v_(__v) {}
|
||||
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
|
||||
|
||||
_LIBCPP_VISIBLE
|
||||
const error_category& iostream_category();
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
error_code
|
||||
make_error_code(io_errc __e)
|
||||
{
|
||||
return error_code(static_cast<int>(__e), iostream_category());
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
error_condition
|
||||
make_error_condition(io_errc __e)
|
||||
{
|
||||
return error_condition(static_cast<int>(__e), iostream_category());
|
||||
}
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI ios_base::failure
|
||||
: public system_error
|
||||
{
|
||||
public:
|
||||
explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
|
||||
explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
|
||||
virtual ~failure() throw();
|
||||
};
|
||||
|
||||
class _LIBCPP_VISIBLE ios_base::Init
|
||||
{
|
||||
public:
|
||||
Init();
|
||||
~Init();
|
||||
};
|
||||
|
||||
// fmtflags
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base::fmtflags
|
||||
ios_base::flags() const
|
||||
{
|
||||
return __fmtflags_;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base::fmtflags
|
||||
ios_base::flags(fmtflags __fmtfl)
|
||||
{
|
||||
fmtflags __r = __fmtflags_;
|
||||
__fmtflags_ = __fmtfl;
|
||||
return __r;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base::fmtflags
|
||||
ios_base::setf(fmtflags __fmtfl)
|
||||
{
|
||||
fmtflags __r = __fmtflags_;
|
||||
__fmtflags_ |= __fmtfl;
|
||||
return __r;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
ios_base::unsetf(fmtflags __mask)
|
||||
{
|
||||
__fmtflags_ &= ~__mask;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base::fmtflags
|
||||
ios_base::setf(fmtflags __fmtfl, fmtflags __mask)
|
||||
{
|
||||
fmtflags __r = __fmtflags_;
|
||||
unsetf(__mask);
|
||||
__fmtflags_ |= __fmtfl & __mask;
|
||||
return __r;
|
||||
}
|
||||
|
||||
// precision
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
streamsize
|
||||
ios_base::precision() const
|
||||
{
|
||||
return __precision_;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
streamsize
|
||||
ios_base::precision(streamsize __prec)
|
||||
{
|
||||
streamsize __r = __precision_;
|
||||
__precision_ = __prec;
|
||||
return __r;
|
||||
}
|
||||
|
||||
// width
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
streamsize
|
||||
ios_base::width() const
|
||||
{
|
||||
return __width_;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
streamsize
|
||||
ios_base::width(streamsize __wide)
|
||||
{
|
||||
streamsize __r = __width_;
|
||||
__width_ = __wide;
|
||||
return __r;
|
||||
}
|
||||
|
||||
// iostate
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base::iostate
|
||||
ios_base::rdstate() const
|
||||
{
|
||||
return __rdstate_;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
ios_base::setstate(iostate __state)
|
||||
{
|
||||
clear(__rdstate_ | __state);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
ios_base::good() const
|
||||
{
|
||||
return __rdstate_ == 0;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
ios_base::eof() const
|
||||
{
|
||||
return __rdstate_ & eofbit;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
ios_base::fail() const
|
||||
{
|
||||
return __rdstate_ & (failbit | badbit);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
ios_base::bad() const
|
||||
{
|
||||
return __rdstate_ & badbit;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base::iostate
|
||||
ios_base::exceptions() const
|
||||
{
|
||||
return __exceptions_;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
ios_base::exceptions(iostate __except)
|
||||
{
|
||||
__exceptions_ = __except;
|
||||
clear(__rdstate_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class _LIBCPP_VISIBLE basic_ios
|
||||
: public ios_base
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
typedef _CharT char_type;
|
||||
typedef _Traits traits_type;
|
||||
|
||||
typedef typename traits_type::int_type int_type;
|
||||
typedef typename traits_type::pos_type pos_type;
|
||||
typedef typename traits_type::off_type off_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE // explicit
|
||||
operator bool() const {return !fail();}
|
||||
_LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();}
|
||||
_LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();}
|
||||
_LIBCPP_ALWAYS_INLINE void clear(iostate __state = goodbit) {ios_base::clear(__state);}
|
||||
_LIBCPP_ALWAYS_INLINE void setstate(iostate __state) {ios_base::setstate(__state);}
|
||||
_LIBCPP_ALWAYS_INLINE bool good() const {return ios_base::good();}
|
||||
_LIBCPP_ALWAYS_INLINE bool eof() const {return ios_base::eof();}
|
||||
_LIBCPP_ALWAYS_INLINE bool fail() const {return ios_base::fail();}
|
||||
_LIBCPP_ALWAYS_INLINE bool bad() const {return ios_base::bad();}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();}
|
||||
_LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);}
|
||||
|
||||
// 27.5.4.1 Constructor/destructor:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
|
||||
virtual ~basic_ios();
|
||||
|
||||
// 27.5.4.2 Members:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<char_type, traits_type>* tie() const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_streambuf<char_type, traits_type>* rdbuf() const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
|
||||
|
||||
basic_ios& copyfmt(const basic_ios& __rhs);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type fill() const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type fill(char_type __ch);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
locale imbue(const locale& __loc);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char narrow(char_type __c, char __dfault) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type widen(char __c) const;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
basic_ios() {// purposefully does no initialization
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void init(basic_streambuf<char_type, traits_type>* __sb);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void move(basic_ios& __rhs);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void move(basic_ios&& __rhs) {move(__rhs);}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_ios& __rhs);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
|
||||
private:
|
||||
basic_ostream<char_type, traits_type>* __tie_;
|
||||
char_type __fill_;
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb)
|
||||
{
|
||||
init(__sb);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_ios<_CharT, _Traits>::~basic_ios()
|
||||
{
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
|
||||
{
|
||||
ios_base::init(__sb);
|
||||
__tie_ = 0;
|
||||
__fill_ = widen(' ');
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>*
|
||||
basic_ios<_CharT, _Traits>::tie() const
|
||||
{
|
||||
return __tie_;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>*
|
||||
basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr)
|
||||
{
|
||||
basic_ostream<char_type, traits_type>* __r = __tie_;
|
||||
__tie_ = __tiestr;
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_streambuf<_CharT, _Traits>*
|
||||
basic_ios<_CharT, _Traits>::rdbuf() const
|
||||
{
|
||||
return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_streambuf<_CharT, _Traits>*
|
||||
basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb)
|
||||
{
|
||||
basic_streambuf<char_type, traits_type>* __r = rdbuf();
|
||||
ios_base::rdbuf(__sb);
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
locale
|
||||
basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
|
||||
{
|
||||
locale __r = getloc();
|
||||
ios_base::imbue(__loc);
|
||||
if (rdbuf())
|
||||
rdbuf()->pubimbue(__loc);
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
char
|
||||
basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
|
||||
{
|
||||
return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_CharT
|
||||
basic_ios<_CharT, _Traits>::widen(char __c) const
|
||||
{
|
||||
return use_facet<ctype<char_type> >(getloc()).widen(__c);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_CharT
|
||||
basic_ios<_CharT, _Traits>::fill() const
|
||||
{
|
||||
return __fill_;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_CharT
|
||||
basic_ios<_CharT, _Traits>::fill(char_type __ch)
|
||||
{
|
||||
char_type __r = __fill_;
|
||||
__fill_ = __ch;
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_ios<_CharT, _Traits>&
|
||||
basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
|
||||
{
|
||||
if (this != &__rhs)
|
||||
{
|
||||
__call_callbacks(erase_event);
|
||||
ios_base::copyfmt(__rhs);
|
||||
__tie_ = __rhs.__tie_;
|
||||
__fill_ = __rhs.__fill_;
|
||||
__call_callbacks(copyfmt_event);
|
||||
exceptions(__rhs.exceptions());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
|
||||
{
|
||||
ios_base::move(__rhs);
|
||||
__tie_ = __rhs.__tie_;
|
||||
__rhs.__tie_ = 0;
|
||||
__fill_ = __rhs.__fill_;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs)
|
||||
{
|
||||
ios_base::swap(__rhs);
|
||||
_VSTD::swap(__tie_, __rhs.__tie_);
|
||||
_VSTD::swap(__fill_, __rhs.__fill_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb)
|
||||
{
|
||||
ios_base::set_rdbuf(__sb);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
boolalpha(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::boolalpha);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
noboolalpha(ios_base& __str)
|
||||
{
|
||||
__str.unsetf(ios_base::boolalpha);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
showbase(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::showbase);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
noshowbase(ios_base& __str)
|
||||
{
|
||||
__str.unsetf(ios_base::showbase);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
showpoint(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::showpoint);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
noshowpoint(ios_base& __str)
|
||||
{
|
||||
__str.unsetf(ios_base::showpoint);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
showpos(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::showpos);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
noshowpos(ios_base& __str)
|
||||
{
|
||||
__str.unsetf(ios_base::showpos);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
skipws(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::skipws);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
noskipws(ios_base& __str)
|
||||
{
|
||||
__str.unsetf(ios_base::skipws);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
uppercase(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::uppercase);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
nouppercase(ios_base& __str)
|
||||
{
|
||||
__str.unsetf(ios_base::uppercase);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
unitbuf(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::unitbuf);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
nounitbuf(ios_base& __str)
|
||||
{
|
||||
__str.unsetf(ios_base::unitbuf);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
internal(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::internal, ios_base::adjustfield);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
left(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::left, ios_base::adjustfield);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
right(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::right, ios_base::adjustfield);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
dec(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::dec, ios_base::basefield);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
hex(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::hex, ios_base::basefield);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
oct(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::oct, ios_base::basefield);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
fixed(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::fixed, ios_base::floatfield);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
scientific(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::scientific, ios_base::floatfield);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
hexfloat(ios_base& __str)
|
||||
{
|
||||
__str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
|
||||
return __str;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
ios_base&
|
||||
defaultfloat(ios_base& __str)
|
||||
{
|
||||
__str.unsetf(ios_base::floatfield);
|
||||
return __str;
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_IOS
|
192
final/include/iosfwd
Normal file
192
final/include/iosfwd
Normal file
@ -0,0 +1,192 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- iosfwd -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_IOSFWD
|
||||
#define _LIBCPP_IOSFWD
|
||||
|
||||
/*
|
||||
iosfwd synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template<class charT> struct char_traits;
|
||||
template<class T> class allocator;
|
||||
|
||||
class ios_base;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_ios;
|
||||
|
||||
template <class charT, class traits = char_traits<charT> > class basic_streambuf;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_istream;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_ostream;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_iostream;
|
||||
|
||||
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
|
||||
class basic_stringbuf;
|
||||
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
|
||||
class basic_istringstream;
|
||||
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
|
||||
class basic_ostringstream;
|
||||
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
|
||||
class basic_stringstream;
|
||||
|
||||
template <class charT, class traits = char_traits<charT> > class basic_filebuf;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_ifstream;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_ofstream;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_fstream;
|
||||
|
||||
template <class charT, class traits = char_traits<charT> > class istreambuf_iterator;
|
||||
template <class charT, class traits = char_traits<charT> > class ostreambuf_iterator;
|
||||
|
||||
typedef basic_ios<char> ios;
|
||||
typedef basic_ios<wchar_t> wios;
|
||||
|
||||
typedef basic_streambuf<char> streambuf;
|
||||
typedef basic_istream<char> istream;
|
||||
typedef basic_ostream<char> ostream;
|
||||
typedef basic_iostream<char> iostream;
|
||||
|
||||
typedef basic_stringbuf<char> stringbuf;
|
||||
typedef basic_istringstream<char> istringstream;
|
||||
typedef basic_ostringstream<char> ostringstream;
|
||||
typedef basic_stringstream<char> stringstream;
|
||||
|
||||
typedef basic_filebuf<char> filebuf;
|
||||
typedef basic_ifstream<char> ifstream;
|
||||
typedef basic_ofstream<char> ofstream;
|
||||
typedef basic_fstream<char> fstream;
|
||||
|
||||
typedef basic_streambuf<wchar_t> wstreambuf;
|
||||
typedef basic_istream<wchar_t> wistream;
|
||||
typedef basic_ostream<wchar_t> wostream;
|
||||
typedef basic_iostream<wchar_t> wiostream;
|
||||
|
||||
typedef basic_stringbuf<wchar_t> wstringbuf;
|
||||
typedef basic_istringstream<wchar_t> wistringstream;
|
||||
typedef basic_ostringstream<wchar_t> wostringstream;
|
||||
typedef basic_stringstream<wchar_t> wstringstream;
|
||||
|
||||
typedef basic_filebuf<wchar_t> wfilebuf;
|
||||
typedef basic_ifstream<wchar_t> wifstream;
|
||||
typedef basic_ofstream<wchar_t> wofstream;
|
||||
typedef basic_fstream<wchar_t> wfstream;
|
||||
|
||||
template <class state> class fpos;
|
||||
typedef fpos<char_traits<char>::state_type> streampos;
|
||||
typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <wchar.h> // for mbstate_t
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class ios_base;
|
||||
|
||||
template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
|
||||
template<class _Tp> class _LIBCPP_VISIBLE allocator;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_ios;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_streambuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_istream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_ostream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_iostream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_stringbuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_istringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_ostringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_stringstream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_filebuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_ifstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_ofstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_fstream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE istreambuf_iterator;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE ostreambuf_iterator;
|
||||
|
||||
typedef basic_ios<char> ios;
|
||||
typedef basic_ios<wchar_t> wios;
|
||||
|
||||
typedef basic_streambuf<char> streambuf;
|
||||
typedef basic_istream<char> istream;
|
||||
typedef basic_ostream<char> ostream;
|
||||
typedef basic_iostream<char> iostream;
|
||||
|
||||
typedef basic_stringbuf<char> stringbuf;
|
||||
typedef basic_istringstream<char> istringstream;
|
||||
typedef basic_ostringstream<char> ostringstream;
|
||||
typedef basic_stringstream<char> stringstream;
|
||||
|
||||
typedef basic_filebuf<char> filebuf;
|
||||
typedef basic_ifstream<char> ifstream;
|
||||
typedef basic_ofstream<char> ofstream;
|
||||
typedef basic_fstream<char> fstream;
|
||||
|
||||
typedef basic_streambuf<wchar_t> wstreambuf;
|
||||
typedef basic_istream<wchar_t> wistream;
|
||||
typedef basic_ostream<wchar_t> wostream;
|
||||
typedef basic_iostream<wchar_t> wiostream;
|
||||
|
||||
typedef basic_stringbuf<wchar_t> wstringbuf;
|
||||
typedef basic_istringstream<wchar_t> wistringstream;
|
||||
typedef basic_ostringstream<wchar_t> wostringstream;
|
||||
typedef basic_stringstream<wchar_t> wstringstream;
|
||||
|
||||
typedef basic_filebuf<wchar_t> wfilebuf;
|
||||
typedef basic_ifstream<wchar_t> wifstream;
|
||||
typedef basic_ofstream<wchar_t> wofstream;
|
||||
typedef basic_fstream<wchar_t> wfstream;
|
||||
|
||||
template <class _State> class _LIBCPP_VISIBLE fpos;
|
||||
typedef fpos<mbstate_t> streampos;
|
||||
typedef fpos<mbstate_t> wstreampos;
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef fpos<mbstate_t> u16streampos;
|
||||
typedef fpos<mbstate_t> u32streampos;
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
typedef long long streamoff; // for char_traits in <string>
|
||||
|
||||
template <class _CharT, // for <stdexcept>
|
||||
class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_string;
|
||||
typedef basic_string<char, char_traits<char>, allocator<char> > string;
|
||||
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_IOSFWD
|
58
final/include/iostream
Normal file
58
final/include/iostream
Normal file
@ -0,0 +1,58 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- iostream ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_IOSTREAM
|
||||
#define _LIBCPP_IOSTREAM
|
||||
|
||||
/*
|
||||
iostream synopsis
|
||||
|
||||
#include <ios>
|
||||
#include <streambuf>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
||||
namespace std {
|
||||
|
||||
extern istream cin;
|
||||
extern ostream cout;
|
||||
extern ostream cerr;
|
||||
extern ostream clog;
|
||||
extern wistream wcin;
|
||||
extern wostream wcout;
|
||||
extern wostream wcerr;
|
||||
extern wostream wclog;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <ios>
|
||||
#include <streambuf>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
extern _LIBCPP_VISIBLE istream cin;
|
||||
extern _LIBCPP_VISIBLE ostream cout;
|
||||
extern _LIBCPP_VISIBLE ostream cerr;
|
||||
extern _LIBCPP_VISIBLE ostream clog;
|
||||
extern _LIBCPP_VISIBLE wistream wcin;
|
||||
extern _LIBCPP_VISIBLE wostream wcout;
|
||||
extern _LIBCPP_VISIBLE wostream wcerr;
|
||||
extern _LIBCPP_VISIBLE wostream wclog;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_IOSTREAM
|
1709
final/include/istream
Normal file
1709
final/include/istream
Normal file
File diff suppressed because it is too large
Load Diff
1802
final/include/iterator
Normal file
1802
final/include/iterator
Normal file
File diff suppressed because it is too large
Load Diff
613
final/include/limits
Normal file
613
final/include/limits
Normal file
@ -0,0 +1,613 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- limits ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_LIMITS
|
||||
#define _LIBCPP_LIMITS
|
||||
|
||||
/*
|
||||
limits synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template<class T>
|
||||
class numeric_limits
|
||||
{
|
||||
public:
|
||||
static const bool is_specialized = false;
|
||||
static T min() noexcept;
|
||||
static T max() noexcept;
|
||||
static T lowest() noexcept;
|
||||
|
||||
static const int digits = 0;
|
||||
static const int digits10 = 0;
|
||||
static const int max_digits10 = 0;
|
||||
static const bool is_signed = false;
|
||||
static const bool is_integer = false;
|
||||
static const bool is_exact = false;
|
||||
static const int radix = 0;
|
||||
static T epsilon() noexcept;
|
||||
static T round_error() noexcept;
|
||||
|
||||
static const int min_exponent = 0;
|
||||
static const int min_exponent10 = 0;
|
||||
static const int max_exponent = 0;
|
||||
static const int max_exponent10 = 0;
|
||||
|
||||
static const bool has_infinity = false;
|
||||
static const bool has_quiet_NaN = false;
|
||||
static const bool has_signaling_NaN = false;
|
||||
static const float_denorm_style has_denorm = denorm_absent;
|
||||
static const bool has_denorm_loss = false;
|
||||
static T infinity() noexcept;
|
||||
static T quiet_NaN() noexcept;
|
||||
static T signaling_NaN() noexcept;
|
||||
static T denorm_min() noexcept;
|
||||
|
||||
static const bool is_iec559 = false;
|
||||
static const bool is_bounded = false;
|
||||
static const bool is_modulo = false;
|
||||
|
||||
static const bool traps = false;
|
||||
static const bool tinyness_before = false;
|
||||
static const float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
enum float_round_style
|
||||
{
|
||||
round_indeterminate = -1,
|
||||
round_toward_zero = 0,
|
||||
round_to_nearest = 1,
|
||||
round_toward_infinity = 2,
|
||||
round_toward_neg_infinity = 3
|
||||
};
|
||||
|
||||
enum float_denorm_style
|
||||
{
|
||||
denorm_indeterminate = -1,
|
||||
denorm_absent = 0,
|
||||
denorm_present = 1
|
||||
};
|
||||
|
||||
template<> class numeric_limits<cv bool>;
|
||||
|
||||
template<> class numeric_limits<cv char>;
|
||||
template<> class numeric_limits<cv signed char>;
|
||||
template<> class numeric_limits<cv unsigned char>;
|
||||
template<> class numeric_limits<cv wchar_t>;
|
||||
template<> class numeric_limits<cv char16_t>;
|
||||
template<> class numeric_limits<cv char32_t>;
|
||||
|
||||
template<> class numeric_limits<cv short>;
|
||||
template<> class numeric_limits<cv int>;
|
||||
template<> class numeric_limits<cv long>;
|
||||
template<> class numeric_limits<cv long long>;
|
||||
template<> class numeric_limits<cv unsigned short>;
|
||||
template<> class numeric_limits<cv unsigned int>;
|
||||
template<> class numeric_limits<cv unsigned long>;
|
||||
template<> class numeric_limits<cv unsigned long long>;
|
||||
|
||||
template<> class numeric_limits<cv float>;
|
||||
template<> class numeric_limits<cv double>;
|
||||
template<> class numeric_limits<cv long double>;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
enum float_round_style
|
||||
{
|
||||
round_indeterminate = -1,
|
||||
round_toward_zero = 0,
|
||||
round_to_nearest = 1,
|
||||
round_toward_infinity = 2,
|
||||
round_toward_neg_infinity = 3
|
||||
};
|
||||
|
||||
enum float_denorm_style
|
||||
{
|
||||
denorm_indeterminate = -1,
|
||||
denorm_absent = 0,
|
||||
denorm_present = 1
|
||||
};
|
||||
|
||||
template <class _Tp, bool = is_arithmetic<_Tp>::value>
|
||||
class __libcpp_numeric_limits
|
||||
{
|
||||
protected:
|
||||
typedef _Tp type;
|
||||
|
||||
static const bool is_specialized = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return type();}
|
||||
|
||||
static const int digits = 0;
|
||||
static const int digits10 = 0;
|
||||
static const int max_digits10 = 0;
|
||||
static const bool is_signed = false;
|
||||
static const bool is_integer = false;
|
||||
static const bool is_exact = false;
|
||||
static const int radix = 0;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type();}
|
||||
|
||||
static const int min_exponent = 0;
|
||||
static const int min_exponent10 = 0;
|
||||
static const int max_exponent = 0;
|
||||
static const int max_exponent10 = 0;
|
||||
|
||||
static const bool has_infinity = false;
|
||||
static const bool has_quiet_NaN = false;
|
||||
static const bool has_signaling_NaN = false;
|
||||
static const float_denorm_style has_denorm = denorm_absent;
|
||||
static const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type();}
|
||||
|
||||
static const bool is_iec559 = false;
|
||||
static const bool is_bounded = false;
|
||||
static const bool is_modulo = false;
|
||||
|
||||
static const bool traps = false;
|
||||
static const bool tinyness_before = false;
|
||||
static const float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <class _Tp, int digits, bool is_signed>
|
||||
struct __libcpp_compute_min
|
||||
{
|
||||
static const _Tp value = _Tp(_Tp(1) << digits);
|
||||
};
|
||||
|
||||
template <class _Tp, int digits>
|
||||
struct __libcpp_compute_min<_Tp, digits, false>
|
||||
{
|
||||
static const _Tp value = _Tp(0);
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class __libcpp_numeric_limits<_Tp, true>
|
||||
{
|
||||
protected:
|
||||
typedef _Tp type;
|
||||
|
||||
static const bool is_specialized = true;
|
||||
|
||||
static const bool is_signed = type(-1) < type(0);
|
||||
static const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed);
|
||||
static const int digits10 = digits * 3 / 10;
|
||||
static const int max_digits10 = 0;
|
||||
static const type __min = __libcpp_compute_min<type, digits, is_signed>::value;
|
||||
static const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __min;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __max;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return min();}
|
||||
|
||||
static const bool is_integer = true;
|
||||
static const bool is_exact = true;
|
||||
static const int radix = 2;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type(0);}
|
||||
|
||||
static const int min_exponent = 0;
|
||||
static const int min_exponent10 = 0;
|
||||
static const int max_exponent = 0;
|
||||
static const int max_exponent10 = 0;
|
||||
|
||||
static const bool has_infinity = false;
|
||||
static const bool has_quiet_NaN = false;
|
||||
static const bool has_signaling_NaN = false;
|
||||
static const float_denorm_style has_denorm = denorm_absent;
|
||||
static const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type(0);}
|
||||
|
||||
static const bool is_iec559 = false;
|
||||
static const bool is_bounded = true;
|
||||
static const bool is_modulo = true;
|
||||
|
||||
#if __i386__ || __x86_64__
|
||||
static const bool traps = true;
|
||||
#else
|
||||
static const bool traps = false;
|
||||
#endif
|
||||
static const bool tinyness_before = false;
|
||||
static const float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class __libcpp_numeric_limits<bool, true>
|
||||
{
|
||||
protected:
|
||||
typedef bool type;
|
||||
|
||||
static const bool is_specialized = true;
|
||||
|
||||
static const bool is_signed = false;
|
||||
static const int digits = 1;
|
||||
static const int digits10 = 0;
|
||||
static const int max_digits10 = 0;
|
||||
static const type __min = false;
|
||||
static const type __max = true;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __min;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __max;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return min();}
|
||||
|
||||
static const bool is_integer = true;
|
||||
static const bool is_exact = true;
|
||||
static const int radix = 2;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type(0);}
|
||||
|
||||
static const int min_exponent = 0;
|
||||
static const int min_exponent10 = 0;
|
||||
static const int max_exponent = 0;
|
||||
static const int max_exponent10 = 0;
|
||||
|
||||
static const bool has_infinity = false;
|
||||
static const bool has_quiet_NaN = false;
|
||||
static const bool has_signaling_NaN = false;
|
||||
static const float_denorm_style has_denorm = denorm_absent;
|
||||
static const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type(0);}
|
||||
|
||||
static const bool is_iec559 = false;
|
||||
static const bool is_bounded = true;
|
||||
static const bool is_modulo = false;
|
||||
|
||||
static const bool traps = false;
|
||||
static const bool tinyness_before = false;
|
||||
static const float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class __libcpp_numeric_limits<float, true>
|
||||
{
|
||||
protected:
|
||||
typedef float type;
|
||||
|
||||
static const bool is_specialized = true;
|
||||
|
||||
static const bool is_signed = true;
|
||||
static const int digits = __FLT_MANT_DIG__;
|
||||
static const int digits10 = __FLT_DIG__;
|
||||
static const int max_digits10 = 2+(digits * 30103)/100000;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __FLT_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __FLT_MAX__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();}
|
||||
|
||||
static const bool is_integer = false;
|
||||
static const bool is_exact = false;
|
||||
static const int radix = __FLT_RADIX__;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __FLT_EPSILON__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5F;}
|
||||
|
||||
static const int min_exponent = __FLT_MIN_EXP__;
|
||||
static const int min_exponent10 = __FLT_MIN_10_EXP__;
|
||||
static const int max_exponent = __FLT_MAX_EXP__;
|
||||
static const int max_exponent10 = __FLT_MAX_10_EXP__;
|
||||
|
||||
static const bool has_infinity = true;
|
||||
static const bool has_quiet_NaN = true;
|
||||
static const bool has_signaling_NaN = true;
|
||||
static const float_denorm_style has_denorm = denorm_present;
|
||||
static const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_valf();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nanf("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nansf("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;}
|
||||
|
||||
static const bool is_iec559 = true;
|
||||
static const bool is_bounded = true;
|
||||
static const bool is_modulo = false;
|
||||
|
||||
static const bool traps = false;
|
||||
static const bool tinyness_before = false;
|
||||
static const float_round_style round_style = round_to_nearest;
|
||||
};
|
||||
|
||||
template <>
|
||||
class __libcpp_numeric_limits<double, true>
|
||||
{
|
||||
protected:
|
||||
typedef double type;
|
||||
|
||||
static const bool is_specialized = true;
|
||||
|
||||
static const bool is_signed = true;
|
||||
static const int digits = __DBL_MANT_DIG__;
|
||||
static const int digits10 = __DBL_DIG__;
|
||||
static const int max_digits10 = 2+(digits * 30103)/100000;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __DBL_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __DBL_MAX__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();}
|
||||
|
||||
static const bool is_integer = false;
|
||||
static const bool is_exact = false;
|
||||
static const int radix = __FLT_RADIX__;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __DBL_EPSILON__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5;}
|
||||
|
||||
static const int min_exponent = __DBL_MIN_EXP__;
|
||||
static const int min_exponent10 = __DBL_MIN_10_EXP__;
|
||||
static const int max_exponent = __DBL_MAX_EXP__;
|
||||
static const int max_exponent10 = __DBL_MAX_10_EXP__;
|
||||
|
||||
static const bool has_infinity = true;
|
||||
static const bool has_quiet_NaN = true;
|
||||
static const bool has_signaling_NaN = true;
|
||||
static const float_denorm_style has_denorm = denorm_present;
|
||||
static const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_val();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nan("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nans("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;}
|
||||
|
||||
static const bool is_iec559 = true;
|
||||
static const bool is_bounded = true;
|
||||
static const bool is_modulo = false;
|
||||
|
||||
static const bool traps = false;
|
||||
static const bool tinyness_before = false;
|
||||
static const float_round_style round_style = round_to_nearest;
|
||||
};
|
||||
|
||||
template <>
|
||||
class __libcpp_numeric_limits<long double, true>
|
||||
{
|
||||
protected:
|
||||
typedef long double type;
|
||||
|
||||
static const bool is_specialized = true;
|
||||
|
||||
static const bool is_signed = true;
|
||||
static const int digits = __LDBL_MANT_DIG__;
|
||||
static const int digits10 = __LDBL_DIG__;
|
||||
static const int max_digits10 = 2+(digits * 30103)/100000;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __LDBL_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __LDBL_MAX__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();}
|
||||
|
||||
static const bool is_integer = false;
|
||||
static const bool is_exact = false;
|
||||
static const int radix = __FLT_RADIX__;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5;}
|
||||
|
||||
static const int min_exponent = __LDBL_MIN_EXP__;
|
||||
static const int min_exponent10 = __LDBL_MIN_10_EXP__;
|
||||
static const int max_exponent = __LDBL_MAX_EXP__;
|
||||
static const int max_exponent10 = __LDBL_MAX_10_EXP__;
|
||||
|
||||
static const bool has_infinity = true;
|
||||
static const bool has_quiet_NaN = true;
|
||||
static const bool has_signaling_NaN = true;
|
||||
static const float_denorm_style has_denorm = denorm_present;
|
||||
static const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_vall();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nanl("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
|
||||
|
||||
#if (defined(__ppc__) || defined(__ppc64__))
|
||||
static const bool is_iec559 = false;
|
||||
#else
|
||||
static const bool is_iec559 = true;
|
||||
#endif
|
||||
static const bool is_bounded = true;
|
||||
static const bool is_modulo = false;
|
||||
|
||||
static const bool traps = false;
|
||||
static const bool tinyness_before = false;
|
||||
static const float_round_style round_style = round_to_nearest;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE numeric_limits
|
||||
: private __libcpp_numeric_limits<typename remove_cv<_Tp>::type>
|
||||
{
|
||||
typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base;
|
||||
typedef typename __base::type type;
|
||||
public:
|
||||
static const bool is_specialized = __base::is_specialized;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
|
||||
|
||||
static const int digits = __base::digits;
|
||||
static const int digits10 = __base::digits10;
|
||||
static const int max_digits10 = __base::max_digits10;
|
||||
static const bool is_signed = __base::is_signed;
|
||||
static const bool is_integer = __base::is_integer;
|
||||
static const bool is_exact = __base::is_exact;
|
||||
static const int radix = __base::radix;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
|
||||
|
||||
static const int min_exponent = __base::min_exponent;
|
||||
static const int min_exponent10 = __base::min_exponent10;
|
||||
static const int max_exponent = __base::max_exponent;
|
||||
static const int max_exponent10 = __base::max_exponent10;
|
||||
|
||||
static const bool has_infinity = __base::has_infinity;
|
||||
static const bool has_quiet_NaN = __base::has_quiet_NaN;
|
||||
static const bool has_signaling_NaN = __base::has_signaling_NaN;
|
||||
static const float_denorm_style has_denorm = __base::has_denorm;
|
||||
static const bool has_denorm_loss = __base::has_denorm_loss;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
|
||||
|
||||
static const bool is_iec559 = __base::is_iec559;
|
||||
static const bool is_bounded = __base::is_bounded;
|
||||
static const bool is_modulo = __base::is_modulo;
|
||||
|
||||
static const bool traps = __base::traps;
|
||||
static const bool tinyness_before = __base::tinyness_before;
|
||||
static const float_round_style round_style = __base::round_style;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE numeric_limits<const _Tp>
|
||||
: private numeric_limits<_Tp>
|
||||
{
|
||||
typedef numeric_limits<_Tp> __base;
|
||||
typedef _Tp type;
|
||||
public:
|
||||
static const bool is_specialized = __base::is_specialized;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
|
||||
|
||||
static const int digits = __base::digits;
|
||||
static const int digits10 = __base::digits10;
|
||||
static const int max_digits10 = __base::max_digits10;
|
||||
static const bool is_signed = __base::is_signed;
|
||||
static const bool is_integer = __base::is_integer;
|
||||
static const bool is_exact = __base::is_exact;
|
||||
static const int radix = __base::radix;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
|
||||
|
||||
static const int min_exponent = __base::min_exponent;
|
||||
static const int min_exponent10 = __base::min_exponent10;
|
||||
static const int max_exponent = __base::max_exponent;
|
||||
static const int max_exponent10 = __base::max_exponent10;
|
||||
|
||||
static const bool has_infinity = __base::has_infinity;
|
||||
static const bool has_quiet_NaN = __base::has_quiet_NaN;
|
||||
static const bool has_signaling_NaN = __base::has_signaling_NaN;
|
||||
static const float_denorm_style has_denorm = __base::has_denorm;
|
||||
static const bool has_denorm_loss = __base::has_denorm_loss;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
|
||||
|
||||
static const bool is_iec559 = __base::is_iec559;
|
||||
static const bool is_bounded = __base::is_bounded;
|
||||
static const bool is_modulo = __base::is_modulo;
|
||||
|
||||
static const bool traps = __base::traps;
|
||||
static const bool tinyness_before = __base::tinyness_before;
|
||||
static const float_round_style round_style = __base::round_style;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE numeric_limits<volatile _Tp>
|
||||
: private numeric_limits<_Tp>
|
||||
{
|
||||
typedef numeric_limits<_Tp> __base;
|
||||
typedef _Tp type;
|
||||
public:
|
||||
static const bool is_specialized = __base::is_specialized;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
|
||||
|
||||
static const int digits = __base::digits;
|
||||
static const int digits10 = __base::digits10;
|
||||
static const int max_digits10 = __base::max_digits10;
|
||||
static const bool is_signed = __base::is_signed;
|
||||
static const bool is_integer = __base::is_integer;
|
||||
static const bool is_exact = __base::is_exact;
|
||||
static const int radix = __base::radix;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
|
||||
|
||||
static const int min_exponent = __base::min_exponent;
|
||||
static const int min_exponent10 = __base::min_exponent10;
|
||||
static const int max_exponent = __base::max_exponent;
|
||||
static const int max_exponent10 = __base::max_exponent10;
|
||||
|
||||
static const bool has_infinity = __base::has_infinity;
|
||||
static const bool has_quiet_NaN = __base::has_quiet_NaN;
|
||||
static const bool has_signaling_NaN = __base::has_signaling_NaN;
|
||||
static const float_denorm_style has_denorm = __base::has_denorm;
|
||||
static const bool has_denorm_loss = __base::has_denorm_loss;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
|
||||
|
||||
static const bool is_iec559 = __base::is_iec559;
|
||||
static const bool is_bounded = __base::is_bounded;
|
||||
static const bool is_modulo = __base::is_modulo;
|
||||
|
||||
static const bool traps = __base::traps;
|
||||
static const bool tinyness_before = __base::tinyness_before;
|
||||
static const float_round_style round_style = __base::round_style;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE numeric_limits<const volatile _Tp>
|
||||
: private numeric_limits<_Tp>
|
||||
{
|
||||
typedef numeric_limits<_Tp> __base;
|
||||
typedef _Tp type;
|
||||
public:
|
||||
static const bool is_specialized = __base::is_specialized;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
|
||||
|
||||
static const int digits = __base::digits;
|
||||
static const int digits10 = __base::digits10;
|
||||
static const int max_digits10 = __base::max_digits10;
|
||||
static const bool is_signed = __base::is_signed;
|
||||
static const bool is_integer = __base::is_integer;
|
||||
static const bool is_exact = __base::is_exact;
|
||||
static const int radix = __base::radix;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
|
||||
|
||||
static const int min_exponent = __base::min_exponent;
|
||||
static const int min_exponent10 = __base::min_exponent10;
|
||||
static const int max_exponent = __base::max_exponent;
|
||||
static const int max_exponent10 = __base::max_exponent10;
|
||||
|
||||
static const bool has_infinity = __base::has_infinity;
|
||||
static const bool has_quiet_NaN = __base::has_quiet_NaN;
|
||||
static const bool has_signaling_NaN = __base::has_signaling_NaN;
|
||||
static const float_denorm_style has_denorm = __base::has_denorm;
|
||||
static const bool has_denorm_loss = __base::has_denorm_loss;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
|
||||
|
||||
static const bool is_iec559 = __base::is_iec559;
|
||||
static const bool is_bounded = __base::is_bounded;
|
||||
static const bool is_modulo = __base::is_modulo;
|
||||
|
||||
static const bool traps = __base::traps;
|
||||
static const bool tinyness_before = __base::tinyness_before;
|
||||
static const float_round_style round_style = __base::round_style;
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_LIMITS
|
2271
final/include/list
Normal file
2271
final/include/list
Normal file
File diff suppressed because it is too large
Load Diff
4483
final/include/locale
Normal file
4483
final/include/locale
Normal file
File diff suppressed because it is too large
Load Diff
1929
final/include/map
Normal file
1929
final/include/map
Normal file
File diff suppressed because it is too large
Load Diff
4191
final/include/memory
Normal file
4191
final/include/memory
Normal file
File diff suppressed because it is too large
Load Diff
560
final/include/mutex
Normal file
560
final/include/mutex
Normal file
@ -0,0 +1,560 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- mutex ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_MUTEX
|
||||
#define _LIBCPP_MUTEX
|
||||
|
||||
/*
|
||||
mutex synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
class mutex
|
||||
{
|
||||
public:
|
||||
mutex();
|
||||
~mutex();
|
||||
|
||||
mutex(const mutex&) = delete;
|
||||
mutex& operator=(const mutex&) = delete;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
native_handle_type native_handle();
|
||||
};
|
||||
|
||||
class recursive_mutex
|
||||
{
|
||||
public:
|
||||
recursive_mutex();
|
||||
~recursive_mutex();
|
||||
|
||||
recursive_mutex(const recursive_mutex&) = delete;
|
||||
recursive_mutex& operator=(const recursive_mutex&) = delete;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
native_handle_type native_handle();
|
||||
};
|
||||
|
||||
class timed_mutex
|
||||
{
|
||||
public:
|
||||
timed_mutex();
|
||||
~timed_mutex();
|
||||
|
||||
timed_mutex(const timed_mutex&) = delete;
|
||||
timed_mutex& operator=(const timed_mutex&) = delete;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
template <class Rep, class Period>
|
||||
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
||||
void unlock();
|
||||
};
|
||||
|
||||
class recursive_timed_mutex
|
||||
{
|
||||
public:
|
||||
recursive_timed_mutex();
|
||||
~recursive_timed_mutex();
|
||||
|
||||
recursive_timed_mutex(const recursive_timed_mutex&) = delete;
|
||||
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
template <class Rep, class Period>
|
||||
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
||||
void unlock();
|
||||
};
|
||||
|
||||
struct defer_lock_t {};
|
||||
struct try_to_lock_t {};
|
||||
struct adopt_lock_t {};
|
||||
|
||||
constexpr defer_lock_t defer_lock{};
|
||||
constexpr try_to_lock_t try_to_lock{};
|
||||
constexpr adopt_lock_t adopt_lock{};
|
||||
|
||||
template <class Mutex>
|
||||
class lock_guard
|
||||
{
|
||||
public:
|
||||
typedef Mutex mutex_type;
|
||||
|
||||
explicit lock_guard(mutex_type& m);
|
||||
lock_guard(mutex_type& m, adopt_lock_t);
|
||||
~lock_guard();
|
||||
|
||||
lock_guard(lock_guard const&) = delete;
|
||||
lock_guard& operator=(lock_guard const&) = delete;
|
||||
};
|
||||
|
||||
template <class Mutex>
|
||||
class unique_lock
|
||||
{
|
||||
public:
|
||||
typedef Mutex mutex_type;
|
||||
unique_lock();
|
||||
explicit unique_lock(mutex_type& m);
|
||||
unique_lock(mutex_type& m, defer_lock_t);
|
||||
unique_lock(mutex_type& m, try_to_lock_t);
|
||||
unique_lock(mutex_type& m, adopt_lock_t);
|
||||
template <class Clock, class Duration>
|
||||
unique_lock(mutex_type& m, const chrono::time_point<Clock, Duration>& abs_time);
|
||||
template <class Rep, class Period>
|
||||
unique_lock(mutex_type& m, const chrono::duration<Rep, Period>& rel_time);
|
||||
~unique_lock();
|
||||
|
||||
unique_lock(unique_lock const&) = delete;
|
||||
unique_lock& operator=(unique_lock const&) = delete;
|
||||
|
||||
unique_lock(unique_lock&& u);
|
||||
unique_lock& operator=(unique_lock&& u);
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
|
||||
template <class Rep, class Period>
|
||||
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
||||
|
||||
void unlock();
|
||||
|
||||
void swap(unique_lock& u);
|
||||
mutex_type* release();
|
||||
|
||||
bool owns_lock() const;
|
||||
explicit operator bool () const;
|
||||
mutex_type* mutex() const;
|
||||
};
|
||||
|
||||
template <class Mutex>
|
||||
void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y);
|
||||
|
||||
template <class L1, class L2, class... L3>
|
||||
int try_lock(L1&, L2&, L3&...);
|
||||
template <class L1, class L2, class... L3>
|
||||
void lock(L1&, L2&, L3&...);
|
||||
|
||||
struct once_flag
|
||||
{
|
||||
constexpr once_flag();
|
||||
|
||||
once_flag(const once_flag&) = delete;
|
||||
once_flag& operator=(const once_flag&) = delete;
|
||||
};
|
||||
|
||||
template<class Callable, class ...Args>
|
||||
void call_once(once_flag& flag, Callable&& func, Args&&... args);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__mutex_base>
|
||||
#include <functional>
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#include <tuple>
|
||||
#endif
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_VISIBLE recursive_mutex
|
||||
{
|
||||
pthread_mutex_t __m_;
|
||||
|
||||
public:
|
||||
recursive_mutex();
|
||||
~recursive_mutex();
|
||||
|
||||
private:
|
||||
recursive_mutex(const recursive_mutex&); // = delete;
|
||||
recursive_mutex& operator=(const recursive_mutex&); // = delete;
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
native_handle_type native_handle() {return &__m_;}
|
||||
};
|
||||
|
||||
class _LIBCPP_VISIBLE timed_mutex
|
||||
{
|
||||
mutex __m_;
|
||||
condition_variable __cv_;
|
||||
bool __locked_;
|
||||
public:
|
||||
timed_mutex();
|
||||
~timed_mutex();
|
||||
|
||||
private:
|
||||
timed_mutex(const timed_mutex&); // = delete;
|
||||
timed_mutex& operator=(const timed_mutex&); // = delete;
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
||||
template <class _Clock, class _Duration>
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
void unlock();
|
||||
};
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
bool
|
||||
timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
unique_lock<mutex> __lk(__m_);
|
||||
bool no_timeout = _Clock::now() < __t;
|
||||
while (no_timeout && __locked_)
|
||||
no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
|
||||
if (!__locked_)
|
||||
{
|
||||
__locked_ = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
class _LIBCPP_VISIBLE recursive_timed_mutex
|
||||
{
|
||||
mutex __m_;
|
||||
condition_variable __cv_;
|
||||
size_t __count_;
|
||||
pthread_t __id_;
|
||||
public:
|
||||
recursive_timed_mutex();
|
||||
~recursive_timed_mutex();
|
||||
|
||||
private:
|
||||
recursive_timed_mutex(const recursive_timed_mutex&); // = delete;
|
||||
recursive_timed_mutex& operator=(const recursive_timed_mutex&); // = delete;
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
||||
template <class _Clock, class _Duration>
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
void unlock();
|
||||
};
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
bool
|
||||
recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
pthread_t __id = pthread_self();
|
||||
unique_lock<mutex> lk(__m_);
|
||||
if (pthread_equal(__id, __id_))
|
||||
{
|
||||
if (__count_ == numeric_limits<size_t>::max())
|
||||
return false;
|
||||
++__count_;
|
||||
return true;
|
||||
}
|
||||
bool no_timeout = _Clock::now() < __t;
|
||||
while (no_timeout && __count_ != 0)
|
||||
no_timeout = __cv_.wait_until(lk, __t) == cv_status::no_timeout;
|
||||
if (__count_ == 0)
|
||||
{
|
||||
__count_ = 1;
|
||||
__id_ = __id;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class _L0, class _L1>
|
||||
int
|
||||
try_lock(_L0& __l0, _L1& __l1)
|
||||
{
|
||||
unique_lock<_L0> __u0(__l0, try_to_lock);
|
||||
if (__u0.owns_lock())
|
||||
{
|
||||
if (__l1.try_lock())
|
||||
{
|
||||
__u0.release();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _L0, class _L1, class _L2, class... _L3>
|
||||
int
|
||||
try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
|
||||
{
|
||||
int __r = 0;
|
||||
unique_lock<_L0> __u0(__l0, try_to_lock);
|
||||
if (__u0.owns_lock())
|
||||
{
|
||||
__r = try_lock(__l1, __l2, __l3...);
|
||||
if (__r == -1)
|
||||
__u0.release();
|
||||
else
|
||||
++__r;
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _L0, class _L1>
|
||||
void
|
||||
lock(_L0& __l0, _L1& __l1)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
{
|
||||
unique_lock<_L0> __u0(__l0);
|
||||
if (__l1.try_lock())
|
||||
{
|
||||
__u0.release();
|
||||
break;
|
||||
}
|
||||
}
|
||||
sched_yield();
|
||||
{
|
||||
unique_lock<_L1> __u1(__l1);
|
||||
if (__l0.try_lock())
|
||||
{
|
||||
__u1.release();
|
||||
break;
|
||||
}
|
||||
}
|
||||
sched_yield();
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _L0, class _L1, class _L2, class ..._L3>
|
||||
void
|
||||
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
switch (__i)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
unique_lock<_L0> __u0(__l0);
|
||||
__i = try_lock(__l1, __l2, __l3...);
|
||||
if (__i == -1)
|
||||
{
|
||||
__u0.release();
|
||||
return;
|
||||
}
|
||||
}
|
||||
++__i;
|
||||
sched_yield();
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
unique_lock<_L1> __u1(__l1);
|
||||
__i = try_lock(__l2, __l3..., __l0);
|
||||
if (__i == -1)
|
||||
{
|
||||
__u1.release();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (__i == sizeof...(_L3) + 1)
|
||||
__i = 0;
|
||||
else
|
||||
__i += 2;
|
||||
sched_yield();
|
||||
break;
|
||||
default:
|
||||
__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class _L0, class _L1, class _L2, class ..._L3>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
|
||||
{
|
||||
__lock_first(0, __l0, __l1, __l2, __l3...);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
struct once_flag;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable, class... _Args>
|
||||
void call_once(once_flag&, _Callable&&, _Args&&...);
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable>
|
||||
void call_once(once_flag&, _Callable);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
struct _LIBCPP_VISIBLE once_flag
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
// constexpr
|
||||
once_flag() {}
|
||||
|
||||
private:
|
||||
once_flag(const once_flag&); // = delete;
|
||||
once_flag& operator=(const once_flag&); // = delete;
|
||||
|
||||
unsigned long __state_;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template<class _Callable, class... _Args>
|
||||
friend
|
||||
void call_once(once_flag&, _Callable&&, _Args&&...);
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
template<class _Callable>
|
||||
friend
|
||||
void call_once(once_flag&, _Callable);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _F>
|
||||
class __call_once_param
|
||||
{
|
||||
_F __f_;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _F& __f) : __f_(__f) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()()
|
||||
{
|
||||
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
|
||||
__execute(_Index());
|
||||
}
|
||||
|
||||
private:
|
||||
template <size_t ..._Indices>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __execute(__tuple_indices<_Indices...>)
|
||||
{
|
||||
__invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <class _F>
|
||||
class __call_once_param
|
||||
{
|
||||
_F __f_;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _F& __f) : __f_(__f) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()()
|
||||
{
|
||||
__f_();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template <class _F>
|
||||
void
|
||||
__call_once_proxy(void* __vp)
|
||||
{
|
||||
__call_once_param<_F>* __p = static_cast<__call_once_param<_F>*>(__vp);
|
||||
(*__p)();
|
||||
}
|
||||
|
||||
void __call_once(volatile unsigned long&, void*, void(*)(void*));
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable, class... _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
|
||||
{
|
||||
if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
|
||||
{
|
||||
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _G;
|
||||
__call_once_param<_G> __p(_G(__decay_copy(_VSTD::forward<_Callable>(__func)),
|
||||
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
|
||||
}
|
||||
}
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
call_once(once_flag& __flag, _Callable __func)
|
||||
{
|
||||
if (__flag.__state_ != ~0ul)
|
||||
{
|
||||
__call_once_param<_Callable> __p(__func);
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_MUTEX
|
115
final/include/new
Normal file
115
final/include/new
Normal file
@ -0,0 +1,115 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------- new ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_NEW
|
||||
#define _LIBCPP_NEW
|
||||
|
||||
/*
|
||||
new synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
class bad_alloc
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_alloc() noexcept;
|
||||
bad_alloc(const bad_alloc&) noexcept;
|
||||
bad_alloc& operator=(const bad_alloc&) noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
struct nothrow_t {};
|
||||
extern const nothrow_t nothrow;
|
||||
typedef void (*new_handler)();
|
||||
new_handler set_new_handler(new_handler new_p) noexcept;
|
||||
new_handler get_new_handler() noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
void* operator new(std::size_t size); // replaceable
|
||||
void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable
|
||||
void operator delete(void* ptr) noexcept; // replaceable
|
||||
void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable
|
||||
|
||||
void* operator new[](std::size_t size); // replaceable
|
||||
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable
|
||||
void operator delete[](void* ptr) noexcept; // replaceable
|
||||
void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable
|
||||
|
||||
void* operator new (std::size_t size, void* ptr) noexcept;
|
||||
void* operator new[](std::size_t size, void* ptr) noexcept;
|
||||
void operator delete (void* ptr, void*) noexcept;
|
||||
void operator delete[](void* ptr, void*) noexcept;
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <exception>
|
||||
#include <cstddef>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_alloc
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_alloc() _NOEXCEPT;
|
||||
virtual ~bad_alloc() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_array_new_length
|
||||
: public bad_alloc
|
||||
{
|
||||
public:
|
||||
bad_array_new_length() _NOEXCEPT;
|
||||
virtual ~bad_array_new_length() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
void __throw_bad_alloc(); // not in C++ spec
|
||||
|
||||
struct _LIBCPP_VISIBLE nothrow_t {};
|
||||
extern _LIBCPP_VISIBLE const nothrow_t nothrow;
|
||||
typedef void (*new_handler)();
|
||||
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE new_handler get_new_handler() _NOEXCEPT;
|
||||
|
||||
} // std
|
||||
|
||||
_LIBCPP_VISIBLE void* operator new(std::size_t __sz)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
;
|
||||
_LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete(void* __p) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
;
|
||||
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete[](void* __p) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) _NOEXCEPT {}
|
||||
|
||||
#endif // _LIBCPP_NEW
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user