Compare commits
70 Commits
svn-tags/l
...
svn-tags/l
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8296d401e7 | ||
![]() |
2d72b1e393 | ||
![]() |
e48e36623b | ||
![]() |
0e1493ec5e | ||
![]() |
eee7698bac | ||
![]() |
626916fc25 | ||
![]() |
b8f787b188 | ||
![]() |
f190e97885 | ||
![]() |
31aaf55f4c | ||
![]() |
1b18a48e28 | ||
![]() |
770d1c4ea7 | ||
![]() |
c9f5d9fca6 | ||
![]() |
d2f6afbfab | ||
![]() |
57e5e87323 | ||
![]() |
f02417b600 | ||
![]() |
91e2f26fec | ||
![]() |
4777bf2799 | ||
![]() |
7a0248d2d7 | ||
![]() |
d42c4beeff | ||
![]() |
1f970ad73a | ||
![]() |
55ddb21dd4 | ||
![]() |
a445151f4a | ||
![]() |
7de47902d0 | ||
![]() |
ac417faebc | ||
![]() |
d397d03651 | ||
![]() |
c706565c88 | ||
![]() |
6051e24e45 | ||
![]() |
adaa6266fe | ||
![]() |
8771430346 | ||
![]() |
46ab5def62 | ||
![]() |
fa5043d878 | ||
![]() |
83b6979fa2 | ||
![]() |
59a5ddbbd1 | ||
![]() |
afff5aacd6 | ||
![]() |
17c3a81048 | ||
![]() |
5711e4daf0 | ||
![]() |
6587dfe980 | ||
![]() |
73d2f94f6b | ||
![]() |
091f2ab44f | ||
![]() |
6689564040 | ||
![]() |
f8f852138f | ||
![]() |
f048fe3a09 | ||
![]() |
1468b668aa | ||
![]() |
01feecb789 | ||
![]() |
9835d76169 | ||
![]() |
995676a98e | ||
![]() |
9650b6cce3 | ||
![]() |
2f6a627394 | ||
![]() |
278bf2d289 | ||
![]() |
47761071be | ||
![]() |
34d6b19721 | ||
![]() |
7b2cb48cc1 | ||
![]() |
cd2254b454 | ||
![]() |
86ed8aefb2 | ||
![]() |
e32b5e2f23 | ||
![]() |
b64f8b07c1 | ||
![]() |
f38bc6efc5 | ||
![]() |
662497edd2 | ||
![]() |
28dbbe0596 | ||
![]() |
726a76fb47 | ||
![]() |
a8feecea67 | ||
![]() |
e87ad178cc | ||
![]() |
4e59948249 | ||
![]() |
bce9c3132d | ||
![]() |
f26262dde0 | ||
![]() |
5bbe97ddaa | ||
![]() |
e738501eb3 | ||
![]() |
21ef47f436 | ||
![]() |
be22ed405a | ||
![]() |
f6fe084fd4 |
159
CMakeLists.txt
Normal file
159
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)
|
15
CREDITS.TXT
Normal file
15
CREDITS.TXT
Normal file
@@ -0,0 +1,15 @@
|
||||
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++
|
||||
|
||||
|
46
LICENSE.TXT
46
LICENSE.TXT
@@ -1,10 +1,21 @@
|
||||
==============================================================================
|
||||
LLVM Release License
|
||||
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) 2007-2010 University of Illinois at Urbana-Champaign.
|
||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
@@ -43,20 +54,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
The LLVM software contains code written by third parties. Such software will
|
||||
have its own individual LICENSE.TXT file in the directory in which it appears.
|
||||
This file will describe the copyrights, license, and restrictions which apply
|
||||
to that code.
|
||||
|
||||
The disclaimer of warranty in the University of Illinois Open Source License
|
||||
applies to all code in the LLVM Distribution, and nothing in any of the
|
||||
other licenses gives permission to use the names of the LLVM Team or the
|
||||
University of Illinois to endorse or promote products derived from this
|
||||
Software.
|
||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||
|
||||
The following pieces of software have additional or alternate copyrights,
|
||||
licenses, and/or restrictions:
|
||||
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:
|
||||
|
||||
Program Directory
|
||||
------- ---------
|
||||
<none yet>
|
||||
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.
|
||||
|
53
cmake/Modules/GetTriple.cmake
Normal file
53
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()
|
18
cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
Normal file
18
cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
|
||||
|
||||
macro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage )
|
||||
|
||||
string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource )
|
||||
if( _insource )
|
||||
message( SEND_ERROR "${_errorMessage}" )
|
||||
message( FATAL_ERROR
|
||||
"In-source builds are not allowed.
|
||||
CMake would overwrite the makefiles distributed with Compiler-RT.
|
||||
Please create a directory and run cmake from there, passing the path
|
||||
to this source directory as the last argument.
|
||||
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
|
||||
Please delete them."
|
||||
)
|
||||
endif( _insource )
|
||||
|
||||
endmacro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD )
|
37
cmake/config-ix.cmake
Normal file
37
cmake/config-ix.cmake
Normal file
@@ -0,0 +1,37 @@
|
||||
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(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()
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
|
||||
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
|
||||
#if defined(__clang__)
|
||||
|
||||
@@ -144,6 +144,10 @@ typedef __char32_t char32_t;
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_trailing_return))
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_inline_namespaces)
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
@@ -190,6 +194,8 @@ using namespace _LIBCPP_NAMESPACE;
|
||||
|
||||
#else // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
@@ -208,6 +214,7 @@ using namespace _LIBCPP_NAMESPACE;
|
||||
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -55,7 +55,8 @@ public:
|
||||
explicit locale(const string&);
|
||||
locale(const locale&, const char*, category);
|
||||
locale(const locale&, const string&, category);
|
||||
template <class _Facet> locale(const locale&, _Facet*);
|
||||
template <class _Facet>
|
||||
_LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*);
|
||||
locale(const locale&, const locale&, category);
|
||||
|
||||
~locale() throw();
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -18,6 +18,16 @@
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#ifdef _LIBCPP_SHARED_LOCK
|
||||
|
||||
namespace ting {
|
||||
template <class> class shared_lock;
|
||||
template <class> class upgrade_lock;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_SHARED_LOCK
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_VISIBLE mutex
|
||||
@@ -143,6 +153,28 @@ public:
|
||||
__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();
|
||||
@@ -382,11 +414,11 @@ 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();
|
||||
monotonic_clock::time_point __c_now = monotonic_clock::now();
|
||||
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 monotonic_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
}
|
||||
|
||||
template <class _Rep, class _Period, class _Predicate>
|
||||
@@ -396,7 +428,7 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lk, chrono::monotonic_clock::now() + __d,
|
||||
return wait_until(__lk, chrono::steady_clock::now() + __d,
|
||||
_STD::move(__pred));
|
||||
}
|
||||
|
||||
|
@@ -85,12 +85,14 @@ public:
|
||||
void shrink_to_fit();
|
||||
void push_front(const_reference __x);
|
||||
void push_back(const_reference __x);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#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 // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#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);}
|
||||
@@ -118,12 +120,12 @@ public:
|
||||
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
|
||||
{__destruct_at_begin(__new_begin, has_trivial_destructor<value_type>());}
|
||||
{__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)
|
||||
{__destruct_at_end(__new_last, has_trivial_destructor<value_type>());}
|
||||
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
|
||||
void __destruct_at_end(pointer __new_last, false_type);
|
||||
void __destruct_at_end(pointer __new_last, true_type);
|
||||
|
||||
@@ -230,8 +232,8 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
|
||||
{
|
||||
__construct_at_end(__n, __x, integral_constant<bool, has_trivial_copy_constructor<value_type>::value &&
|
||||
has_trivial_copy_assign<value_type>::value>());
|
||||
__construct_at_end(__n, __x, integral_constant<bool, is_trivially_copy_constructible<value_type>::value &&
|
||||
is_trivially_copy_assignable<value_type>::value>());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -26,20 +26,55 @@
|
||||
_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... _Tp> struct __tuple_like<const tuple<_Tp...>> : true_type {};
|
||||
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
|
||||
template <class _T1, class _T2> struct __tuple_like<const pair<_T1, _T2> > : true_type {};
|
||||
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
|
||||
template <class _Tp, size_t _Size> struct __tuple_like<const array<_Tp, _Size> > : true_type {};
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
typename tuple_element<_Ip, tuple<_Tp...>>::type&
|
||||
@@ -49,6 +84,10 @@ template <size_t _Ip, class ..._Tp>
|
||||
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
|
||||
get(const tuple<_Tp...>&);
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
typename tuple_element<_Ip, tuple<_Tp...>>::type&&
|
||||
get(tuple<_Tp...>&&);
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(pair<_T1, _T2>&);
|
||||
@@ -57,6 +96,10 @@ template <size_t _Ip, class _T1, class _T2>
|
||||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(const pair<_T1, _T2>&);
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||
get(pair<_T1, _T2>&&);
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_Tp&
|
||||
get(array<_Tp, _Size>&);
|
||||
@@ -65,6 +108,10 @@ template <size_t _Ip, class _Tp, size_t _Size>
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>&);
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&&);
|
||||
|
||||
// __make_tuple_indices
|
||||
|
||||
template <size_t...> struct __tuple_indices {};
|
||||
@@ -194,7 +241,7 @@ 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 &&
|
||||
is_assignable<_Up0&, _Tp0>::value &&
|
||||
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...>>::value> {};
|
||||
|
||||
template <>
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -256,7 +256,7 @@ template <class RandomAccessIterator, class RandomNumberGenerator>
|
||||
|
||||
template<class RandomAccessIterator, class UniformRandomNumberGenerator>
|
||||
void shuffle(RandomAccessIterator first, RandomAccessIterator last,
|
||||
UniformRandomNumberGenerator& g);
|
||||
UniformRandomNumberGenerator&& g);
|
||||
|
||||
template <class InputIterator, class Predicate>
|
||||
bool
|
||||
@@ -1438,7 +1438,7 @@ template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
has_trivial_copy_assign<_Tp>::value,
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
_Tp*
|
||||
>::type
|
||||
__unwrap_iter(move_iterator<_Tp*> __i)
|
||||
@@ -1450,7 +1450,7 @@ template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
has_trivial_copy_assign<_Tp>::value,
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
_Tp*
|
||||
>::type
|
||||
__unwrap_iter(__wrap_iter<_Tp*> __i)
|
||||
@@ -1473,7 +1473,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_same<typename remove_const<_Tp>::type, _Up>::value &&
|
||||
has_trivial_copy_assign<_Up>::value,
|
||||
is_trivially_copy_assignable<_Up>::value,
|
||||
_Up*
|
||||
>::type
|
||||
__copy(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
@@ -1508,7 +1508,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_same<typename remove_const<_Tp>::type, _Up>::value &&
|
||||
has_trivial_copy_assign<_Up>::value,
|
||||
is_trivially_copy_assignable<_Up>::value,
|
||||
_Up*
|
||||
>::type
|
||||
__copy_backward(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
@@ -1593,7 +1593,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_same<typename remove_const<_Tp>::type, _Up>::value &&
|
||||
has_trivial_copy_assign<_Up>::value,
|
||||
is_trivially_copy_assignable<_Up>::value,
|
||||
_Up*
|
||||
>::type
|
||||
__move(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
@@ -1628,7 +1628,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_same<typename remove_const<_Tp>::type, _Up>::value &&
|
||||
has_trivial_copy_assign<_Up>::value,
|
||||
is_trivially_copy_assignable<_Up>::value,
|
||||
_Up*
|
||||
>::type
|
||||
__move_backward(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
@@ -1766,7 +1766,7 @@ fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
|
||||
{
|
||||
return _STD::__fill_n(__first, __n, __value, integral_constant<bool,
|
||||
is_pointer<_OutputIterator>::value &&
|
||||
has_trivial_copy_assign<_Tp>::value &&
|
||||
is_trivially_copy_assignable<_Tp>::value &&
|
||||
sizeof(_Tp) == 1>());
|
||||
}
|
||||
|
||||
@@ -2169,7 +2169,7 @@ rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __l
|
||||
typename iterator_traits<_ForwardIterator>::iterator_category,
|
||||
random_access_iterator_tag
|
||||
>::value &&
|
||||
has_trivial_copy_assign
|
||||
is_trivially_copy_assignable
|
||||
<
|
||||
typename iterator_traits<_ForwardIterator>::value_type
|
||||
>::value
|
||||
@@ -2686,7 +2686,11 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
|
||||
_D __uid;
|
||||
__rs_default __g = __rs_get();
|
||||
for (--__last, --__d; __first < __last; ++__first, --__d)
|
||||
swap(*__first, *(__first + __uid(__g, _P(0, __d))));
|
||||
{
|
||||
difference_type __i = __uid(__g, _P(0, __d));
|
||||
if (__i != difference_type(0))
|
||||
swap(*__first, *(__first + __i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2704,13 +2708,20 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
if (__d > 1)
|
||||
{
|
||||
for (--__last; __first < __last; ++__first, --__d)
|
||||
swap(*__first, *(__first + __rand(__d)));
|
||||
{
|
||||
difference_type __i = __rand(__d);
|
||||
swap(*__first, *(__first + __i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
|
||||
void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_UniformRandomNumberGenerator&& __g)
|
||||
#else
|
||||
_UniformRandomNumberGenerator& __g)
|
||||
#endif
|
||||
{
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
|
||||
typedef uniform_int_distribution<ptrdiff_t> _D;
|
||||
@@ -2720,7 +2731,11 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
|
||||
{
|
||||
_D __uid;
|
||||
for (--__last, --__d; __first < __last; ++__first, --__d)
|
||||
swap(*__first, *(__first + __uid(__g, _P(0, __d))));
|
||||
{
|
||||
difference_type __i = __uid(__g, _P(0, __d));
|
||||
if (__i != difference_type(0))
|
||||
swap(*__first, *(__first + __i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3419,8 +3434,8 @@ __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __c
|
||||
// _Compare is known to be a reference type
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
|
||||
const difference_type __limit = has_trivial_copy_constructor<value_type>::value &&
|
||||
has_trivial_copy_assign<value_type>::value ? 30 : 6;
|
||||
const difference_type __limit = is_trivially_copy_constructible<value_type>::value &&
|
||||
is_trivially_copy_assignable<value_type>::value ? 30 : 6;
|
||||
while (true)
|
||||
{
|
||||
__restart:
|
||||
@@ -4054,7 +4069,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
|
||||
template <class _Tp>
|
||||
struct __inplace_merge_switch
|
||||
{
|
||||
static const unsigned value = has_trivial_copy_assign<_Tp>::value;
|
||||
static const unsigned value = is_trivially_copy_assignable<_Tp>::value;
|
||||
};
|
||||
|
||||
template <class _BidirectionalIterator, class _Compare>
|
||||
@@ -4222,7 +4237,7 @@ __stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1
|
||||
template <class _Tp>
|
||||
struct __stable_sort_switch
|
||||
{
|
||||
static const unsigned value = 128*has_trivial_copy_assign<_Tp>::value;
|
||||
static const unsigned value = 128*is_trivially_copy_assignable<_Tp>::value;
|
||||
};
|
||||
|
||||
template <class _Compare, class _RandomAccessIterator>
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -94,6 +94,7 @@ 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>&);
|
||||
template <int I, class T, size_t N> const T& get(const array<T, N>&);
|
||||
template <int I, class T, size_t N> T&& get(array<T, N>&&);
|
||||
|
||||
} // std
|
||||
|
||||
@@ -295,6 +296,18 @@ get(const array<_Tp, _Size>& __a)
|
||||
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)
|
||||
{
|
||||
return _STD::move(__a[_Ip]);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_ARRAY
|
||||
|
13749
include/atomic
13749
include/atomic
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -40,7 +40,10 @@ public:
|
||||
// 23.3.5.1 constructors:
|
||||
constexpr bitset();
|
||||
constexpr bitset(unsigned long long val);
|
||||
explicit bitset( const char* str );
|
||||
template <class charT>
|
||||
explicit bitset(const charT* str,
|
||||
typename basic_string<charT>::size_type n = basic_string<charT>::npos,
|
||||
charT zero = charT('0'), charT one = charT('1'));
|
||||
template<class charT, class traits, class Allocator>
|
||||
explicit bitset(const basic_string<charT,traits,Allocator>& str,
|
||||
typename basic_string<charT,traits,Allocator>::size_type pos = 0,
|
||||
@@ -605,7 +608,10 @@ public:
|
||||
// 23.3.5.1 constructors:
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() {}
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) : base(__v) {}
|
||||
explicit bitset(const char* __str);
|
||||
template<class _CharT>
|
||||
explicit bitset(const _CharT* __str,
|
||||
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
|
||||
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0,
|
||||
@@ -663,11 +669,14 @@ private:
|
||||
};
|
||||
|
||||
template <size_t _Size>
|
||||
bitset<_Size>::bitset(const char* __str)
|
||||
template<class _CharT>
|
||||
bitset<_Size>::bitset(const _CharT* __str,
|
||||
typename basic_string<_CharT>::size_type __n,
|
||||
_CharT __zero, _CharT __one)
|
||||
{
|
||||
size_t __rlen = strlen(__str);
|
||||
size_t __rlen = _STD::min(__n, char_traits<_CharT>::length(__str));
|
||||
for (size_t __i = 0; __i < __rlen; ++__i)
|
||||
if (__str[__i] != '0' && __str[__i] != '1')
|
||||
if (__str[__i] != __zero && __str[__i] != __one)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw invalid_argument("bitset string ctor has invalid argument");
|
||||
#else
|
||||
@@ -677,15 +686,11 @@ bitset<_Size>::bitset(const char* __str)
|
||||
size_t __i = 0;
|
||||
for (; __i < _M; ++__i)
|
||||
{
|
||||
switch (__str[_M - 1 - __i])
|
||||
{
|
||||
case '0':
|
||||
_CharT __c = __str[_M - 1 - __i];
|
||||
if (__c == __zero)
|
||||
(*this)[__i] = false;
|
||||
break;
|
||||
case '1':
|
||||
else
|
||||
(*this)[__i] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -223,26 +223,26 @@ public:
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<system_clock> time_point;
|
||||
static const bool is_monotonic = false;
|
||||
static const bool is_steady = false;
|
||||
|
||||
static time_point now();
|
||||
static time_t to_time_t (const time_point& __t);
|
||||
static time_point from_time_t(time_t __t);
|
||||
};
|
||||
|
||||
class monotonic_clock
|
||||
class steady_clock
|
||||
{
|
||||
public:
|
||||
typedef nanoseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<monotonic_clock, duration> time_point;
|
||||
static const bool is_monotonic = true;
|
||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||
static const bool is_steady = true;
|
||||
|
||||
static time_point now();
|
||||
};
|
||||
|
||||
typedef monotonic_clock high_resolution_clock;
|
||||
typedef steady_clock high_resolution_clock;
|
||||
|
||||
} // chrono
|
||||
|
||||
@@ -843,26 +843,26 @@ public:
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<system_clock> time_point;
|
||||
static const bool is_monotonic = false;
|
||||
static const bool is_steady = false;
|
||||
|
||||
static time_point now();
|
||||
static time_t to_time_t (const time_point& __t);
|
||||
static time_point from_time_t(time_t __t);
|
||||
};
|
||||
|
||||
class _LIBCPP_VISIBLE monotonic_clock
|
||||
class _LIBCPP_VISIBLE steady_clock
|
||||
{
|
||||
public:
|
||||
typedef nanoseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<monotonic_clock, duration> time_point;
|
||||
static const bool is_monotonic = true;
|
||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||
static const bool is_steady = true;
|
||||
|
||||
static time_point now();
|
||||
};
|
||||
|
||||
typedef monotonic_clock high_resolution_clock;
|
||||
typedef steady_clock high_resolution_clock;
|
||||
|
||||
} // chrono
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -297,12 +297,6 @@ long double truncl(long double x);
|
||||
|
||||
*/
|
||||
|
||||
// FIXME: work around for Clang with -std=C++0x on OSX/iOS
|
||||
#if defined(__clang__) && defined(__APPLE__)
|
||||
# pragma push_macro("__STRICT_ANSI__")
|
||||
# undef __STRICT_ANSI__
|
||||
#endif // defined(__clang__) && defined(__APPLE__)
|
||||
|
||||
#include <__config>
|
||||
#include <math.h>
|
||||
#include <type_traits>
|
||||
@@ -1587,9 +1581,4 @@ using ::truncl;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
// FIXME: work around for Clang with -std=C++0x on OSX/iOS
|
||||
#if defined(__clang__) && defined(__APPLE__)
|
||||
# pragma pop_macro("__STRICT_ANSI__")
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CMATH
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -191,17 +191,17 @@ template<class T> T norm(const complex<T>&);
|
||||
template<Integral T> double norm(T);
|
||||
float norm(float);
|
||||
|
||||
template<class T> complex<T> conj(const complex<T>&);
|
||||
long double conj(long double);
|
||||
double conj(double);
|
||||
template<Integral T> double conj(T);
|
||||
float conj(float);
|
||||
template<class T> complex<T> conj(const complex<T>&);
|
||||
complex<long double> conj(long double);
|
||||
complex<double> conj(double);
|
||||
template<Integral T> complex<double> conj(T);
|
||||
complex<float> conj(float);
|
||||
|
||||
template<class T> complex<T> proj(const complex<T>&);
|
||||
long double proj(long double);
|
||||
double proj(double);
|
||||
template<Integral T> double proj(T);
|
||||
float proj(float);
|
||||
template<class T> complex<T> proj(const complex<T>&);
|
||||
complex<long double> proj(long double);
|
||||
complex<double> proj(double);
|
||||
template<Integral T> complex<double> proj(T);
|
||||
complex<float> proj(float);
|
||||
|
||||
template<class T> complex<T> polar(const T&, const T& = 0);
|
||||
|
||||
@@ -980,17 +980,17 @@ conj(const complex<_Tp>& __c)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
long double
|
||||
complex<long double>
|
||||
conj(long double __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<long double>(__re);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
double
|
||||
complex<double>
|
||||
conj(double __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<double>(__re);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
@@ -998,18 +998,18 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value,
|
||||
double
|
||||
complex<double>
|
||||
>::type
|
||||
conj(_Tp __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<double>(__re);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
float
|
||||
complex<float>
|
||||
conj(float __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<float>(__re);
|
||||
}
|
||||
|
||||
// proj
|
||||
@@ -1026,21 +1026,21 @@ proj(const complex<_Tp>& __c)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
long double
|
||||
complex<long double>
|
||||
proj(long double __re)
|
||||
{
|
||||
if (isinf(__re))
|
||||
__re = abs(__re);
|
||||
return __re;
|
||||
return complex<long double>(__re);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
double
|
||||
complex<double>
|
||||
proj(double __re)
|
||||
{
|
||||
if (isinf(__re))
|
||||
__re = abs(__re);
|
||||
return __re;
|
||||
return complex<double>(__re);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
@@ -1048,20 +1048,20 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value,
|
||||
double
|
||||
complex<double>
|
||||
>::type
|
||||
proj(_Tp __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<double>(__re);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
float
|
||||
complex<float>
|
||||
proj(float __re)
|
||||
{
|
||||
if (isinf(__re))
|
||||
__re = abs(__re);
|
||||
return __re;
|
||||
return complex<float>(__re);
|
||||
}
|
||||
|
||||
// polar
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -232,7 +232,7 @@ cv_status
|
||||
condition_variable_any::wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
return wait_until(__lock, chrono::monotonic_clock::now() + __d);
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d);
|
||||
}
|
||||
|
||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||
@@ -242,7 +242,7 @@ condition_variable_any::wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lock, chrono::monotonic_clock::now() + __d,
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d,
|
||||
_STD::move(__pred));
|
||||
}
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -78,42 +78,6 @@ struct _LIBCPP_VISIBLE nullptr_t
|
||||
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;}
|
||||
|
||||
template <typename _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, _Tp* __p) {return 0 == __p;}
|
||||
|
||||
template <typename _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator==(_Tp* __p, nullptr_t) {return __p == 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, _Tp* __p) {return 0 != __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator!=(_Tp* __p, nullptr_t) {return __p != 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, _Tp* __p) {return 0 < __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<(_Tp* __p, nullptr_t) {return __p < 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, _Tp* __p) {return 0 <= __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(_Tp* __p, nullptr_t) {return __p <= 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, _Tp* __p) {return 0 > __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(_Tp* __p, nullptr_t) {return __p > 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, _Tp* __p) {return 0 >= __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(_Tp* __p, nullptr_t) {return __p >= 0;}
|
||||
};
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -40,10 +40,12 @@ public:
|
||||
|
||||
typedef void (*unexpected_handler)();
|
||||
unexpected_handler set_unexpected(unexpected_handler f ) throw();
|
||||
unexpected_handler get_unexpected() throw();
|
||||
void unexpected [[noreturn]] ();
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
terminate_handler set_terminate(terminate_handler f ) throw();
|
||||
terminate_handler get_terminate() throw();
|
||||
void terminate [[noreturn]] ();
|
||||
|
||||
bool uncaught_exception() throw();
|
||||
@@ -102,10 +104,12 @@ public:
|
||||
|
||||
typedef void (*unexpected_handler)();
|
||||
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) throw();
|
||||
_LIBCPP_VISIBLE unexpected_handler get_unexpected() throw();
|
||||
_LIBCPP_VISIBLE void unexpected();
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) throw();
|
||||
_LIBCPP_VISIBLE terminate_handler get_terminate() throw();
|
||||
_LIBCPP_VISIBLE void terminate() __attribute__((__noreturn__));
|
||||
|
||||
_LIBCPP_VISIBLE bool uncaught_exception() throw();
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
346
include/future
346
include/future
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -27,9 +27,9 @@ enum class future_errc
|
||||
|
||||
enum class launch
|
||||
{
|
||||
any,
|
||||
async,
|
||||
sync
|
||||
async = 1,
|
||||
deferred = 2,
|
||||
any = async | deferred
|
||||
};
|
||||
|
||||
enum class future_status
|
||||
@@ -156,6 +156,7 @@ public:
|
||||
~future();
|
||||
future& operator=(const future& rhs) = delete;
|
||||
future& operator=(future&&);
|
||||
shared_future<R> share() &&;
|
||||
|
||||
// retrieving the value
|
||||
R get();
|
||||
@@ -182,6 +183,7 @@ public:
|
||||
~future();
|
||||
future& operator=(const future& rhs) = delete;
|
||||
future& operator=(future&&);
|
||||
shared_future<R&> share() &&;
|
||||
|
||||
// retrieving the value
|
||||
R& get();
|
||||
@@ -208,6 +210,7 @@ public:
|
||||
~future();
|
||||
future& operator=(const future& rhs) = delete;
|
||||
future& operator=(future&&);
|
||||
shared_future<void> share() &&;
|
||||
|
||||
// retrieving the value
|
||||
void get();
|
||||
@@ -305,81 +308,6 @@ public:
|
||||
wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
||||
};
|
||||
|
||||
template <class R>
|
||||
class atomic_future
|
||||
{
|
||||
public:
|
||||
atomic_future();
|
||||
atomic_future(const atomic_future& rhs);
|
||||
atomic_future(future<R>&&);
|
||||
~atomic_future();
|
||||
atomic_future& operator=(const atomic_future& rhs);
|
||||
|
||||
// retrieving the value
|
||||
const R& get() const;
|
||||
|
||||
// functions to check state
|
||||
bool valid() const;
|
||||
|
||||
void wait() const;
|
||||
template <class Rep, class Period>
|
||||
future_status
|
||||
wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
||||
template <class Clock, class Duration>
|
||||
future_status
|
||||
wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
||||
};
|
||||
|
||||
template <class R>
|
||||
class atomic_future<R&>
|
||||
{
|
||||
public:
|
||||
atomic_future();
|
||||
atomic_future(const atomic_future& rhs);
|
||||
atomic_future(future<R>&&);
|
||||
~atomic_future();
|
||||
atomic_future& operator=(const atomic_future& rhs);
|
||||
|
||||
// retrieving the value
|
||||
R& get() const;
|
||||
|
||||
// functions to check state
|
||||
bool valid() const;
|
||||
|
||||
void wait() const;
|
||||
template <class Rep, class Period>
|
||||
future_status
|
||||
wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
||||
template <class Clock, class Duration>
|
||||
future_status
|
||||
wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
||||
};
|
||||
|
||||
template <>
|
||||
class atomic_future<void>
|
||||
{
|
||||
public:
|
||||
atomic_future();
|
||||
atomic_future(const atomic_future& rhs);
|
||||
atomic_future(future<R>&&);
|
||||
~atomic_future();
|
||||
atomic_future& operator=(const atomic_future& rhs);
|
||||
|
||||
// retrieving the value
|
||||
void get() const;
|
||||
|
||||
// functions to check state
|
||||
bool valid() const;
|
||||
|
||||
void wait() const;
|
||||
template <class Rep, class Period>
|
||||
future_status
|
||||
wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
||||
template <class Clock, class Duration>
|
||||
future_status
|
||||
wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
||||
};
|
||||
|
||||
template <class F, class... Args>
|
||||
future<typename result_of<F(Args...)>::type>
|
||||
async(F&& f, Args&&... args);
|
||||
@@ -413,7 +341,7 @@ public:
|
||||
packaged_task& operator=(packaged_task&& other);
|
||||
void swap(packaged_task& other);
|
||||
|
||||
explicit operator bool() const;
|
||||
bool valid() const;
|
||||
|
||||
// result retrieval
|
||||
future<R> get_future();
|
||||
@@ -470,9 +398,9 @@ struct _LIBCPP_VISIBLE is_error_code_enum<future_errc> : public true_type {};
|
||||
struct _LIBCPP_VISIBLE launch
|
||||
{
|
||||
enum _ {
|
||||
any,
|
||||
async,
|
||||
sync
|
||||
async = 1,
|
||||
deferred = 2,
|
||||
any = async | deferred
|
||||
};
|
||||
|
||||
_ __v_;
|
||||
@@ -603,7 +531,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
future_status
|
||||
__assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
|
||||
{
|
||||
return wait_until(chrono::monotonic_clock::now() + __rel_time);
|
||||
return wait_until(chrono::steady_clock::now() + __rel_time);
|
||||
}
|
||||
|
||||
template <class _R>
|
||||
@@ -986,6 +914,7 @@ private:
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~future();
|
||||
shared_future<_R> share();
|
||||
|
||||
// retrieving the value
|
||||
_R get();
|
||||
@@ -1083,6 +1012,7 @@ private:
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~future();
|
||||
shared_future<_R&> share();
|
||||
|
||||
// retrieving the value
|
||||
_R& get();
|
||||
@@ -1175,6 +1105,7 @@ private:
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~future();
|
||||
shared_future<void> share();
|
||||
|
||||
// retrieving the value
|
||||
void get();
|
||||
@@ -1893,8 +1824,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
//explicit
|
||||
operator bool() const {return __p_.__state_ != nullptr;}
|
||||
bool valid() const {return __p_.__state_ != nullptr;}
|
||||
|
||||
// result retrieval
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1956,7 +1886,7 @@ void
|
||||
packaged_task<_R(_ArgTypes...)>::reset()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (!(*this))
|
||||
if (!valid())
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__p_ = promise<result_type>();
|
||||
@@ -2009,8 +1939,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
//explicit
|
||||
operator bool() const {return __p_.__state_ != nullptr;}
|
||||
bool valid() const {return __p_.__state_ != nullptr;}
|
||||
|
||||
// result retrieval
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -2074,7 +2003,7 @@ void
|
||||
packaged_task<void(_ArgTypes...)>::reset()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (!(*this))
|
||||
if (!valid())
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__p_ = promise<result_type>();
|
||||
@@ -2111,16 +2040,16 @@ async(launch __policy, _F&& __f, _Args&&... __args)
|
||||
{
|
||||
typedef typename result_of<_F(_Args...)>::type _R;
|
||||
future<_R> __r;
|
||||
if (__policy == launch::sync)
|
||||
__r = _STD::__make_deferred_assoc_state<_R>(bind(_STD::forward<_F>(__f),
|
||||
_STD::forward<_Args>(__args)...));
|
||||
else
|
||||
if (__policy & launch::async)
|
||||
{
|
||||
packaged_task<_R()> __pk(bind(_STD::forward<_F>(__f),
|
||||
_STD::forward<_Args>(__args)...));
|
||||
__r = __pk.get_future();
|
||||
thread(_STD::move(__pk)).detach();
|
||||
}
|
||||
else if (__policy & launch::deferred)
|
||||
__r = _STD::__make_deferred_assoc_state<_R>(bind(_STD::forward<_F>(__f),
|
||||
_STD::forward<_Args>(__args)...));
|
||||
return __r;
|
||||
}
|
||||
|
||||
@@ -2352,224 +2281,33 @@ swap(shared_future<_R>& __x, shared_future<_R>& __y)
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
// atomic_future
|
||||
|
||||
template <class _R>
|
||||
class _LIBCPP_VISIBLE atomic_future
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<_R>
|
||||
future<_R>::share()
|
||||
{
|
||||
__assoc_state<_R>* __state_;
|
||||
mutable mutex __mut_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic_future() : __state_(nullptr) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic_future(const atomic_future& __rhs) : __state_(__rhs.__state_)
|
||||
{if (__state_) __state_->__add_shared();}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic_future(future<_R>&& __f) : __state_(__f.__state_)
|
||||
{__f.__state_ = nullptr;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~atomic_future();
|
||||
atomic_future& operator=(const atomic_future& __rhs);
|
||||
|
||||
// retrieving the value
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _R& get() const {return __state_->copy();}
|
||||
|
||||
void swap(atomic_future& __rhs);
|
||||
|
||||
// functions to check state
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool valid() const {return __state_ != nullptr;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void wait() const {__state_->wait();}
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future_status
|
||||
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
|
||||
{return __state_->wait_for(__rel_time);}
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future_status
|
||||
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
|
||||
{return __state_->wait_until(__abs_time);}
|
||||
};
|
||||
|
||||
template <class _R>
|
||||
atomic_future<_R>::~atomic_future()
|
||||
{
|
||||
if (__state_)
|
||||
__state_->__release_shared();
|
||||
return shared_future<_R>(_STD::move(*this));
|
||||
}
|
||||
|
||||
template <class _R>
|
||||
atomic_future<_R>&
|
||||
atomic_future<_R>::operator=(const atomic_future& __rhs)
|
||||
{
|
||||
if (this != &__rhs)
|
||||
{
|
||||
unique_lock<mutex> __this(__mut_, defer_lock);
|
||||
unique_lock<mutex> __that(__rhs.__mut_, defer_lock);
|
||||
_STD::lock(__this, __that);
|
||||
if (__rhs.__state_)
|
||||
__rhs.__state_->__add_shared();
|
||||
if (__state_)
|
||||
__state_->__release_shared();
|
||||
__state_ = __rhs.__state_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _R>
|
||||
void
|
||||
atomic_future<_R>::swap(atomic_future& __rhs)
|
||||
{
|
||||
if (this != &__rhs)
|
||||
{
|
||||
unique_lock<mutex> __this(__mut_, defer_lock);
|
||||
unique_lock<mutex> __that(__rhs.__mut_, defer_lock);
|
||||
_STD::lock(__this, __that);
|
||||
_STD::swap(__state_, __rhs.__state_);
|
||||
}
|
||||
}
|
||||
|
||||
template <class _R>
|
||||
class _LIBCPP_VISIBLE atomic_future<_R&>
|
||||
{
|
||||
__assoc_state<_R&>* __state_;
|
||||
mutable mutex __mut_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic_future() : __state_(nullptr) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic_future(const atomic_future& __rhs) : __state_(__rhs.__state_)
|
||||
{if (__state_) __state_->__add_shared();}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic_future(future<_R&>&& __f) : __state_(__f.__state_)
|
||||
{__f.__state_ = nullptr;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~atomic_future();
|
||||
atomic_future& operator=(const atomic_future& __rhs);
|
||||
|
||||
// retrieving the value
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_R& get() const {return __state_->copy();}
|
||||
|
||||
void swap(atomic_future& __rhs);
|
||||
|
||||
// functions to check state
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool valid() const {return __state_ != nullptr;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void wait() const {__state_->wait();}
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future_status
|
||||
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
|
||||
{return __state_->wait_for(__rel_time);}
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future_status
|
||||
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
|
||||
{return __state_->wait_until(__abs_time);}
|
||||
};
|
||||
|
||||
template <class _R>
|
||||
atomic_future<_R&>::~atomic_future()
|
||||
{
|
||||
if (__state_)
|
||||
__state_->__release_shared();
|
||||
}
|
||||
|
||||
template <class _R>
|
||||
atomic_future<_R&>&
|
||||
atomic_future<_R&>::operator=(const atomic_future& __rhs)
|
||||
{
|
||||
if (this != &__rhs)
|
||||
{
|
||||
unique_lock<mutex> __this(__mut_, defer_lock);
|
||||
unique_lock<mutex> __that(__rhs.__mut_, defer_lock);
|
||||
_STD::lock(__this, __that);
|
||||
if (__rhs.__state_)
|
||||
__rhs.__state_->__add_shared();
|
||||
if (__state_)
|
||||
__state_->__release_shared();
|
||||
__state_ = __rhs.__state_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _R>
|
||||
void
|
||||
atomic_future<_R&>::swap(atomic_future& __rhs)
|
||||
{
|
||||
if (this != &__rhs)
|
||||
{
|
||||
unique_lock<mutex> __this(__mut_, defer_lock);
|
||||
unique_lock<mutex> __that(__rhs.__mut_, defer_lock);
|
||||
_STD::lock(__this, __that);
|
||||
_STD::swap(__state_, __rhs.__state_);
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
class _LIBCPP_VISIBLE atomic_future<void>
|
||||
{
|
||||
__assoc_sub_state* __state_;
|
||||
mutable mutex __mut_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic_future() : __state_(nullptr) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic_future(const atomic_future& __rhs) : __state_(__rhs.__state_)
|
||||
{if (__state_) __state_->__add_shared();}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic_future(future<void>&& __f) : __state_(__f.__state_)
|
||||
{__f.__state_ = nullptr;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~atomic_future();
|
||||
atomic_future& operator=(const atomic_future& __rhs);
|
||||
|
||||
// retrieving the value
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void get() const {__state_->copy();}
|
||||
|
||||
void swap(atomic_future& __rhs);
|
||||
|
||||
// functions to check state
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool valid() const {return __state_ != nullptr;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void wait() const {__state_->wait();}
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future_status
|
||||
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
|
||||
{return __state_->wait_for(__rel_time);}
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future_status
|
||||
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
|
||||
{return __state_->wait_until(__abs_time);}
|
||||
};
|
||||
|
||||
template <class _R>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(atomic_future<_R>& __x, atomic_future<_R>& __y)
|
||||
shared_future<_R&>
|
||||
future<_R&>::share()
|
||||
{
|
||||
__x.swap(__y);
|
||||
return shared_future<_R&>(_STD::move(*this));
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<void>
|
||||
future<void>::share()
|
||||
{
|
||||
return shared_future<void>(_STD::move(*this));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_FUTURE
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
52
include/ios
52
include/ios
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -272,16 +272,16 @@ public:
|
||||
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);
|
||||
_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);
|
||||
|
||||
streamsize precision() const;
|
||||
streamsize precision(streamsize __prec);
|
||||
streamsize width() const;
|
||||
streamsize width(streamsize __wide);
|
||||
_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);
|
||||
@@ -307,17 +307,17 @@ private:
|
||||
public:
|
||||
static bool sync_with_stdio(bool __sync = true);
|
||||
|
||||
iostate rdstate() const;
|
||||
_LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
|
||||
void clear(iostate __state = goodbit);
|
||||
void setstate(iostate __state);
|
||||
_LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
|
||||
|
||||
bool good() const;
|
||||
bool eof() const;
|
||||
bool fail() const;
|
||||
bool bad() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool good() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool eof() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool fail() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool bad() const;
|
||||
|
||||
iostate exceptions() const;
|
||||
void exceptions(iostate __except);
|
||||
_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();
|
||||
@@ -587,38 +587,52 @@ public:
|
||||
_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_;
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -1038,7 +1038,7 @@ template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
|
||||
template <class _Tp>
|
||||
typename enable_if
|
||||
<
|
||||
has_trivial_copy_assign<_Tp>::value,
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
_Tp*
|
||||
>::type
|
||||
__unwrap_iter(__wrap_iter<_Tp*>);
|
||||
@@ -1137,7 +1137,7 @@ private:
|
||||
friend
|
||||
typename enable_if
|
||||
<
|
||||
has_trivial_copy_assign<_Tp>::value,
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
_Tp*
|
||||
>::type
|
||||
__unwrap_iter(__wrap_iter<_Tp*>);
|
||||
@@ -1616,7 +1616,7 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
|
||||
|
||||
#endif // _LIBCPP_DEBUG
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
|
||||
|
||||
template <class _C>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1650,7 +1650,7 @@ end(const _C& __c) -> decltype(__c.end())
|
||||
return __c.end();
|
||||
}
|
||||
|
||||
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
|
||||
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
|
||||
|
||||
template <class _C>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1684,7 +1684,7 @@ end(const _C& __c)
|
||||
return __c.end();
|
||||
}
|
||||
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
|
||||
|
||||
template <class _T, size_t _N>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -265,7 +265,10 @@ __nolocale_isdigit(int __c)
|
||||
}
|
||||
|
||||
#else // __APPLE__
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_sprintf(char* __restrict __str,
|
||||
const char* __restrict __format, ...)
|
||||
@@ -276,7 +279,10 @@ __nolocale_sprintf(char* __restrict __str,
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
const char* __restrict __format, ...)
|
||||
@@ -287,7 +293,10 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_asprintf(char** __ret,
|
||||
const char* __restrict __format, ...)
|
||||
@@ -298,7 +307,10 @@ __nolocale_asprintf(char** __ret,
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_sscanf(const char* __restrict __str,
|
||||
const char* __restrict __format, ...)
|
||||
@@ -1756,7 +1768,7 @@ public:
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
class __time_get_c_storage
|
||||
class __time_get_c_storage // purposefully not decorated
|
||||
{
|
||||
protected:
|
||||
typedef basic_string<_CharT> string_type;
|
||||
@@ -2638,24 +2650,15 @@ protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~moneypunct() {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual char_type do_thousands_sep() const {return numeric_limits<char_type>::max();}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string do_grouping() const {return string();}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string_type do_curr_symbol() const {return string_type();}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string_type do_positive_sign() const {return string_type();}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string_type do_negative_sign() const {return string_type(1, '-');}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual int do_frac_digits() const {return 0;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual pattern do_pos_format() const
|
||||
{pattern __p = {symbol, sign, none, value}; return __p;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual pattern do_neg_format() const
|
||||
{pattern __p = {symbol, sign, none, value}; return __p;}
|
||||
};
|
||||
@@ -2692,23 +2695,14 @@ protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~moneypunct_byname() {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual char_type do_decimal_point() const {return __decimal_point_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual char_type do_thousands_sep() const {return __thousands_sep_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string do_grouping() const {return __grouping_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string_type do_curr_symbol() const {return __curr_symbol_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string_type do_positive_sign() const {return __positive_sign_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string_type do_negative_sign() const {return __negative_sign_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual int do_frac_digits() const {return __frac_digits_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual pattern do_pos_format() const {return __pos_format_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual pattern do_neg_format() const {return __neg_format_;}
|
||||
|
||||
private:
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -52,8 +52,11 @@ struct allocator_traits
|
||||
| pointer_traits<pointer>::rebind<const void>
|
||||
const_void_pointer;
|
||||
typedef Alloc::difference_type
|
||||
| ptrdiff_t difference_type;
|
||||
typedef Alloc::size_type | size_t size_type;
|
||||
| pointer_traits<pointer>::difference_type
|
||||
difference_type;
|
||||
typedef Alloc::size_type
|
||||
| make_unsigned<difference_type>::type
|
||||
size_type;
|
||||
typedef Alloc::propagate_on_container_copy_assignment
|
||||
| false_type propagate_on_container_copy_assignment;
|
||||
typedef Alloc::propagate_on_container_move_assignment
|
||||
@@ -152,7 +155,8 @@ template <class ForwardIterator, class T>
|
||||
void uninitialized_fill(ForwardIterator first, ForwardIterator last, const T& x);
|
||||
|
||||
template <class ForwardIterator, class Size, class T>
|
||||
void uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
|
||||
ForwardIterator
|
||||
uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
|
||||
|
||||
template <class Y> struct auto_ptr_ref {};
|
||||
|
||||
@@ -856,7 +860,7 @@ struct __pointer_type<_Tp, _Dp, false>
|
||||
typedef _Tp* type;
|
||||
};
|
||||
|
||||
}
|
||||
} // __pointer_type_imp
|
||||
|
||||
template <class _Tp, class _Dp>
|
||||
struct __pointer_type
|
||||
@@ -972,14 +976,14 @@ public:
|
||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
};
|
||||
|
||||
template <class _Alloc, bool = __has_size_type<_Alloc>::value>
|
||||
template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
|
||||
struct __size_type
|
||||
{
|
||||
typedef size_t type;
|
||||
typedef typename make_unsigned<_DiffType>::type type;
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
struct __size_type<_Alloc, true>
|
||||
template <class _Alloc, class _DiffType>
|
||||
struct __size_type<_Alloc, _DiffType, true>
|
||||
{
|
||||
typedef typename _Alloc::size_type type;
|
||||
};
|
||||
@@ -1292,6 +1296,18 @@ struct __has_select_on_container_copy_construction
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
|
||||
template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value>
|
||||
struct __alloc_traits_difference_type
|
||||
{
|
||||
typedef typename pointer_traits<_Ptr>::difference_type type;
|
||||
};
|
||||
|
||||
template <class _Alloc, class _Ptr>
|
||||
struct __alloc_traits_difference_type<_Alloc, _Ptr, true>
|
||||
{
|
||||
typedef typename _Alloc::difference_type type;
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
struct _LIBCPP_VISIBLE allocator_traits
|
||||
{
|
||||
@@ -1303,8 +1319,8 @@ struct _LIBCPP_VISIBLE allocator_traits
|
||||
typedef typename __void_pointer<pointer, allocator_type>::type void_pointer;
|
||||
typedef typename __const_void_pointer<pointer, allocator_type>::type const_void_pointer;
|
||||
|
||||
typedef typename __pointer_traits_difference_type<allocator_type>::type difference_type;
|
||||
typedef typename __size_type<allocator_type>::type size_type;
|
||||
typedef typename __alloc_traits_difference_type<allocator_type, pointer>::type difference_type;
|
||||
typedef typename __size_type<allocator_type, difference_type>::type size_type;
|
||||
|
||||
typedef typename __propagate_on_container_copy_assignment<allocator_type>::type
|
||||
propagate_on_container_copy_assignment;
|
||||
@@ -1471,7 +1487,7 @@ struct _LIBCPP_VISIBLE uses_allocator
|
||||
{
|
||||
};
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
|
||||
// uses-allocator construction
|
||||
|
||||
@@ -1489,7 +1505,7 @@ struct __uses_alloc_ctor
|
||||
: integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
|
||||
{};
|
||||
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
|
||||
// allocator
|
||||
|
||||
@@ -1530,6 +1546,7 @@ public:
|
||||
{
|
||||
::new((void*)__p) _Tp();
|
||||
}
|
||||
# if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
template <class _A0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
@@ -1563,6 +1580,7 @@ public:
|
||||
{
|
||||
::new((void*)__p) _Tp(_STD::move(__a0));
|
||||
}
|
||||
# endif // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
@@ -2430,15 +2448,15 @@ public:
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY void __incr(_Tp*)
|
||||
{__incr(integral_constant<bool, has_trivial_destructor<_Tp>::value>());}
|
||||
{__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY void __set(size_t __s, _Tp*)
|
||||
{__set(__s, integral_constant<bool, has_trivial_destructor<_Tp>::value>());}
|
||||
{__set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __p)
|
||||
{__process(__p, integral_constant<bool, has_trivial_destructor<_Tp>::value>());}
|
||||
{__process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
@@ -2497,7 +2515,7 @@ uninitialized_fill(_ForwardIterator __f, _ForwardIterator __l, const _Tp& __x)
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Size, class _Tp>
|
||||
void
|
||||
_ForwardIterator
|
||||
uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x)
|
||||
{
|
||||
__destruct_n __d(0);
|
||||
@@ -2506,6 +2524,7 @@ uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x)
|
||||
for (; __n > 0; ++__f, --__n, __d.__incr((value_type*)0))
|
||||
::new(&*__f) value_type(__x);
|
||||
__h.release();
|
||||
return __f;
|
||||
}
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_weak_ptr
|
||||
@@ -2535,7 +2554,7 @@ public:
|
||||
: __shared_owners_(__refs) {}
|
||||
|
||||
void __add_shared();
|
||||
void __release_shared();
|
||||
bool __release_shared();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
long use_count() const {return __shared_owners_ + 1;}
|
||||
};
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{return try_lock_until(chrono::monotonic_clock::now() + __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();
|
||||
@@ -264,7 +264,7 @@ public:
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{return try_lock_until(chrono::monotonic_clock::now() + __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();
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -32,6 +32,7 @@ struct nothrow_t {};
|
||||
extern const nothrow_t nothrow;
|
||||
typedef void (*new_handler)();
|
||||
new_handler set_new_handler(new_handler new_p) throw();
|
||||
new_handler get_new_handler() throw();
|
||||
|
||||
} // std
|
||||
|
||||
@@ -85,6 +86,7 @@ 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) throw();
|
||||
_LIBCPP_VISIBLE new_handler get_new_handler() throw();
|
||||
|
||||
} // std
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -1498,7 +1498,7 @@ class piecewise_constant_distribution
|
||||
UnaryOperation fw);
|
||||
|
||||
vector<result_type> intervals() const;
|
||||
vector<double> densities() const;
|
||||
vector<result_type> densities() const;
|
||||
|
||||
friend bool operator==(const param_type& x, const param_type& y);
|
||||
friend bool operator!=(const param_type& x, const param_type& y);
|
||||
@@ -1525,7 +1525,7 @@ class piecewise_constant_distribution
|
||||
|
||||
// property functions
|
||||
vector<result_type> intervals() const;
|
||||
vector<double> densities() const;
|
||||
vector<result_type> densities() const;
|
||||
|
||||
param_type param() const;
|
||||
void param(const param_type& parm);
|
||||
@@ -1573,7 +1573,7 @@ class piecewise_linear_distribution
|
||||
UnaryOperation fw);
|
||||
|
||||
vector<result_type> intervals() const;
|
||||
vector<double> densities() const;
|
||||
vector<result_type> densities() const;
|
||||
|
||||
friend bool operator==(const param_type& x, const param_type& y);
|
||||
friend bool operator!=(const param_type& x, const param_type& y);
|
||||
@@ -1603,7 +1603,7 @@ class piecewise_linear_distribution
|
||||
|
||||
// property functions
|
||||
vector<result_type> intervals() const;
|
||||
vector<double> densities() const;
|
||||
vector<result_type> densities() const;
|
||||
|
||||
param_type param() const;
|
||||
void param(const param_type& parm);
|
||||
@@ -5922,10 +5922,9 @@ public:
|
||||
|
||||
class _LIBCPP_VISIBLE param_type
|
||||
{
|
||||
typedef typename common_type<double, result_type>::type __area_type;
|
||||
vector<result_type> __b_;
|
||||
vector<double> __densities_;
|
||||
vector<__area_type> __areas_;
|
||||
vector<result_type> __densities_;
|
||||
vector<result_type> __areas_;
|
||||
public:
|
||||
typedef piecewise_constant_distribution distribution_type;
|
||||
|
||||
@@ -5943,7 +5942,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector<result_type> intervals() const {return __b_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector<double> densities() const {return __densities_;}
|
||||
vector<result_type> densities() const {return __densities_;}
|
||||
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const param_type& __x, const param_type& __y)
|
||||
@@ -6014,7 +6013,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector<result_type> intervals() const {return __p_.intervals();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector<double> densities() const {return __p_.densities();}
|
||||
vector<result_type> densities() const {return __p_.densities();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
param_type param() const {return __p_;}
|
||||
@@ -6070,13 +6069,13 @@ void
|
||||
piecewise_constant_distribution<_RealType>::param_type::__init()
|
||||
{
|
||||
// __densities_ contains non-normalized areas
|
||||
__area_type __total_area = _STD::accumulate(__densities_.begin(),
|
||||
result_type __total_area = _STD::accumulate(__densities_.begin(),
|
||||
__densities_.end(),
|
||||
__area_type());
|
||||
result_type());
|
||||
for (size_t __i = 0; __i < __densities_.size(); ++__i)
|
||||
__densities_[__i] /= __total_area;
|
||||
// __densities_ contains normalized areas
|
||||
__areas_.assign(__densities_.size(), __area_type());
|
||||
__areas_.assign(__densities_.size(), result_type());
|
||||
_STD::partial_sum(__densities_.begin(), __densities_.end() - 1,
|
||||
__areas_.begin() + 1);
|
||||
// __areas_ contains partial sums of normalized areas: [0, __densities_ - 1]
|
||||
@@ -6167,9 +6166,8 @@ piecewise_constant_distribution<_RealType>::operator()(_URNG& __g, const param_t
|
||||
typedef uniform_real_distribution<result_type> _Gen;
|
||||
result_type __u = _Gen()(__g);
|
||||
ptrdiff_t __k = _STD::upper_bound(__p.__areas_.begin(), __p.__areas_.end(),
|
||||
static_cast<double>(__u)) - __p.__areas_.begin() - 1;
|
||||
return static_cast<result_type>((__u - __p.__areas_[__k]) / __p.__densities_[__k]
|
||||
+ __p.__b_[__k]);
|
||||
__u) - __p.__areas_.begin() - 1;
|
||||
return (__u - __p.__areas_[__k]) / __p.__densities_[__k] + __p.__b_[__k];
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _RT>
|
||||
@@ -6205,7 +6203,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef piecewise_constant_distribution<_RT> _Eng;
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
typedef typename param_type::__area_type __area_type;
|
||||
__save_flags<_CharT, _Traits> _(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
size_t __n;
|
||||
@@ -6214,11 +6211,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
for (size_t __i = 0; __i < __n; ++__i)
|
||||
__is >> __b[__i];
|
||||
__is >> __n;
|
||||
vector<double> __densities(__n);
|
||||
vector<result_type> __densities(__n);
|
||||
for (size_t __i = 0; __i < __n; ++__i)
|
||||
__is >> __densities[__i];
|
||||
__is >> __n;
|
||||
vector<__area_type> __areas(__n);
|
||||
vector<result_type> __areas(__n);
|
||||
for (size_t __i = 0; __i < __n; ++__i)
|
||||
__is >> __areas[__i];
|
||||
if (!__is.fail())
|
||||
@@ -6241,10 +6238,9 @@ public:
|
||||
|
||||
class _LIBCPP_VISIBLE param_type
|
||||
{
|
||||
typedef typename common_type<double, result_type>::type __area_type;
|
||||
vector<result_type> __b_;
|
||||
vector<double> __densities_;
|
||||
vector<__area_type> __areas_;
|
||||
vector<result_type> __densities_;
|
||||
vector<result_type> __areas_;
|
||||
public:
|
||||
typedef piecewise_linear_distribution distribution_type;
|
||||
|
||||
@@ -6262,7 +6258,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector<result_type> intervals() const {return __b_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector<double> densities() const {return __densities_;}
|
||||
vector<result_type> densities() const {return __densities_;}
|
||||
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const param_type& __x, const param_type& __y)
|
||||
@@ -6333,7 +6329,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector<result_type> intervals() const {return __p_.intervals();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector<double> densities() const {return __p_.densities();}
|
||||
vector<result_type> densities() const {return __p_.densities();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
param_type param() const {return __p_;}
|
||||
@@ -6389,8 +6385,8 @@ template<class _RealType>
|
||||
void
|
||||
piecewise_linear_distribution<_RealType>::param_type::__init()
|
||||
{
|
||||
__areas_.assign(__densities_.size() - 1, __area_type());
|
||||
__area_type _S = 0;
|
||||
__areas_.assign(__densities_.size() - 1, result_type());
|
||||
result_type _S = 0;
|
||||
for (size_t __i = 0; __i < __areas_.size(); ++__i)
|
||||
{
|
||||
__areas_[__i] = (__densities_[__i+1] + __densities_[__i]) *
|
||||
@@ -6491,19 +6487,19 @@ piecewise_linear_distribution<_RealType>::operator()(_URNG& __g, const param_typ
|
||||
typedef uniform_real_distribution<result_type> _Gen;
|
||||
result_type __u = _Gen()(__g);
|
||||
ptrdiff_t __k = _STD::upper_bound(__p.__areas_.begin(), __p.__areas_.end(),
|
||||
static_cast<double>(__u)) - __p.__areas_.begin() - 1;
|
||||
__u) - __p.__areas_.begin() - 1;
|
||||
__u -= __p.__areas_[__k];
|
||||
const double __dk = __p.__densities_[__k];
|
||||
const double __dk1 = __p.__densities_[__k+1];
|
||||
const double __deltad = __dk1 - __dk;
|
||||
const result_type __dk = __p.__densities_[__k];
|
||||
const result_type __dk1 = __p.__densities_[__k+1];
|
||||
const result_type __deltad = __dk1 - __dk;
|
||||
const result_type __bk = __p.__b_[__k];
|
||||
if (__deltad == 0)
|
||||
return static_cast<result_type>(__u / __dk + __bk);
|
||||
return __u / __dk + __bk;
|
||||
const result_type __bk1 = __p.__b_[__k+1];
|
||||
const result_type __deltab = __bk1 - __bk;
|
||||
return static_cast<result_type>((__bk * __dk1 - __bk1 * __dk +
|
||||
return (__bk * __dk1 - __bk1 * __dk +
|
||||
_STD::sqrt(__deltab * (__deltab * __dk * __dk + 2 * __deltad * __u))) /
|
||||
__deltad);
|
||||
__deltad;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _RT>
|
||||
@@ -6539,7 +6535,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef piecewise_linear_distribution<_RT> _Eng;
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
typedef typename param_type::__area_type __area_type;
|
||||
__save_flags<_CharT, _Traits> _(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
size_t __n;
|
||||
@@ -6548,11 +6543,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
for (size_t __i = 0; __i < __n; ++__i)
|
||||
__is >> __b[__i];
|
||||
__is >> __n;
|
||||
vector<double> __densities(__n);
|
||||
vector<result_type> __densities(__n);
|
||||
for (size_t __i = 0; __i < __n; ++__i)
|
||||
__is >> __densities[__i];
|
||||
__is >> __n;
|
||||
vector<__area_type> __areas(__n);
|
||||
vector<result_type> __areas(__n);
|
||||
for (size_t __i = 0; __i < __n; ++__i)
|
||||
__is >> __areas[__i];
|
||||
if (!__is.fail())
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -23,13 +23,14 @@ class ratio
|
||||
public:
|
||||
static const intmax_t num;
|
||||
static const intmax_t den;
|
||||
typedef ratio<num, den> type;
|
||||
};
|
||||
|
||||
// ratio arithmetic
|
||||
template <class R1, class R2> struct ratio_add;
|
||||
template <class R1, class R2> struct ratio_subtract;
|
||||
template <class R1, class R2> struct ratio_multiply;
|
||||
template <class R1, class R2> struct ratio_divide;
|
||||
template <class R1, class R2> using ratio_add = ...;
|
||||
template <class R1, class R2> using ratio_subtract = ...;
|
||||
template <class R1, class R2> using ratio_multiply = ...;
|
||||
template <class R1, class R2> using ratio_divide = ...;
|
||||
|
||||
// ratio comparison
|
||||
template <class R1, class R2> struct ratio_equal;
|
||||
@@ -260,7 +261,7 @@ typedef ratio< 1000000000000000LL, 1LL> peta;
|
||||
typedef ratio<1000000000000000000LL, 1LL> exa;
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_VISIBLE ratio_multiply
|
||||
struct __ratio_multiply
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value;
|
||||
@@ -274,7 +275,11 @@ public:
|
||||
};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_VISIBLE ratio_divide
|
||||
struct _LIBCPP_VISIBLE ratio_multiply
|
||||
: public __ratio_multiply<_R1, _R2>::type {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_divide
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||
@@ -288,7 +293,11 @@ public:
|
||||
};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_VISIBLE ratio_add
|
||||
struct _LIBCPP_VISIBLE ratio_divide
|
||||
: public __ratio_divide<_R1, _R2>::type {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_add
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||
@@ -310,7 +319,11 @@ public:
|
||||
};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_VISIBLE ratio_subtract
|
||||
struct _LIBCPP_VISIBLE ratio_add
|
||||
: public __ratio_add<_R1, _R2>::type {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_subtract
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||
@@ -331,6 +344,10 @@ public:
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_VISIBLE ratio_subtract
|
||||
: public __ratio_subtract<_R1, _R2>::type {};
|
||||
|
||||
// ratio_equal
|
||||
|
||||
template <class _R1, class _R2>
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -208,6 +208,8 @@ public:
|
||||
|
||||
bool matched;
|
||||
|
||||
constexpr sub_match();
|
||||
|
||||
difference_type length() const;
|
||||
operator string_type() const;
|
||||
string_type str() const;
|
||||
@@ -452,6 +454,8 @@ public:
|
||||
match_results& operator=(match_results&& m);
|
||||
~match_results();
|
||||
|
||||
bool ready() const;
|
||||
|
||||
// size:
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
@@ -4683,6 +4687,9 @@ public:
|
||||
|
||||
bool matched;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/ sub_match() : matched() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
difference_type length() const
|
||||
{return matched ? _STD::distance(this->first, this->second) : 0;}
|
||||
@@ -5104,6 +5111,7 @@ private:
|
||||
value_type __unmatched_;
|
||||
value_type __prefix_;
|
||||
value_type __suffix_;
|
||||
bool __ready_;
|
||||
public:
|
||||
_BidirectionalIterator __position_start_;
|
||||
typedef const value_type& const_reference;
|
||||
@@ -5123,6 +5131,9 @@ public:
|
||||
// match_results& operator=(match_results&& __m) = default;
|
||||
// ~match_results() = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool ready() const {return __ready_;}
|
||||
|
||||
// size:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __matches_.size();}
|
||||
@@ -5224,6 +5235,7 @@ public:
|
||||
__suffix_.matched = __m.suffix().matched;
|
||||
if (!__no_update_pos)
|
||||
__position_start_ = __prefix_.first;
|
||||
__ready_ = __m.ready();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -5254,7 +5266,8 @@ match_results<_BidirectionalIterator, _Allocator>::match_results(
|
||||
__unmatched_(),
|
||||
__prefix_(),
|
||||
__suffix_(),
|
||||
__position_start_()
|
||||
__position_start_(),
|
||||
__ready_(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -5274,6 +5287,7 @@ match_results<_BidirectionalIterator, _Allocator>::__init(unsigned __s,
|
||||
__suffix_ = __unmatched_;
|
||||
if (!__no_update_pos)
|
||||
__position_start_ = __prefix_.first;
|
||||
__ready_ = true;
|
||||
}
|
||||
|
||||
template <class _BidirectionalIterator, class _Allocator>
|
||||
@@ -5379,6 +5393,7 @@ match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m)
|
||||
swap(__prefix_, __m.__prefix_);
|
||||
swap(__suffix_, __m.__suffix_);
|
||||
swap(__position_start_, __m.__position_start_);
|
||||
swap(__ready_, __m.__ready_);
|
||||
}
|
||||
|
||||
typedef match_results<const char*> cmatch;
|
||||
@@ -5391,10 +5406,13 @@ bool
|
||||
operator==(const match_results<_BidirectionalIterator, _Allocator>& __x,
|
||||
const match_results<_BidirectionalIterator, _Allocator>& __y)
|
||||
{
|
||||
if (__x.__ready_ != __y.__ready_)
|
||||
return false;
|
||||
if (!__x.__ready_)
|
||||
return true;
|
||||
return __x.__matches_ == __y.__matches_ &&
|
||||
__x.__prefix_ == __y.__prefix_ &&
|
||||
__x.__suffix_ == __y.__suffix_ &&
|
||||
__x.__position_start_ == __y.__position_start_;
|
||||
__x.__suffix_ == __y.__suffix_;
|
||||
}
|
||||
|
||||
template <class _BidirectionalIterator, class _Allocator>
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
250
include/string
250
include/string
@@ -200,13 +200,13 @@ public:
|
||||
basic_string& replace(size_type pos, size_type n1, const_pointer s, size_type n2);
|
||||
basic_string& replace(size_type pos, size_type n1, const_pointer s);
|
||||
basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c);
|
||||
basic_string& replace(iterator i1, iterator i2, const basic_string& str);
|
||||
basic_string& replace(iterator i1, iterator i2, const_pointer s, size_type n);
|
||||
basic_string& replace(iterator i1, iterator i2, const_pointer s);
|
||||
basic_string& replace(iterator i1, iterator i2, size_type n, value_type c);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s, size_type n);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c);
|
||||
template<class InputIterator>
|
||||
basic_string& replace(iterator i1, iterator i2, InputIterator j1, InputIterator j2);
|
||||
basic_string& replace(iterator i1, iterator i2, initializer_list<value_type>);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>);
|
||||
|
||||
size_type copy(pointer s, size_type n, size_type pos = 0) const;
|
||||
basic_string substr(size_type pos = 0, size_type n = npos) const;
|
||||
@@ -941,12 +941,13 @@ public:
|
||||
typedef _Traits traits_type;
|
||||
typedef typename traits_type::char_type value_type;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef typename allocator_type::size_type size_type;
|
||||
typedef typename allocator_type::difference_type difference_type;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
typedef typename __alloc_traits::size_type size_type;
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
typedef typename allocator_type::reference reference;
|
||||
typedef typename allocator_type::const_reference const_reference;
|
||||
typedef typename allocator_type::pointer pointer;
|
||||
typedef typename allocator_type::const_pointer const_pointer;
|
||||
typedef typename __alloc_traits::pointer pointer;
|
||||
typedef typename __alloc_traits::const_pointer const_pointer;
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
typedef __debug_iter<basic_string, pointer> iterator;
|
||||
typedef __debug_iter<basic_string, const_pointer> const_iterator;
|
||||
@@ -1027,34 +1028,44 @@ private:
|
||||
public:
|
||||
static const size_type npos = -1;
|
||||
|
||||
basic_string();
|
||||
explicit basic_string(const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string();
|
||||
_LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a);
|
||||
basic_string(const basic_string& __str);
|
||||
basic_string(const basic_string& __str, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_string(basic_string&& __str);
|
||||
basic_string(basic_string&& __str, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_string(const_pointer __s);
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(const_pointer __s, const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(const_pointer __s, size_type __n);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(const_pointer __s, size_type __n, const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(size_type __n, value_type __c);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(size_type __n, value_type __c, const allocator_type& __a);
|
||||
basic_string(const basic_string& __str, size_type __pos, size_type __n = npos,
|
||||
const allocator_type& __a = allocator_type());
|
||||
template<class _InputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(_InputIterator __first, _InputIterator __last);
|
||||
template<class _InputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(initializer_list<value_type> __il);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
|
||||
~basic_string();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const basic_string& __str) {return assign(__str);}
|
||||
basic_string& operator=(const basic_string& __str);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(basic_string&& __str) {swap(__str); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& operator=(basic_string&& __str);
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const_pointer __s) {return assign(__s);}
|
||||
basic_string& operator=(value_type __c);
|
||||
@@ -1085,7 +1096,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY size_type size() const
|
||||
{return __is_long() ? __get_long_size() : __get_short_size();}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type length() const {return size();}
|
||||
size_type max_size() const;
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const;
|
||||
_LIBCPP_INLINE_VISIBILITY size_type capacity() const
|
||||
{return (__is_long() ? __get_long_cap() : __min_cap) - 1;}
|
||||
|
||||
@@ -1095,6 +1106,7 @@ public:
|
||||
void reserve(size_type res_arg = 0);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void shrink_to_fit() {reserve();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear();
|
||||
_LIBCPP_INLINE_VISIBILITY bool empty() const {return size() == 0;}
|
||||
|
||||
@@ -1109,6 +1121,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& append(const basic_string& __str);
|
||||
basic_string& append(const basic_string& __str, size_type __pos, size_type __n);
|
||||
basic_string& append(const_pointer __s, size_type __n);
|
||||
@@ -1133,12 +1146,14 @@ public:
|
||||
basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
|
||||
|
||||
void push_back(value_type __c);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void pop_back();
|
||||
reference front();
|
||||
const_reference front() const;
|
||||
reference back();
|
||||
const_reference back() const;
|
||||
_LIBCPP_INLINE_VISIBILITY reference front();
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference front() const;
|
||||
_LIBCPP_INLINE_VISIBILITY reference back();
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference back() const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& assign(const basic_string& __str);
|
||||
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n);
|
||||
basic_string& assign(const_pointer __s, size_type __n);
|
||||
@@ -1162,12 +1177,14 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& insert(size_type __pos1, const basic_string& __str);
|
||||
basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n);
|
||||
basic_string& insert(size_type __pos, const_pointer __s, size_type __n);
|
||||
basic_string& insert(size_type __pos, const_pointer __s);
|
||||
basic_string& insert(size_type __pos, size_type __n, value_type __c);
|
||||
iterator insert(const_iterator __pos, value_type __c);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __pos, size_type __n, value_type __c);
|
||||
template<class _InputIterator>
|
||||
typename enable_if
|
||||
@@ -1189,32 +1206,41 @@ public:
|
||||
{return insert(__pos, __il.begin(), __il.end());}
|
||||
|
||||
basic_string& erase(size_type __pos = 0, size_type __n = npos);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __pos);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __first, const_iterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str);
|
||||
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2);
|
||||
basic_string& replace(size_type __pos, size_type __n1, const_pointer __s, size_type __n2);
|
||||
basic_string& replace(size_type __pos, size_type __n1, const_pointer __s);
|
||||
basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
|
||||
basic_string& replace(iterator __i1, iterator __i2, const basic_string& __str);
|
||||
basic_string& replace(iterator __i1, iterator __i2, const_pointer __s, size_type __n);
|
||||
basic_string& replace(iterator __i1, iterator __i2, const_pointer __s);
|
||||
basic_string& replace(iterator __i1, iterator __i2, size_type __n, value_type __c);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
|
||||
template<class _InputIterator>
|
||||
typename enable_if
|
||||
<
|
||||
__is_input_iterator<_InputIterator>::value,
|
||||
basic_string&
|
||||
>::type
|
||||
replace(iterator __i1, iterator __i2, _InputIterator __j1, _InputIterator __j2);
|
||||
replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(iterator __i1, iterator __i2, initializer_list<value_type> __il)
|
||||
basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)
|
||||
{return replace(__i1, __i2, __il.begin(), __il.end());}
|
||||
|
||||
size_type copy(pointer __s, size_type __n, size_type __pos = 0) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string substr(size_type __pos = 0, size_type __n = npos) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_string& __str);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY const_pointer c_str() const {return data();}
|
||||
@@ -1222,44 +1248,62 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const {return __alloc();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find(const basic_string& __str, size_type __pos = 0) const;
|
||||
size_type find(const_pointer __s, size_type __pos, size_type __n) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find(const_pointer __s, size_type __pos = 0) const;
|
||||
size_type find(value_type __c, size_type __pos = 0) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type rfind(const basic_string& __str, size_type __pos = npos) const;
|
||||
size_type rfind(const_pointer __s, size_type __pos, size_type __n) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type rfind(const_pointer __s, size_type __pos = npos) const;
|
||||
size_type rfind(value_type __c, size_type __pos = npos) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(const basic_string& __str, size_type __pos = 0) const;
|
||||
size_type find_first_of(const_pointer __s, size_type __pos, size_type __n) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(const_pointer __s, size_type __pos = 0) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(value_type __c, size_type __pos = 0) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(const basic_string& __str, size_type __pos = npos) const;
|
||||
size_type find_last_of(const_pointer __s, size_type __pos, size_type __n) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(const_pointer __s, size_type __pos = npos) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(value_type __c, size_type __pos = npos) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const;
|
||||
size_type find_first_not_of(const_pointer __s, size_type __pos, size_type __n) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(const_pointer __s, size_type __pos = 0) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(value_type __c, size_type __pos = 0) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const;
|
||||
size_type find_last_not_of(const_pointer __s, size_type __pos, size_type __n) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(const_pointer __s, size_type __pos = npos) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(value_type __c, size_type __pos = npos) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int compare(const basic_string& __str) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
|
||||
int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const;
|
||||
int compare(const_pointer __s) const;
|
||||
int compare(size_type __pos1, size_type __n1, const_pointer __s) const;
|
||||
int compare(size_type __pos1, size_type __n1, const_pointer __s, size_type __n2) const;
|
||||
|
||||
bool __invariants() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool __invariants() const;
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() {return __r_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const {return __r_.second();}
|
||||
@@ -1337,10 +1381,53 @@ private:
|
||||
size_type __n_copy, size_type __n_del,
|
||||
size_type __n_add, const_pointer __p_new_stuff);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __erase_to_end(size_type __pos);
|
||||
|
||||
void __invalidate_all_iterators();
|
||||
void __invalidate_iterators_past(size_type);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const basic_string& __str)
|
||||
{__copy_assign_alloc(__str, integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_copy_assignment::value>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const basic_string& __str, true_type)
|
||||
{
|
||||
if (__alloc() != __str.__alloc())
|
||||
{
|
||||
clear();
|
||||
shrink_to_fit();
|
||||
}
|
||||
__alloc() = __str.__alloc();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const basic_string& __str, false_type)
|
||||
{}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign(basic_string& __str, false_type);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign(basic_string& __str, true_type);
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(allocator_type& __x, allocator_type& __y)
|
||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_swap::value>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(allocator_type& __x, allocator_type& __y, true_type)
|
||||
{
|
||||
using _STD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
|
||||
_LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(size_type);
|
||||
|
||||
friend basic_string operator+<>(const basic_string&, const basic_string&);
|
||||
friend basic_string operator+<>(const value_type*, const basic_string&);
|
||||
@@ -1432,7 +1519,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type _
|
||||
else
|
||||
{
|
||||
size_type __cap = __recommend(__reserve);
|
||||
__p = __alloc().allocate(__cap+1);
|
||||
__p = __alloc_traits::allocate(__alloc(), __cap+1);
|
||||
__set_long_pointer(__p);
|
||||
__set_long_cap(__cap+1);
|
||||
__set_long_size(__sz);
|
||||
@@ -1456,7 +1543,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type _
|
||||
else
|
||||
{
|
||||
size_type __cap = __recommend(__sz);
|
||||
__p = __alloc().allocate(__cap+1);
|
||||
__p = __alloc_traits::allocate(__alloc(), __cap+1);
|
||||
__set_long_pointer(__p);
|
||||
__set_long_cap(__cap+1);
|
||||
__set_long_size(__sz);
|
||||
@@ -1509,7 +1596,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, size_
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)
|
||||
: __r_(__str.__alloc())
|
||||
: __r_(__alloc_traits::select_on_container_copy_construction(__str.__alloc()))
|
||||
{
|
||||
if (!__str.__is_long())
|
||||
__r_.first().__r = __str.__r_.first().__r;
|
||||
@@ -1543,8 +1630,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
|
||||
: __r_(__str.__r_.first(), __a)
|
||||
: __r_(__a)
|
||||
{
|
||||
if (__a == __str.__alloc() || !__str.__is_long())
|
||||
__r_.first().__r = __str.__r_.first().__r;
|
||||
else
|
||||
__init(__str.__get_long_pointer(), __str.__get_long_size());
|
||||
__str.__zero();
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
__str.__invalidate_all_iterators();
|
||||
@@ -1568,7 +1659,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
|
||||
else
|
||||
{
|
||||
size_type __cap = __recommend(__n);
|
||||
__p = __alloc().allocate(__cap+1);
|
||||
__p = __alloc_traits::allocate(__alloc(), __cap+1);
|
||||
__set_long_pointer(__p);
|
||||
__set_long_cap(__cap+1);
|
||||
__set_long_size(__n);
|
||||
@@ -1625,7 +1716,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _Input
|
||||
catch (...)
|
||||
{
|
||||
if (__is_long())
|
||||
__alloc().deallocate(__get_long_pointer(), __get_long_cap());
|
||||
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
|
||||
throw;
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -1652,7 +1743,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For
|
||||
else
|
||||
{
|
||||
size_type __cap = __recommend(__sz);
|
||||
__p = __alloc().allocate(__cap+1);
|
||||
__p = __alloc_traits::allocate(__alloc(), __cap+1);
|
||||
__set_long_pointer(__p);
|
||||
__set_long_cap(__cap+1);
|
||||
__set_long_size(__sz);
|
||||
@@ -1696,12 +1787,11 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_t
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>::~basic_string()
|
||||
{
|
||||
__invalidate_all_iterators();
|
||||
if (__is_long())
|
||||
__alloc().deallocate(__get_long_pointer(), __get_long_cap());
|
||||
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@@ -1717,7 +1807,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
|
||||
size_type __cap = __old_cap < __ms / 2 - __alignment ?
|
||||
__recommend(_STD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
|
||||
__ms - 1;
|
||||
pointer __p = __alloc().allocate(__cap+1);
|
||||
pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
|
||||
__invalidate_all_iterators();
|
||||
if (__n_copy != 0)
|
||||
traits_type::copy(__p, __old_p, __n_copy);
|
||||
@@ -1727,7 +1817,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
|
||||
if (__sec_cp_sz != 0)
|
||||
traits_type::copy(__p + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz);
|
||||
if (__old_cap+1 != __min_cap)
|
||||
__alloc().deallocate(__old_p, __old_cap+1);
|
||||
__alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
|
||||
__set_long_pointer(__p);
|
||||
__set_long_cap(__cap+1);
|
||||
__old_sz = __n_copy + __n_add + __sec_cp_sz;
|
||||
@@ -1747,7 +1837,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
|
||||
size_type __cap = __old_cap < __ms / 2 - __alignment ?
|
||||
__recommend(_STD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
|
||||
__ms - 1;
|
||||
pointer __p = __alloc().allocate(__cap+1);
|
||||
pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
|
||||
__invalidate_all_iterators();
|
||||
if (__n_copy != 0)
|
||||
traits_type::copy(__p, __old_p, __n_copy);
|
||||
@@ -1755,7 +1845,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
|
||||
if (__sec_cp_sz != 0)
|
||||
traits_type::copy(__p + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz);
|
||||
if (__old_cap+1 != __min_cap)
|
||||
__alloc().deallocate(__old_p, __old_cap+1);
|
||||
__alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
|
||||
__set_long_pointer(__p);
|
||||
__set_long_cap(__cap+1);
|
||||
}
|
||||
@@ -1826,6 +1916,54 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
|
||||
{
|
||||
if (this != &__str)
|
||||
{
|
||||
__copy_assign_alloc(__str);
|
||||
assign(__str);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
|
||||
{
|
||||
if (__alloc() != __str.__alloc())
|
||||
assign(__str);
|
||||
else
|
||||
__move_assign(__str, true_type());
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
|
||||
{
|
||||
clear();
|
||||
shrink_to_fit();
|
||||
__r_ = _STD::move(__str.__r_);
|
||||
__str.__zero();
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str)
|
||||
{
|
||||
__move_assign(__str, integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_move_assignment::value>());
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
template<class _InputIterator>
|
||||
typename enable_if
|
||||
@@ -2307,7 +2445,7 @@ typename enable_if
|
||||
__is_input_iterator<_InputIterator>::value,
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
>::type
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
|
||||
_InputIterator __j1, _InputIterator __j2)
|
||||
{
|
||||
for (; true; ++__i1, ++__j1)
|
||||
@@ -2323,7 +2461,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
|
||||
erase(__i1, __i2);
|
||||
break;
|
||||
}
|
||||
traits_type::assign(*__i1, *__j1);
|
||||
traits_type::assign(const_cast<value_type&>(*__i1), *__j1);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -2360,7 +2498,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, const basic_string& __str)
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const basic_string& __str)
|
||||
{
|
||||
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1),
|
||||
__str.data(), __str.size());
|
||||
@@ -2369,7 +2507,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, const_pointer __s, size_type __n)
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n)
|
||||
{
|
||||
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n);
|
||||
}
|
||||
@@ -2377,7 +2515,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, const_pointer __s)
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s)
|
||||
{
|
||||
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s);
|
||||
}
|
||||
@@ -2385,7 +2523,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, size_type __n, value_type __c)
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c)
|
||||
{
|
||||
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c);
|
||||
}
|
||||
@@ -2512,7 +2650,7 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::max_size() const
|
||||
{
|
||||
size_type __m = __alloc().max_size();
|
||||
size_type __m = __alloc_traits::max_size(__alloc());
|
||||
#if _LIBCPP_BIG_ENDIAN
|
||||
return (__m <= ~__long_mask ? __m : __m/2) - 1;
|
||||
#else
|
||||
@@ -2544,14 +2682,14 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
|
||||
else
|
||||
{
|
||||
if (__res_arg > __cap)
|
||||
__new_data = __alloc().allocate(__res_arg+1);
|
||||
__new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
|
||||
else
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__new_data = __alloc().allocate(__res_arg+1);
|
||||
__new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@@ -2569,7 +2707,7 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
|
||||
}
|
||||
traits_type::copy(__new_data, __p, size()+1);
|
||||
if (__was_long)
|
||||
__alloc().deallocate(__p, __cap+1);
|
||||
__alloc_traits::deallocate(__alloc(), __p, __cap+1);
|
||||
if (__now_long)
|
||||
{
|
||||
__set_long_cap(__res_arg+1);
|
||||
@@ -2691,7 +2829,8 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
|
||||
{
|
||||
__r_.swap(__str.__r_);
|
||||
_STD::swap(__r_.first(), __str.__r_.first());
|
||||
__swap_alloc(__alloc(), __str.__alloc());
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
__invalidate_all_iterators();
|
||||
__str.__invalidate_all_iterators();
|
||||
@@ -3110,6 +3249,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type _
|
||||
// __invariants
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
basic_string<_CharT, _Traits, _Allocator>::__invariants() const
|
||||
{
|
||||
@@ -3625,12 +3765,12 @@ extern template
|
||||
extern template
|
||||
enable_if<__is_input_iterator<char const*>::value, string&>::type
|
||||
string::
|
||||
replace<char const*>(string::iterator, string::iterator, char const*, char const*);
|
||||
replace<char const*>(string::const_iterator, string::const_iterator, char const*, char const*);
|
||||
|
||||
extern template
|
||||
enable_if<__is_input_iterator<wchar_t const*>::value, wstring&>::type
|
||||
wstring::
|
||||
replace<wchar_t const*>(wstring::iterator, wstring::iterator, wchar_t const*, wchar_t const*);
|
||||
replace<wchar_t const*>(wstring::const_iterator, wstring::const_iterator, wchar_t const*, wchar_t const*);
|
||||
|
||||
extern template
|
||||
enable_if<__is_forward_iterator<wchar_t*>::value, wstring&>::type
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -253,13 +253,8 @@ class _LIBCPP_VISIBLE thread
|
||||
{
|
||||
pthread_t __t_;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
thread(const thread&) = delete;
|
||||
thread& operator=(const thread&) = delete;
|
||||
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
thread(const thread&);
|
||||
thread& operator=(const thread&);
|
||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
public:
|
||||
typedef __thread_id id;
|
||||
typedef pthread_t native_handle_type;
|
||||
@@ -302,7 +297,7 @@ public:
|
||||
|
||||
class __assoc_sub_state;
|
||||
|
||||
class __thread_struct_imp;
|
||||
class _LIBCPP_HIDDEN __thread_struct_imp;
|
||||
|
||||
class __thread_struct
|
||||
{
|
||||
@@ -411,10 +406,10 @@ sleep_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
template <class _Duration>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
sleep_until(const chrono::time_point<chrono::monotonic_clock, _Duration>& __t)
|
||||
sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
sleep_for(__t - monotonic_clock::now());
|
||||
sleep_for(__t - steady_clock::now());
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
202
include/tuple
202
include/tuple
@@ -74,11 +74,8 @@ const unspecified ignore;
|
||||
template <class... T> tuple<V...> make_tuple(T&&...);
|
||||
template <class... T> tuple<ATypes...> forward_as_tuple(T&&...);
|
||||
template <class... T> tuple<T&...> tie(T&...);
|
||||
template <class... T, class... U> tuple<T..., U...> tuple_cat(const tuple<T...>&, const tuple<U...>&);
|
||||
template <class... T, class... U> tuple<T..., U...> tuple_cat(tuple<T...>&&, const tuple<U...>&);
|
||||
template <class... T, class... U> tuple<T..., U...> tuple_cat(const tuple<T...>&, tuple<U...>&&);
|
||||
template <class... T, class... U> tuple<T..., U...> tuple_cat(tuple<T...>&&, tuple<U...>&&);
|
||||
|
||||
template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls);
|
||||
|
||||
// 20.4.1.4, tuple helper classes:
|
||||
template <class T> class tuple_size; // undefined
|
||||
template <class... T> class tuple_size<tuple<T...>>;
|
||||
@@ -88,6 +85,7 @@ template <intsize_t I, class... T> class tuple_element<I, tuple<T...>>;
|
||||
// 20.4.1.5, element access:
|
||||
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type& get(tuple<T...>&);
|
||||
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type const& get(const tuple<T...>&);
|
||||
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type&& get(tuple<T...>&&);
|
||||
|
||||
// 20.4.1.6, relational operators:
|
||||
template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&);
|
||||
@@ -127,12 +125,6 @@ class _LIBCPP_VISIBLE tuple_size<tuple<_Tp...>>
|
||||
{
|
||||
};
|
||||
|
||||
template <class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<const tuple<_Tp...>>
|
||||
: public integral_constant<size_t, sizeof...(_Tp)>
|
||||
{
|
||||
};
|
||||
|
||||
// tuple_element
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
@@ -142,13 +134,6 @@ public:
|
||||
typedef typename tuple_element<_Ip, __tuple_types<_Tp...>>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const tuple<_Tp...>>
|
||||
{
|
||||
public:
|
||||
typedef const typename tuple_element<_Ip, __tuple_types<_Tp...>>::type type;
|
||||
};
|
||||
|
||||
// __tuple_leaf
|
||||
|
||||
template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value>
|
||||
@@ -443,6 +428,8 @@ class _LIBCPP_VISIBLE tuple
|
||||
typename tuple_element<_Jp, tuple<_Up...>>::type& get(tuple<_Up...>&);
|
||||
template <size_t _Jp, class ..._Up> friend
|
||||
const typename tuple_element<_Jp, tuple<_Up...>>::type& get(const tuple<_Up...>&);
|
||||
template <size_t _Jp, class ..._Up> friend
|
||||
typename tuple_element<_Jp, tuple<_Up...>>::type&& get(tuple<_Up...>&&);
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -596,6 +583,15 @@ get(const tuple<_Tp...>& __t)
|
||||
return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get();
|
||||
}
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename tuple_element<_Ip, tuple<_Tp...>>::type&&
|
||||
get(tuple<_Tp...>&& __t)
|
||||
{
|
||||
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
|
||||
return static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get();
|
||||
}
|
||||
|
||||
// tie
|
||||
|
||||
template <class ..._Tp>
|
||||
@@ -752,72 +748,140 @@ operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
|
||||
// tuple_cat
|
||||
|
||||
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
__tuple_cat(const tuple<_Tp...>& __x, __tuple_indices<_I1...>, const tuple<_Up...>& __y, __tuple_indices<_I2...>)
|
||||
template <class _Tp, class _Up> struct __tuple_cat_type;
|
||||
|
||||
template <class ..._Ttypes, class ..._Utypes>
|
||||
struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...>>
|
||||
{
|
||||
return tuple<_Tp..., _Up...>(get<_I1>(__x)..., get<_I2>(__y)...);
|
||||
typedef tuple<_Ttypes..., _Utypes...> type;
|
||||
};
|
||||
|
||||
template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
|
||||
struct __tuple_cat_return_1
|
||||
{
|
||||
};
|
||||
|
||||
template <class ..._Types, class _Tuple0>
|
||||
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
|
||||
{
|
||||
typedef typename __tuple_cat_type<tuple<_Types...>,
|
||||
typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples>
|
||||
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...>
|
||||
: public __tuple_cat_return_1<
|
||||
typename __tuple_cat_type<
|
||||
tuple<_Types...>,
|
||||
typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type
|
||||
>::type,
|
||||
__tuple_like<typename remove_reference<_Tuple1>::type>::value,
|
||||
_Tuple1, _Tuples...>
|
||||
{
|
||||
};
|
||||
|
||||
template <class ..._Tuples> struct __tuple_cat_return;
|
||||
|
||||
template <class _Tuple0, class ..._Tuples>
|
||||
struct __tuple_cat_return<_Tuple0, _Tuples...>
|
||||
: public __tuple_cat_return_1<tuple<>,
|
||||
__tuple_like<typename remove_reference<_Tuple0>::type>::value, _Tuple0,
|
||||
_Tuples...>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct __tuple_cat_return<>
|
||||
{
|
||||
typedef tuple<> type;
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<>
|
||||
tuple_cat()
|
||||
{
|
||||
return tuple<>();
|
||||
}
|
||||
|
||||
template <class... _Tp, class... _Up>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
tuple_cat(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
{
|
||||
return __tuple_cat(__x, typename __make_tuple_indices<sizeof...(_Tp)>::type(),
|
||||
__y, typename __make_tuple_indices<sizeof...(_Up)>::type());
|
||||
}
|
||||
template <class _R, class _Indices, class _Tuple0, class ..._Tuples>
|
||||
struct __tuple_cat_return_ref_imp;
|
||||
|
||||
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
__tuple_cat(tuple<_Tp...>&& __x, __tuple_indices<_I1...>, const tuple<_Up...>& __y, __tuple_indices<_I2...>)
|
||||
template <class ..._Types, size_t ..._I0, class _Tuple0>
|
||||
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
|
||||
{
|
||||
return tuple<_Tp..., _Up...>(_STD::forward<_Tp>(get<_I1>(__x))..., get<_I2>(__y)...);
|
||||
}
|
||||
typedef typename remove_reference<_Tuple0>::type _T0;
|
||||
typedef tuple<_Types..., typename __apply_cv<_Tuple0,
|
||||
typename tuple_element<_I0, _T0>::type>::type&&...> type;
|
||||
};
|
||||
|
||||
template <class... _Tp, class... _Up>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
tuple_cat(tuple<_Tp...>&& __x, const tuple<_Up...>& __y)
|
||||
template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples>
|
||||
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>,
|
||||
_Tuple0, _Tuple1, _Tuples...>
|
||||
: public __tuple_cat_return_ref_imp<
|
||||
tuple<_Types..., typename __apply_cv<_Tuple0,
|
||||
typename tuple_element<_I0,
|
||||
typename remove_reference<_Tuple0>::type>::type>::type&&...>,
|
||||
typename __make_tuple_indices<tuple_size<typename
|
||||
remove_reference<_Tuple1>::type>::value>::type,
|
||||
_Tuple1, _Tuples...>
|
||||
{
|
||||
return __tuple_cat(_STD::move(__x), typename __make_tuple_indices<sizeof...(_Tp)>::type(),
|
||||
__y, typename __make_tuple_indices<sizeof...(_Up)>::type());
|
||||
}
|
||||
};
|
||||
|
||||
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
__tuple_cat(const tuple<_Tp...>& __x, __tuple_indices<_I1...>, tuple<_Up...>&& __y, __tuple_indices<_I2...>)
|
||||
template <class _Tuple0, class ..._Tuples>
|
||||
struct __tuple_cat_return_ref
|
||||
: public __tuple_cat_return_ref_imp<tuple<>,
|
||||
typename __make_tuple_indices<
|
||||
tuple_size<typename remove_reference<_Tuple0>::type>::value
|
||||
>::type, _Tuple0, _Tuples...>
|
||||
{
|
||||
return tuple<_Tp..., _Up...>(get<_I1>(__x)..., _STD::forward<_Up>(get<_I2>(__y))...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class... _Tp, class... _Up>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
tuple_cat(const tuple<_Tp...>& __x, tuple<_Up...>&& __y)
|
||||
{
|
||||
return __tuple_cat(__x, typename __make_tuple_indices<sizeof...(_Tp)>::type(),
|
||||
_STD::move(__y), typename __make_tuple_indices<sizeof...(_Up)>::type());
|
||||
}
|
||||
template <class _Types, class _I0, class _J0>
|
||||
struct __tuple_cat;
|
||||
|
||||
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
__tuple_cat(tuple<_Tp...>&& __x, __tuple_indices<_I1...>, tuple<_Up...>&& __y, __tuple_indices<_I2...>)
|
||||
template <class ..._Types, size_t ..._I0, size_t ..._J0>
|
||||
struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...>>
|
||||
{
|
||||
return tuple<_Tp..., _Up...>(_STD::forward<_Tp>(get<_I1>(__x))..., _STD::forward<_Up>(get<_I2>(__y))...);
|
||||
}
|
||||
template <class _Tuple0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
|
||||
operator()(tuple<_Types...> __t, _Tuple0&& __t0)
|
||||
{
|
||||
return _STD::forward_as_tuple(_STD::forward<_Types>(get<_I0>(__t))...,
|
||||
get<_J0>(_STD::forward<_Tuple0>(__t0))...);
|
||||
}
|
||||
|
||||
template <class... _Tp, class... _Up>
|
||||
template <class _Tuple0, class _Tuple1, class ..._Tuples>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
|
||||
operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
|
||||
{
|
||||
typedef typename remove_reference<_Tuple0>::type _T0;
|
||||
typedef typename remove_reference<_Tuple1>::type _T1;
|
||||
return __tuple_cat<
|
||||
tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
|
||||
typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
|
||||
typename __make_tuple_indices<tuple_size<_T1>::value>::type>()
|
||||
(_STD::forward_as_tuple(
|
||||
_STD::forward<_Types>(get<_I0>(__t))...,
|
||||
get<_J0>(_STD::forward<_Tuple0>(__t0))...
|
||||
),
|
||||
_STD::forward<_Tuple1>(__t1),
|
||||
_STD::forward<_Tuples>(__tpls)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tuple0, class... _Tuples>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
tuple_cat(tuple<_Tp...>&& __x, tuple<_Up...>&& __y)
|
||||
typename __tuple_cat_return<_Tuple0, _Tuples...>::type
|
||||
tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
|
||||
{
|
||||
return __tuple_cat(_STD::move(__x), typename __make_tuple_indices<sizeof...(_Tp)>::type(),
|
||||
_STD::move(__y), typename __make_tuple_indices<sizeof...(_Up)>::type());
|
||||
typedef typename remove_reference<_Tuple0>::type _T0;
|
||||
return __tuple_cat<tuple<>, __tuple_indices<>,
|
||||
typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
|
||||
(tuple<>(), _STD::forward<_Tuple0>(__t0),
|
||||
_STD::forward<_Tuples>(__tpls)...);
|
||||
}
|
||||
|
||||
template <class ..._Tp, class _Alloc>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -38,7 +38,7 @@ template <class T> typename remove_reference<T>::type&& move(T&&);
|
||||
template <class T>
|
||||
typename conditional
|
||||
<
|
||||
!has_nothrow_move_constructor<T>::value && has_copy_constructor<T>::value,
|
||||
!is_nothrow_move_constructible<T>::value && is_copy_constructible<T>::value,
|
||||
const T&,
|
||||
T&&
|
||||
>::type
|
||||
@@ -100,6 +100,10 @@ template<size_t I, class T1, class T2>
|
||||
const typename const tuple_element<I, std::pair<T1, T2> >::type&
|
||||
get(const std::pair<T1, T2>&);
|
||||
|
||||
template<size_t I, class T1, class T2>
|
||||
typename tuple_element<I, std::pair<T1, T2> >::type&&
|
||||
get(std::pair<T1, T2>&&);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
@@ -174,7 +178,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
typename conditional
|
||||
<
|
||||
!has_nothrow_move_constructor<_Tp>::value && has_copy_constructor<_Tp>::value,
|
||||
!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value,
|
||||
const _Tp&,
|
||||
_Tp&&
|
||||
>::type
|
||||
@@ -230,6 +234,8 @@ struct _LIBCPP_VISIBLE pair
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(get<1>(__p)))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
|
||||
@@ -425,6 +431,16 @@ struct __get_pair<0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _T1&
|
||||
get(const pair<_T1, _T2>& __p) {return __p.first;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _T1, class _T2>
|
||||
static
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_T1&&
|
||||
get(pair<_T1, _T2>&& __p) {return _STD::forward<_T1>(__p.first);}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -441,6 +457,16 @@ struct __get_pair<1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _T2&
|
||||
get(const pair<_T1, _T2>& __p) {return __p.second;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _T1, class _T2>
|
||||
static
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_T2&&
|
||||
get(pair<_T1, _T2>&& __p) {return _STD::forward<_T2>(__p.second);}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
@@ -459,6 +485,18 @@ get(const pair<_T1, _T2>& __p)
|
||||
return __get_pair<_Ip>::get(__p);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||
get(pair<_T1, _T2>&& __p)
|
||||
{
|
||||
return __get_pair<_Ip>::get(_STD::move(__p));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -318,17 +318,17 @@ protected:
|
||||
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() {return __end_cap_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const {return __end_cap_.first();}
|
||||
|
||||
__vector_base();
|
||||
__vector_base(const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY __vector_base();
|
||||
_LIBCPP_INLINE_VISIBILITY __vector_base(const allocator_type& __a);
|
||||
~__vector_base();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void clear() {__destruct_at_end(__begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __begin_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last)
|
||||
{__destruct_at_end(__new_last, has_trivial_destructor<value_type>());}
|
||||
void __destruct_at_end(const_pointer __new_last, false_type);
|
||||
void __destruct_at_end(const_pointer __new_last, true_type);
|
||||
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
|
||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last, false_type);
|
||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last, true_type);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const __vector_base& __c)
|
||||
@@ -484,7 +484,9 @@ public:
|
||||
template <class _ForwardIterator>
|
||||
vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
|
||||
typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(initializer_list<value_type> __il);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -493,10 +495,14 @@ public:
|
||||
|
||||
vector(const vector& __x);
|
||||
vector(const vector& __x, const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector& operator=(const vector& __x);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(vector&& __x);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(vector&& __x, const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector& operator=(vector&& __x);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -526,10 +532,10 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const {return this->__alloc();}
|
||||
|
||||
iterator begin();
|
||||
const_iterator begin() const;
|
||||
iterator end();
|
||||
const_iterator end() const;
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin();
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const;
|
||||
_LIBCPP_INLINE_VISIBILITY iterator end();
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator end() const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() {return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
|
||||
@@ -563,7 +569,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY const value_type* data() const
|
||||
{return _STD::__to_raw_pointer(this->__begin_);}
|
||||
|
||||
void push_back(const_reference __x);
|
||||
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void push_back(value_type&& __x);
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
@@ -601,7 +607,7 @@ public:
|
||||
iterator insert(const_iterator __position, initializer_list<value_type> __il)
|
||||
{return insert(__position, __il.begin(), __il.end());}
|
||||
|
||||
iterator erase(const_iterator __position);
|
||||
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
|
||||
iterator erase(const_iterator __first, const_iterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void clear() {__base::clear();}
|
||||
@@ -614,15 +620,17 @@ public:
|
||||
bool __invariants() const;
|
||||
|
||||
private:
|
||||
void __invalidate_all_iterators();
|
||||
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
|
||||
void allocate(size_type __n);
|
||||
void deallocate();
|
||||
size_type __recommend(size_type __new_size) const;
|
||||
void __construct_at_end(size_type __n);
|
||||
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
|
||||
_LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n);
|
||||
void __construct_at_end(size_type __n, false_type);
|
||||
void __construct_at_end(size_type __n, true_type);
|
||||
_LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, true_type);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __construct_at_end(size_type __n, const_reference __x);
|
||||
void __construct_at_end(size_type __n, const_reference __x, false_type);
|
||||
void __construct_at_end(size_type __n, const_reference __x, false_type);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __construct_at_end(size_type __n, const_reference __x, true_type);
|
||||
template <class _ForwardIterator>
|
||||
typename enable_if
|
||||
@@ -634,7 +642,9 @@ private:
|
||||
void __move_construct_at_end(pointer __first, pointer __last);
|
||||
void __append(size_type __n);
|
||||
void __append(size_type __n, const_reference __x);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator __make_iter(pointer __p);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator __make_iter(const_pointer __p) const;
|
||||
void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v);
|
||||
pointer __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p);
|
||||
@@ -771,8 +781,8 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
|
||||
{
|
||||
__construct_at_end(__n, __x, integral_constant<bool, has_trivial_copy_constructor<value_type>::value &&
|
||||
has_trivial_copy_assign<value_type>::value>());
|
||||
__construct_at_end(__n, __x, integral_constant<bool, is_trivially_copy_constructible<value_type>::value &&
|
||||
is_trivially_copy_assignable<value_type>::value>());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@@ -1757,8 +1767,8 @@ private:
|
||||
{return (__n - 1) / __bits_per_word + 1;}
|
||||
|
||||
public:
|
||||
vector();
|
||||
explicit vector(const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY vector();
|
||||
_LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a);
|
||||
~vector();
|
||||
explicit vector(size_type __n);
|
||||
vector(size_type __n, const value_type& __v);
|
||||
@@ -1785,9 +1795,9 @@ public:
|
||||
vector(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
vector(vector&& __v);
|
||||
_LIBCPP_INLINE_VISIBILITY vector(vector&& __v);
|
||||
vector(vector&& __v, const allocator_type& __a);
|
||||
vector& operator=(vector&& __v);
|
||||
_LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __v);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector& operator=(initializer_list<value_type> __il)
|
||||
@@ -1874,7 +1884,7 @@ public:
|
||||
iterator insert(const_iterator __position, initializer_list<value_type> __il)
|
||||
{return insert(__position, __il.begin(), __il.end());}
|
||||
|
||||
iterator erase(const_iterator __position);
|
||||
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
|
||||
iterator erase(const_iterator __first, const_iterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void clear() {__size_ = 0;}
|
||||
@@ -1887,13 +1897,13 @@ public:
|
||||
bool __invariants() const;
|
||||
|
||||
private:
|
||||
void __invalidate_all_iterators();
|
||||
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
|
||||
void allocate(size_type __n);
|
||||
void deallocate();
|
||||
_LIBCPP_INLINE_VISIBILITY static size_type __align(size_type __new_size)
|
||||
{return __new_size + (__bits_per_word-1) & ~(__bits_per_word-1);};
|
||||
size_type __recommend(size_type __new_size) const;
|
||||
void __construct_at_end(size_type __n, bool __x);
|
||||
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
|
||||
_LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x);
|
||||
template <class _ForwardIterator>
|
||||
typename enable_if
|
||||
<
|
||||
@@ -2250,7 +2260,6 @@ vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const alloca
|
||||
}
|
||||
|
||||
template <class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
vector<bool, _Allocator>::~vector()
|
||||
{
|
||||
if (__begin_ != 0)
|
||||
|
56
lib/CMakeLists.txt
Normal file
56
lib/CMakeLists.txt
Normal file
@@ -0,0 +1,56 @@
|
||||
# Get sources
|
||||
file(GLOB_RECURSE sources ../src/*.cpp)
|
||||
|
||||
# Add all the headers to the project for IDEs.
|
||||
if (MSVC_IDE OR XCODE)
|
||||
file(GLOB_RECURSE headers ../include/*)
|
||||
# Force them all into the headers dir on MSVC, otherwise they end up at
|
||||
# project scope because they don't have extensions.
|
||||
if (MSVC_IDE)
|
||||
source_group("Header Files" FILES ${headers})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (LIBCXX_ENABLE_SHARED)
|
||||
add_library(cxx SHARED
|
||||
${sources}
|
||||
${headers}
|
||||
)
|
||||
else()
|
||||
add_library(cxx STATIC
|
||||
${sources}
|
||||
${headers}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Generate library list.
|
||||
append_if(libraries LIBCXX_HAS_PTHREAD_LIB pthread)
|
||||
append_if(libraries LIBCXX_HAS_C_LIB c)
|
||||
append_if(libraries LIBCXX_HAS_M_LIB m)
|
||||
append_if(libraries LIBCXX_HAS_GCC_S_LIB gcc_s)
|
||||
|
||||
target_link_libraries(cxx ${libraries})
|
||||
|
||||
# Setup flags.
|
||||
append_if(compile_flags LIBCXX_HAS_FPIC_FLAG -fPIC)
|
||||
append_if(link_flags LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
|
||||
|
||||
set_target_properties(cxx
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${compile_flags}"
|
||||
LINK_FLAGS "${link_flags}"
|
||||
OUTPUT_NAME "c++"
|
||||
VERSION "1.0"
|
||||
SOVERSION "1"
|
||||
)
|
||||
|
||||
install(TARGETS cxx
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
install(DIRECTORY ../include/
|
||||
DESTINATION include/c++/v1
|
||||
FILES_MATCHING
|
||||
PATTERN "*"
|
||||
)
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user