LLVM Minix changes
- import libcxx - reduce targets to the one when compiled as a tools Change-Id: Iabb8427f80ff8e89463559a28bcb8b4f2bdbc496
This commit is contained in:
parent
fe5a129a88
commit
4684ddb6aa
5408 changed files with 694541 additions and 5722 deletions
|
@ -76,8 +76,3 @@ __strong_alias(popcount, popcount32)
|
|||
#if ULONG_MAX == 0xffffffffU
|
||||
__strong_alias(popcountl, popcount32)
|
||||
#endif
|
||||
|
||||
#if defined(__minix)
|
||||
__strong_alias(__popcountsi2, popcount32)
|
||||
__strong_alias(__popcountdi2, popcount32)
|
||||
#endif
|
||||
|
|
|
@ -975,6 +975,9 @@ _prop_object_internalize_map_file(const char *fname)
|
|||
* Unmap a file previously mapped for internalizing.
|
||||
*/
|
||||
void
|
||||
#if defined(__minix)
|
||||
__dead
|
||||
#endif /* defined(__minix) */
|
||||
_prop_object_internalize_unmap_file(
|
||||
struct _prop_object_internalize_mapped_file *mf)
|
||||
{
|
||||
|
|
|
@ -250,6 +250,10 @@
|
|||
./usr/bin/chsh minix-sys
|
||||
./usr/bin/ci minix-sys
|
||||
./usr/bin/cksum minix-sys
|
||||
./usr/bin/clang++ minix-sys llvm
|
||||
./usr/bin/clang minix-sys llvm
|
||||
./usr/bin/clang-cpp minix-sys llvm
|
||||
./usr/bin/clang-tblgen minix-sys llvm
|
||||
./usr/bin/cleantmp minix-sys
|
||||
./usr/bin/clear minix-sys
|
||||
./usr/bin/cmp minix-sys
|
||||
|
@ -356,6 +360,7 @@
|
|||
./usr/bin/lessecho minix-sys
|
||||
./usr/bin/lesskey minix-sys
|
||||
./usr/bin/lex minix-sys
|
||||
./usr/bin/llvm-tblgen minix-sys llvm
|
||||
./usr/bin/loadfont minix-sys
|
||||
./usr/bin/loadramdisk minix-sys
|
||||
./usr/bin/lock minix-sys
|
||||
|
@ -615,8 +620,151 @@
|
|||
./usr/include/bitstring.h minix-sys
|
||||
./usr/include/bm.h minix-sys
|
||||
./usr/include/bzlib.h minix-sys
|
||||
./usr/include/c++ minix-sys libcxx
|
||||
./usr/include/c++/algorithm minix-sys libcxx
|
||||
./usr/include/c++/array minix-sys libcxx
|
||||
./usr/include/c++/atomic minix-sys libcxx
|
||||
./usr/include/c++/backward minix-sys libcxx
|
||||
./usr/include/c++/__bit_reference minix-sys libcxx
|
||||
./usr/include/c++/bits minix-sys libcxx
|
||||
./usr/include/c++/bitset minix-sys libcxx
|
||||
./usr/include/c++/cassert minix-sys libcxx
|
||||
./usr/include/c++/ccomplex minix-sys libcxx
|
||||
./usr/include/c++/cctype minix-sys libcxx
|
||||
./usr/include/c++/cerrno minix-sys libcxx
|
||||
./usr/include/c++/cfenv minix-sys libcxx
|
||||
./usr/include/c++/cfloat minix-sys libcxx
|
||||
./usr/include/c++/chrono minix-sys libcxx
|
||||
./usr/include/c++/cinttypes minix-sys libcxx
|
||||
./usr/include/c++/ciso646 minix-sys libcxx
|
||||
./usr/include/c++/climits minix-sys libcxx
|
||||
./usr/include/c++/clocale minix-sys libcxx
|
||||
./usr/include/c++/cmath minix-sys libcxx
|
||||
./usr/include/c++/codecvt minix-sys libcxx
|
||||
./usr/include/c++/complex minix-sys libcxx
|
||||
./usr/include/c++/complex.h minix-sys libcxx
|
||||
./usr/include/c++/condition_variable minix-sys libcxx
|
||||
./usr/include/c++/__config minix-sys libcxx
|
||||
./usr/include/c++/csetjmp minix-sys libcxx
|
||||
./usr/include/c++/csignal minix-sys libcxx
|
||||
./usr/include/c++/cstdarg minix-sys libcxx
|
||||
./usr/include/c++/cstdbool minix-sys libcxx
|
||||
./usr/include/c++/cstddef minix-sys libcxx
|
||||
./usr/include/c++/cstdint minix-sys libcxx
|
||||
./usr/include/c++/cstdio minix-sys libcxx
|
||||
./usr/include/c++/cstdlib minix-sys libcxx
|
||||
./usr/include/c++/cstring minix-sys libcxx
|
||||
./usr/include/c++/ctgmath minix-sys libcxx
|
||||
./usr/include/c++/ctime minix-sys libcxx
|
||||
./usr/include/c++/cwchar minix-sys libcxx
|
||||
./usr/include/c++/cwctype minix-sys libcxx
|
||||
./usr/include/c++/cxxabi.h minix-sys libcxx
|
||||
./usr/include/c++/__debug minix-sys libcxx
|
||||
./usr/include/c++/debug minix-sys libcxx
|
||||
./usr/include/c++/decimal minix-sys libcxx
|
||||
./usr/include/c++/deque minix-sys libcxx
|
||||
./usr/include/c++/exception minix-sys libcxx
|
||||
./usr/include/c++/experimental minix-sys libcxx
|
||||
./usr/include/c++/experimental/dynarray minix-sys libcxx
|
||||
./usr/include/c++/experimental/optional minix-sys libcxx
|
||||
./usr/include/c++/ext minix-sys libcxx
|
||||
./usr/include/c++/ext/__hash minix-sys libcxx
|
||||
./usr/include/c++/ext/hash_map minix-sys libcxx
|
||||
./usr/include/c++/ext/hash_set minix-sys libcxx
|
||||
./usr/include/c++/forward_list minix-sys libcxx
|
||||
./usr/include/c++/fstream minix-sys libcxx
|
||||
./usr/include/c++/__functional_03 minix-sys libcxx
|
||||
./usr/include/c++/functional minix-sys libcxx
|
||||
./usr/include/c++/__functional_base_03 minix-sys libcxx
|
||||
./usr/include/c++/__functional_base minix-sys libcxx
|
||||
./usr/include/c++/future minix-sys libcxx
|
||||
./usr/include/c++/__hash_table minix-sys libcxx
|
||||
./usr/include/c++/initializer_list minix-sys libcxx
|
||||
./usr/include/c++/iomanip minix-sys libcxx
|
||||
./usr/include/c++/ios minix-sys libcxx
|
||||
./usr/include/c++/iosfwd minix-sys libcxx
|
||||
./usr/include/c++/iostream minix-sys libcxx
|
||||
./usr/include/c++/istream minix-sys libcxx
|
||||
./usr/include/c++/iterator minix-sys libcxx
|
||||
./usr/include/c++/limits minix-sys libcxx
|
||||
./usr/include/c++/list minix-sys libcxx
|
||||
./usr/include/c++/__locale minix-sys libcxx
|
||||
./usr/include/c++/locale minix-sys libcxx
|
||||
./usr/include/c++/map minix-sys libcxx
|
||||
./usr/include/c++/memory minix-sys libcxx
|
||||
./usr/include/c++/mutex minix-sys libcxx
|
||||
./usr/include/c++/__mutex_base minix-sys libcxx
|
||||
./usr/include/c++/new minix-sys libcxx
|
||||
./usr/include/c++/numeric minix-sys libcxx
|
||||
./usr/include/c++/ostream minix-sys libcxx
|
||||
./usr/include/c++/parallel minix-sys libcxx
|
||||
./usr/include/c++/queue minix-sys libcxx
|
||||
./usr/include/c++/random minix-sys libcxx
|
||||
./usr/include/c++/ratio minix-sys libcxx
|
||||
./usr/include/c++/regex minix-sys libcxx
|
||||
./usr/include/c++/scoped_allocator minix-sys libcxx
|
||||
./usr/include/c++/set minix-sys libcxx
|
||||
./usr/include/c++/shared_mutex minix-sys libcxx
|
||||
./usr/include/c++/__split_buffer minix-sys libcxx
|
||||
./usr/include/c++/__sso_allocator minix-sys libcxx
|
||||
./usr/include/c++/sstream minix-sys libcxx
|
||||
./usr/include/c++/stack minix-sys libcxx
|
||||
./usr/include/c++/stdexcept minix-sys libcxx
|
||||
./usr/include/c++/__std_stream minix-sys libcxx
|
||||
./usr/include/c++/streambuf minix-sys libcxx
|
||||
./usr/include/c++/string minix-sys libcxx
|
||||
./usr/include/c++/strstream minix-sys libcxx
|
||||
./usr/include/c++/system_error minix-sys libcxx
|
||||
./usr/include/c++/tgmath.h minix-sys libcxx
|
||||
./usr/include/c++/thread minix-sys libcxx
|
||||
./usr/include/c++/tr1 minix-sys libcxx
|
||||
./usr/include/c++/tr1_impl minix-sys libcxx
|
||||
./usr/include/c++/__tree minix-sys libcxx
|
||||
./usr/include/c++/__tuple_03 minix-sys libcxx
|
||||
./usr/include/c++/__tuple minix-sys libcxx
|
||||
./usr/include/c++/tuple minix-sys libcxx
|
||||
./usr/include/c++/typeindex minix-sys libcxx
|
||||
./usr/include/c++/typeinfo minix-sys libcxx
|
||||
./usr/include/c++/type_traits minix-sys libcxx
|
||||
./usr/include/c++/__undef_min_max minix-sys libcxx
|
||||
./usr/include/c++/unordered_map minix-sys libcxx
|
||||
./usr/include/c++/unordered_set minix-sys libcxx
|
||||
./usr/include/c++/utility minix-sys libcxx
|
||||
./usr/include/c++/valarray minix-sys libcxx
|
||||
./usr/include/c++/vector minix-sys libcxx
|
||||
./usr/include/cdbr.h minix-sys
|
||||
./usr/include/cdbw.h minix-sys
|
||||
./usr/include/clang-3.4 minix-sys
|
||||
./usr/include/clang-3.4/ammintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/avx2intrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/avxintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/bmi2intrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/bmiintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/emmintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/f16cintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/fma4intrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/fmaintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/immintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/lzcntintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/mm3dnow.h minix-sys llvm
|
||||
./usr/include/clang-3.4/mmintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/mm_malloc.h minix-sys llvm
|
||||
./usr/include/clang-3.4/nmmintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/pmmintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/popcntintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/prfchwintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/rdseedintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/rtmintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/shaintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/smmintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/tbmintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/tmmintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/__wmmintrin_aes.h minix-sys llvm
|
||||
./usr/include/clang-3.4/wmmintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/__wmmintrin_pclmul.h minix-sys llvm
|
||||
./usr/include/clang-3.4/x86intrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/xmmintrin.h minix-sys llvm
|
||||
./usr/include/clang-3.4/xopintrin.h minix-sys llvm
|
||||
./usr/include/compat minix-sys
|
||||
./usr/include/compat/machine minix-sys
|
||||
./usr/include/complex.h minix-sys
|
||||
|
@ -1669,6 +1817,66 @@
|
|||
./usr/include/zlib.h minix-sys
|
||||
./usr/lib minix-sys
|
||||
./usr/lib/bc minix-sys
|
||||
./usr/lib/bc/libarchive.a minix-sys bitcode
|
||||
./usr/lib/bc/libasyn.a minix-sys bitcode
|
||||
./usr/lib/bc/libatf-c.a minix-sys bitcode,atf
|
||||
./usr/lib/bc/libatf-c++.a minix-sys bitcode,atf
|
||||
./usr/lib/bc/libaudiodriver.a minix-sys bitcode
|
||||
./usr/lib/bc/libbdev.a minix-sys bitcode
|
||||
./usr/lib/bc/libbfd.a minix-sys bitcode,binutils
|
||||
./usr/lib/bc/libblockdriver.a minix-sys bitcode
|
||||
./usr/lib/bc/libbz2.a minix-sys bitcode
|
||||
./usr/lib/bc/libc.a minix-sys bitcode
|
||||
./usr/lib/bc/libc++.a minix-sys bitcode
|
||||
./usr/lib/bc/libchardriver.a minix-sys bitcode
|
||||
./usr/lib/bc/libcompat_minix.a minix-sys bitcode
|
||||
./usr/lib/bc/libcrypt.a minix-sys bitcode
|
||||
./usr/lib/bc/libcurses.a minix-sys bitcode
|
||||
./usr/lib/bc/libddekit.a minix-sys bitcode
|
||||
./usr/lib/bc/libddekit_usb_client.a minix-sys bitcode
|
||||
./usr/lib/bc/libddekit_usb_server.a minix-sys bitcode
|
||||
./usr/lib/bc/libdevman.a minix-sys bitcode
|
||||
./usr/lib/bc/libedit.a minix-sys bitcode
|
||||
./usr/lib/bc/libelf.a minix-sys bitcode
|
||||
./usr/lib/bc/libexec.a minix-sys bitcode
|
||||
./usr/lib/bc/libexecinfo.a minix-sys bitcode
|
||||
./usr/lib/bc/libfetch.a minix-sys bitcode
|
||||
./usr/lib/bc/libform.a minix-sys bitcode
|
||||
./usr/lib/bc/libhgfs.a minix-sys bitcode
|
||||
./usr/lib/bc/libiberty.a minix-sys bitcode,binutils
|
||||
./usr/lib/bc/libinputdriver.a minix-sys bitcode
|
||||
./usr/lib/bc/libl.a minix-sys bitcode
|
||||
./usr/lib/bc/liblua.a minix-sys bitcode
|
||||
./usr/lib/bc/liblutok.a minix-sys bitcode,atf
|
||||
./usr/lib/bc/liblwip.a minix-sys bitcode
|
||||
./usr/lib/bc/liblzma.a minix-sys bitcode
|
||||
./usr/lib/bc/libm387.a minix-sys bitcode
|
||||
./usr/lib/bc/libm.a minix-sys bitcode
|
||||
./usr/lib/bc/libmagic.a minix-sys bitcode
|
||||
./usr/lib/bc/libmenu.a minix-sys bitcode
|
||||
./usr/lib/bc/libminc.a minix-sys bitcode
|
||||
./usr/lib/bc/libminixfs.a minix-sys bitcode
|
||||
./usr/lib/bc/libminlib.a minix-sys bitcode
|
||||
./usr/lib/bc/libmthread.a minix-sys bitcode
|
||||
./usr/lib/bc/libnetdriver.a minix-sys bitcode
|
||||
./usr/lib/bc/libnetsock.a minix-sys bitcode
|
||||
./usr/lib/bc/libopcodes.a minix-sys bitcode,binutils
|
||||
./usr/lib/bc/libprop.a minix-sys bitcode
|
||||
./usr/lib/bc/libpuffs.a minix-sys bitcode
|
||||
./usr/lib/bc/librefuse.a minix-sys bitcode
|
||||
./usr/lib/bc/librmt.a minix-sys bitcode
|
||||
./usr/lib/bc/libsffs.a minix-sys bitcode
|
||||
./usr/lib/bc/libsqlite3.a minix-sys bitcode
|
||||
./usr/lib/bc/libsys.a minix-sys bitcode
|
||||
./usr/lib/bc/libterminfo.a minix-sys bitcode
|
||||
./usr/lib/bc/libtimers.a minix-sys bitcode
|
||||
./usr/lib/bc/libusb.a minix-sys bitcode
|
||||
./usr/lib/bc/libutil.a minix-sys bitcode
|
||||
./usr/lib/bc/libvassert.a minix-sys bitcode
|
||||
./usr/lib/bc/libvboxfs.a minix-sys bitcode
|
||||
./usr/lib/bc/libvirtio.a minix-sys bitcode
|
||||
./usr/lib/bc/libvtreefs.a minix-sys bitcode
|
||||
./usr/lib/bc/libz.a minix-sys bitcode
|
||||
./usr/lib/cawf minix-sys
|
||||
./usr/lib/cawf/common minix-sys
|
||||
./usr/lib/cawf/device.cf minix-sys
|
||||
|
@ -1752,6 +1960,7 @@
|
|||
./usr/lib/libbz2.so.1 minix-sys
|
||||
./usr/lib/libbz2.so.1.1 minix-sys
|
||||
./usr/lib/libc.a minix-sys
|
||||
./usr/lib/libc++.a minix-sys libcxx
|
||||
./usr/lib/libchardriver.a minix-sys
|
||||
./usr/lib/libchardriver_pic.a minix-sys
|
||||
./usr/lib/libcompat_minix.a minix-sys
|
||||
|
@ -1761,12 +1970,16 @@
|
|||
./usr/lib/libcompat_minix.so minix-sys
|
||||
./usr/lib/libc.pc minix-sys
|
||||
./usr/lib/libc_pic.a minix-sys
|
||||
./usr/lib/libc++_pic.a minix-sys libcxx
|
||||
./usr/lib/libcrypt.a minix-sys
|
||||
./usr/lib/libcrypt_pic.a minix-sys
|
||||
./usr/lib/libcrypt.so minix-sys
|
||||
./usr/lib/libcrypt.so.1.0 minix-sys
|
||||
./usr/lib/libcrypt.so.1 minix-sys
|
||||
./usr/lib/libc.so minix-sys
|
||||
./usr/lib/libc++.so minix-sys libcxx
|
||||
./usr/lib/libc++.so.1.0 minix-sys libcxx
|
||||
./usr/lib/libc++.so.1 minix-sys libcxx
|
||||
./usr/lib/libc.so.12 minix-sys
|
||||
./usr/lib/libc.so.12.187 minix-sys
|
||||
./usr/lib/libcurses.a minix-sys
|
||||
|
@ -5789,8 +6002,16 @@
|
|||
./usr/src/src.tar.gz minix-sys src
|
||||
./usr/tests minix-sys
|
||||
./usr/tests/atf/atf-c++/detail/auto_array_test minix-sys atf
|
||||
./usr/tests/lib minix-sys bitcode
|
||||
./usr/tests/lib/csu minix-sys bitcode
|
||||
./usr/tests/lib/csu/bc minix-sys bitcode
|
||||
./usr/tests/lib/csu/bc/h_initfini3_dso.a minix-sys bitcode,atf
|
||||
./usr/tests/lib/libc minix-sys bitcode
|
||||
./usr/tests/lib/libc/stdio/t_mktemp minix-sys atf
|
||||
./usr/tests/lib/libc/stdio/t_printf minix-sys atf
|
||||
./usr/tests/lib/libc/tls minix-sys bitcode
|
||||
./usr/tests/lib/libc/tls/bc minix-sys bitcode
|
||||
./usr/tests/lib/libc/tls/bc/libh_tls_dynamic.a minix-sys bitcode,atf
|
||||
./usr/tests/lib/libcurses/director minix-sys atf
|
||||
./usr/tests/lib/libpthread/dlopen minix-sys atf
|
||||
./usr/tests/libexec/Atffile minix-sys atf
|
||||
|
|
|
@ -52,11 +52,12 @@ static ssize_t hello_read(devminor_t UNUSED(minor), u64_t position,
|
|||
u64_t dev_size;
|
||||
char *ptr;
|
||||
int ret;
|
||||
char *buf = HELLO_MESSAGE;
|
||||
|
||||
printf("hello_read()\n");
|
||||
|
||||
/* This is the total size of our device. */
|
||||
dev_size = (u64_t) strlen(HELLO_MESSAGE);
|
||||
dev_size = (u64_t) strlen(buf);
|
||||
|
||||
/* Check for EOF, and possibly limit the read size. */
|
||||
if (position >= dev_size) return 0; /* EOF */
|
||||
|
@ -64,7 +65,7 @@ static ssize_t hello_read(devminor_t UNUSED(minor), u64_t position,
|
|||
size = (size_t)(dev_size - position); /* limit size */
|
||||
|
||||
/* Copy the requested part to the caller. */
|
||||
ptr = HELLO_MESSAGE + (size_t)position;
|
||||
ptr = buf + (size_t)position;
|
||||
if ((ret = sys_safecopyto(endpt, grant, 0, (vir_bytes) ptr, size)) != OK)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ OBJS= ${SRCS:N*.h:R:S/$/.o/g}
|
|||
MKBUILDEXT2RD?= no
|
||||
|
||||
RAMDISK_PATH= ${NETBSDSRCDIR}/drivers/ramdisk
|
||||
DPADD+= ${LIBBLOCKDRIVER} ${LIBCHARDRIVER} ${LIBSYS}
|
||||
LDADD+= -lblockdriver -lchardriver -lsys
|
||||
DPADD+= ${LIBBLOCKDRIVER} ${LIBCHARDRIVER}
|
||||
LDADD+= -lblockdriver -lchardriver
|
||||
|
||||
MAN=
|
||||
|
||||
|
|
|
@ -11,8 +11,16 @@ EXTRA_DIST_FILES= ${.CURDIR}/NetBSD.dist.XFree86
|
|||
.endif
|
||||
|
||||
.if defined(__MINIX)
|
||||
.if ${MKGCCCMDS} == "yes"
|
||||
EXTRA_DIST_FILES+= ${.CURDIR}/Minix.gcccmds
|
||||
.if ${MKLIBSTDCXX} == "yes"
|
||||
EXTRA_DIST_FILES+= ${.CURDIR}/Minix.libstdcxx
|
||||
.endif
|
||||
|
||||
.if ${MKLIBCXX} == "yes"
|
||||
EXTRA_DIST_FILES+= ${.CURDIR}/Minix.libcxx
|
||||
.endif
|
||||
|
||||
.if ${MKBITCODE} == "yes"
|
||||
EXTRA_DIST_FILES+= ${.CURDIR}/Minix.bitcode
|
||||
.endif
|
||||
.endif # defined(__MINIX)
|
||||
|
||||
|
|
8
etc/mtree/Minix.bitcode
Normal file
8
etc/mtree/Minix.bitcode
Normal file
|
@ -0,0 +1,8 @@
|
|||
/set type=dir uid=0 gid=0 mode=0755
|
||||
|
||||
./usr/tests/lib
|
||||
./usr/tests/lib/csu
|
||||
./usr/tests/lib/csu/bc
|
||||
./usr/tests/lib/libc
|
||||
./usr/tests/lib/libc/tls
|
||||
./usr/tests/lib/libc/tls/bc
|
12
etc/mtree/Minix.libcxx
Normal file
12
etc/mtree/Minix.libcxx
Normal file
|
@ -0,0 +1,12 @@
|
|||
/set type=dir uid=0 gid=0 mode=0755
|
||||
|
||||
./usr/include/c++
|
||||
./usr/include/c++/backward
|
||||
./usr/include/c++/bits
|
||||
./usr/include/c++/debug
|
||||
./usr/include/c++/decimal
|
||||
./usr/include/c++/ext
|
||||
./usr/include/c++/experimental
|
||||
./usr/include/c++/parallel
|
||||
./usr/include/c++/tr1
|
||||
./usr/include/c++/tr1_impl
|
2
external/bsd/Makefile
vendored
2
external/bsd/Makefile
vendored
|
@ -19,11 +19,9 @@ SUBDIR+=ipf
|
|||
.if (${MKISCSI} != "no")
|
||||
SUBDIR+= iscsi
|
||||
.endif
|
||||
.if (defined(__MINIX) && ${MKGCCCMDS} == "yes")
|
||||
.if (${MKKYUA} != "no")
|
||||
SUBDIR+= lutok kyua-testers kyua-cli kyua-atf-compat
|
||||
.endif
|
||||
.endif # (defined(__MINIX) && ${MKGCCCMDS} == "yes")
|
||||
.if (${MKLDAP} != "no")
|
||||
SUBDIR+= openldap
|
||||
.endif
|
||||
|
|
2
external/bsd/kyua-cli/config.h
vendored
2
external/bsd/kyua-cli/config.h
vendored
|
@ -68,7 +68,7 @@
|
|||
#define MEMORY_QUERY_SYSCTL_MIB "hw.usermem64"
|
||||
|
||||
/* Define to the memory query type */
|
||||
#define MEMORY_QUERY_TYPE "sysctlbyname"
|
||||
#define MEMORY_QUERY_TYPE "sysctl"
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "kyua-cli"
|
||||
|
|
3
external/bsd/kyua-cli/lib/engine/Makefile
vendored
3
external/bsd/kyua-cli/lib/engine/Makefile
vendored
|
@ -29,4 +29,7 @@ SRCS+= debug_test.cpp \
|
|||
run_tests.cpp \
|
||||
scan_action.cpp
|
||||
|
||||
.if defined(__MINIX)
|
||||
NOCLANGERROR= yes
|
||||
.endif # defined(__MINIX)
|
||||
.include <bsd.lib.mk>
|
||||
|
|
5
external/bsd/libc++/Makefile
vendored
Normal file
5
external/bsd/libc++/Makefile
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/04/27 23:02:21 joerg Exp $
|
||||
|
||||
SUBDIR= include lib
|
||||
|
||||
.include <bsd.subdir.mk>
|
11
external/bsd/libc++/Makefile.inc
vendored
Normal file
11
external/bsd/libc++/Makefile.inc
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 2013/04/27 23:02:21 joerg Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
LIBCXXRT_SRCDIR:= ${.PARSEDIR}/dist/libcxxrt
|
||||
LIBCXX_SRCDIR:= ${.PARSEDIR}/dist/libcxx
|
||||
|
||||
.if defined(__MINIX)
|
||||
LDADD+= -lmthread
|
||||
DPADD+= ${LIBMTHREAD}
|
||||
.endif # defined(__MINIX)
|
123
external/bsd/libc++/dist/libcxx/CREDITS.TXT
vendored
Normal file
123
external/bsd/libc++/dist/libcxx/CREDITS.TXT
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
This file is a partial list of people who have contributed to the LLVM/libc++
|
||||
project. If you have contributed a patch or made some other contribution to
|
||||
LLVM/libc++, please submit a patch to this file to add yourself, and it will be
|
||||
done!
|
||||
|
||||
The list is sorted by surname and formatted to allow easy grepping and
|
||||
beautification by scripts. The fields are: name (N), email (E), web-address
|
||||
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
|
||||
(S).
|
||||
|
||||
N: Saleem Abdulrasool
|
||||
E: compnerd@compnerd.org
|
||||
D: Minor patches and Linux fixes.
|
||||
|
||||
N: Dimitry Andric
|
||||
E: dimitry@andric.com
|
||||
D: Visibility fixes, minor FreeBSD portability patches.
|
||||
|
||||
N: Holger Arnold
|
||||
E: holgerar@gmail.com
|
||||
D: Minor fix.
|
||||
|
||||
N: Ruben Van Boxem
|
||||
E: vanboxem dot ruben at gmail dot com
|
||||
D: Initial Windows patches.
|
||||
|
||||
N: David Chisnall
|
||||
E: theraven at theravensnest dot org
|
||||
D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
|
||||
|
||||
N: Marshall Clow
|
||||
E: mclow.lists@gmail.com
|
||||
E: marshall@idio.com
|
||||
D: C++14 support, patches and bug fixes.
|
||||
|
||||
N: Bill Fisher
|
||||
E: william.w.fisher@gmail.com
|
||||
D: Regex bug fixes.
|
||||
|
||||
N: Matthew Dempsky
|
||||
E: matthew@dempsky.org
|
||||
D: Minor patches and bug fixes.
|
||||
|
||||
N: Google Inc.
|
||||
D: Copyright owner and contributor of the CityHash algorithm
|
||||
|
||||
N: Howard Hinnant
|
||||
E: hhinnant@apple.com
|
||||
D: Architect and primary author of libc++
|
||||
|
||||
N: Hyeon-bin Jeong
|
||||
E: tuhertz@gmail.com
|
||||
D: Minor patches and bug fixes.
|
||||
|
||||
N: Argyrios Kyrtzidis
|
||||
E: kyrtzidis@apple.com
|
||||
D: Bug fixes.
|
||||
|
||||
N: Bruce Mitchener, Jr.
|
||||
E: bruce.mitchener@gmail.com
|
||||
D: Emscripten-related changes.
|
||||
|
||||
N: Michel Morin
|
||||
E: mimomorin@gmail.com
|
||||
D: Minor patches to is_convertible.
|
||||
|
||||
N: Andrew Morrow
|
||||
E: andrew.c.morrow@gmail.com
|
||||
D: Minor patches and Linux fixes.
|
||||
|
||||
N: Arvid Picciani
|
||||
E: aep at exys dot org
|
||||
D: Minor patches and musl port.
|
||||
|
||||
N: Bjorn Reese
|
||||
E: breese@users.sourceforge.net
|
||||
D: Initial regex prototype
|
||||
|
||||
N: Nico Rieck
|
||||
E: nico.rieck@gmail.com
|
||||
D: Windows fixes
|
||||
|
||||
N: Jonathan Sauer
|
||||
D: Minor patches, mostly related to constexpr
|
||||
|
||||
N: Craig Silverstein
|
||||
E: csilvers@google.com
|
||||
D: Implemented Cityhash as the string hash function on 64-bit machines
|
||||
|
||||
N: Richard Smith
|
||||
D: Minor patches.
|
||||
|
||||
N: Joerg Sonnenberger
|
||||
E: joerg@NetBSD.org
|
||||
D: NetBSD port.
|
||||
|
||||
N: Stephan Tolksdorf
|
||||
E: st@quanttec.com
|
||||
D: Minor <atomic> fix
|
||||
|
||||
N: Michael van der Westhuizen
|
||||
E: r1mikey at gmail dot com
|
||||
|
||||
N: Klaas de Vries
|
||||
E: klaas at klaasgaaf dot nl
|
||||
D: Minor bug fix.
|
||||
|
||||
N: Zhang Xiongpang
|
||||
E: zhangxiongpang@gmail.com
|
||||
D: Minor patches and bug fixes.
|
||||
|
||||
N: Xing Xue
|
||||
E: xingxue@ca.ibm.com
|
||||
D: AIX port
|
||||
|
||||
N: Zhihao Yuan
|
||||
E: lichray@gmail.com
|
||||
D: Standard compatibility fixes.
|
||||
|
||||
N: Jeffrey Yasskin
|
||||
E: jyasskin@gmail.com
|
||||
E: jyasskin@google.com
|
||||
D: Linux fixes.
|
76
external/bsd/libc++/dist/libcxx/LICENSE.TXT
vendored
Normal file
76
external/bsd/libc++/dist/libcxx/LICENSE.TXT
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
==============================================================================
|
||||
libc++ License
|
||||
==============================================================================
|
||||
|
||||
The libc++ library is dual licensed under both the University of Illinois
|
||||
"BSD-Like" license and the MIT license. As a user of this code you may choose
|
||||
to use it under either license. As a contributor, you agree to allow your code
|
||||
to be used under both.
|
||||
|
||||
Full text of the relevant licenses is included below.
|
||||
|
||||
==============================================================================
|
||||
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
|
||||
LLVM Team
|
||||
|
||||
University of Illinois at Urbana-Champaign
|
||||
|
||||
http://llvm.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the LLVM Team, University of Illinois at
|
||||
Urbana-Champaign, nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this Software without specific
|
||||
prior written permission.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
16
external/bsd/libc++/dist/libcxx/include/CMakeLists.txt
vendored
Normal file
16
external/bsd/libc++/dist/libcxx/include/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
|
||||
set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
|
||||
endif()
|
||||
|
||||
file(COPY .
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1"
|
||||
FILES_MATCHING
|
||||
PATTERN "*"
|
||||
PATTERN "CMakeLists.txt" EXCLUDE
|
||||
PATTERN ".svn" EXCLUDE
|
||||
${LIBCXX_SUPPORT_HEADER_PATTERN}
|
||||
)
|
||||
|
||||
install(DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1/"
|
||||
DESTINATION include/c++/v1/
|
||||
)
|
1287
external/bsd/libc++/dist/libcxx/include/__bit_reference
vendored
Normal file
1287
external/bsd/libc++/dist/libcxx/include/__bit_reference
vendored
Normal file
File diff suppressed because it is too large
Load diff
622
external/bsd/libc++/dist/libcxx/include/__config
vendored
Normal file
622
external/bsd/libc++/dist/libcxx/include/__config
vendored
Normal file
|
@ -0,0 +1,622 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- __config ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CONFIG
|
||||
#define _LIBCPP_CONFIG
|
||||
|
||||
#if !defined(_MSC_VER) || defined(__clang__)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 1101
|
||||
|
||||
#define _LIBCPP_ABI_VERSION 1
|
||||
|
||||
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
|
||||
#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
|
||||
|
||||
#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
|
||||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#if __LITTLE_ENDIAN__
|
||||
#define _LIBCPP_LITTLE_ENDIAN 1
|
||||
#define _LIBCPP_BIG_ENDIAN 0
|
||||
#endif // __LITTLE_ENDIAN__
|
||||
#endif // __LITTLE_ENDIAN__
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#if __BIG_ENDIAN__
|
||||
#define _LIBCPP_LITTLE_ENDIAN 0
|
||||
#define _LIBCPP_BIG_ENDIAN 1
|
||||
#endif // __BIG_ENDIAN__
|
||||
#endif // __BIG_ENDIAN__
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
# include <sys/endian.h>
|
||||
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# else // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# ifndef __LONG_LONG_SUPPORTED
|
||||
# define _LIBCPP_HAS_NO_LONG_LONG
|
||||
# endif // __LONG_LONG_SUPPORTED
|
||||
#endif // __FreeBSD__
|
||||
|
||||
#if defined(__NetBSD__) || defined(__minix)
|
||||
# include <sys/endian.h>
|
||||
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# else // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
#endif // __NetBSD__
|
||||
|
||||
#ifdef _WIN32
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
// Compiler intrinsics (GCC or MSVC)
|
||||
# if defined(__clang__) \
|
||||
|| (defined(_MSC_VER) && _MSC_VER >= 1400) \
|
||||
|| (defined(__GNUC__) && _GNUC_VER > 403)
|
||||
# define _LIBCPP_HAS_IS_BASE_OF
|
||||
# endif
|
||||
# if defined(_MSC_VER) && !defined(__clang__)
|
||||
# define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
|
||||
# define _LIBCPP_TOSTRING2(x) #x
|
||||
# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
|
||||
# define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
|
||||
# endif
|
||||
# // If mingw not explicitly detected, assume using MS C runtime only.
|
||||
# ifndef __MINGW32__
|
||||
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
|
||||
# endif
|
||||
#endif // _WIN32
|
||||
|
||||
#ifdef __linux__
|
||||
# if defined(__GNUC__) && _GNUC_VER >= 403
|
||||
# define _LIBCPP_HAS_IS_BASE_OF
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __sun__
|
||||
# include <sys/isa_defs.h>
|
||||
# ifdef _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# else
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# endif
|
||||
#endif // __sun__
|
||||
|
||||
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
# include <endian.h>
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# else // __BYTE_ORDER == __BIG_ENDIAN
|
||||
# error unable to determine endian
|
||||
# endif
|
||||
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
// only really useful for a DLL
|
||||
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
|
||||
# ifdef cxx_EXPORTS
|
||||
# define _LIBCPP_HIDDEN
|
||||
# define _LIBCPP_FUNC_VIS __declspec(dllexport)
|
||||
# define _LIBCPP_TYPE_VIS __declspec(dllexport)
|
||||
# else
|
||||
# define _LIBCPP_HIDDEN
|
||||
# define _LIBCPP_FUNC_VIS __declspec(dllimport)
|
||||
# define _LIBCPP_TYPE_VIS __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define _LIBCPP_HIDDEN
|
||||
# define _LIBCPP_FUNC_VIS
|
||||
# define _LIBCPP_TYPE_VIS
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_TYPE_VIS_ONLY
|
||||
#define _LIBCPP_FUNC_VIS_ONLY
|
||||
|
||||
#ifndef _LIBCPP_INLINE_VISIBILITY
|
||||
# ifdef _LIBCPP_MSVC
|
||||
# define _LIBCPP_INLINE_VISIBILITY __forceinline
|
||||
# else // MinGW GCC and Clang
|
||||
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXCEPTION_ABI
|
||||
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_ALWAYS_INLINE
|
||||
# ifdef _LIBCPP_MSVC
|
||||
# define _LIBCPP_ALWAYS_INLINE __forceinline
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
#ifndef __has_attribute
|
||||
#define __has_attribute(__x) 0
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HIDDEN
|
||||
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_FUNC_VIS
|
||||
#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_TYPE_VIS
|
||||
# if __has_attribute(__type_visibility__)
|
||||
# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
|
||||
# else
|
||||
# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_TYPE_VIS_ONLY
|
||||
# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_FUNC_VIS_ONLY
|
||||
# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_INLINE_VISIBILITY
|
||||
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXCEPTION_ABI
|
||||
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_ALWAYS_INLINE
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
|
||||
#if __has_feature(cxx_alignas)
|
||||
# define _ALIGNAS_TYPE(x) alignas(x)
|
||||
# define _ALIGNAS(x) alignas(x)
|
||||
#else
|
||||
# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
||||
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_alias_templates)
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#endif
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
#ifdef __linux__
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#else
|
||||
typedef __char16_t char16_t;
|
||||
typedef __char32_t char32_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_exceptions))
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_rtti))
|
||||
#define _LIBCPP_NO_RTTI
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_strong_enums))
|
||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_decltype))
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_attributes)
|
||||
# define _LIBCPP_NORETURN [[noreturn]]
|
||||
#else
|
||||
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_defaulted_functions))
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#endif // !(__has_feature(cxx_defaulted_functions))
|
||||
|
||||
#if !(__has_feature(cxx_deleted_functions))
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#endif // !(__has_feature(cxx_deleted_functions))
|
||||
|
||||
#if !(__has_feature(cxx_lambdas))
|
||||
#define _LIBCPP_HAS_NO_LAMBDAS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_nullptr))
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_rvalue_references))
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_static_assert))
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_auto_type))
|
||||
#define _LIBCPP_HAS_NO_AUTO_TYPE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_variadic_templates))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_trailing_return))
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_generalized_initializers))
|
||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif
|
||||
|
||||
#if __has_feature(is_base_of)
|
||||
# define _LIBCPP_HAS_IS_BASE_OF
|
||||
#endif
|
||||
|
||||
// Objective-C++ features (opt-in)
|
||||
#if __has_feature(objc_arc)
|
||||
#define _LIBCPP_HAS_OBJC_ARC
|
||||
#endif
|
||||
|
||||
#if __has_feature(objc_arc_weak)
|
||||
#define _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_constexpr))
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#endif
|
||||
|
||||
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
|
||||
#if defined(__FreeBSD__)
|
||||
#define _LIBCPP_HAS_QUICK_EXIT
|
||||
#define _LIBCPP_HAS_C11_FEATURES
|
||||
#elif defined(__linux__)
|
||||
#include <features.h>
|
||||
#if __GLIBC_PREREQ(2, 15)
|
||||
#define _LIBCPP_HAS_QUICK_EXIT
|
||||
#endif
|
||||
#if __GLIBC_PREREQ(2, 17)
|
||||
#define _LIBCPP_HAS_C11_FEATURES
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (__has_feature(cxx_noexcept))
|
||||
# define _NOEXCEPT noexcept
|
||||
# define _NOEXCEPT_(x) noexcept(x)
|
||||
#else
|
||||
# define _NOEXCEPT throw()
|
||||
# define _NOEXCEPT_(x)
|
||||
#endif
|
||||
|
||||
#if __has_feature(underlying_type)
|
||||
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
|
||||
#endif
|
||||
|
||||
// Inline namespaces are available in Clang regardless of C++ dialect.
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
inline namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
||||
|
||||
#define _LIBCPP_NORETURN __attribute__((noreturn))
|
||||
|
||||
#if !__EXCEPTIONS
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
|
||||
#define _NOEXCEPT throw()
|
||||
#define _NOEXCEPT_(x)
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
|
||||
#else // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
|
||||
#if _GNUC_VER < 403
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if _GNUC_VER < 403
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if _GNUC_VER < 404
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif // _GNUC_VER < 404
|
||||
|
||||
#if _GNUC_VER < 406
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
#if _GNUC_VER < 407
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||
}
|
||||
|
||||
#elif defined(_LIBCPP_MSVC)
|
||||
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define __alignof__ __alignof
|
||||
#define _LIBCPP_NORETURN __declspec(noreturn)
|
||||
#define _ALIGNAS(x) __declspec(align(x))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#define _NOEXCEPT throw()
|
||||
#define _NOEXCEPT_(x)
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
|
||||
#define _LIBCPP_END_NAMESPACE_STD }
|
||||
#define _VSTD std
|
||||
|
||||
# define _LIBCPP_WEAK
|
||||
namespace std {
|
||||
}
|
||||
|
||||
#elif defined(__IBMCPP__)
|
||||
|
||||
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
||||
#define _ATTRIBUTE(x) __attribute__((x))
|
||||
#define _LIBCPP_NORETURN __attribute__((noreturn))
|
||||
|
||||
#define _NOEXCEPT throw()
|
||||
#define _NOEXCEPT_(x)
|
||||
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_IS_BASE_OF
|
||||
|
||||
#if defined(_AIX)
|
||||
#define __MULTILOCALE_API
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
inline namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __clang__ || __GNUC___ || _MSC_VER || __IBMCPP__
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef unsigned short char16_t;
|
||||
typedef unsigned int char32_t;
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
|
||||
template <bool> struct __static_assert_test;
|
||||
template <> struct __static_assert_test<true> {};
|
||||
template <unsigned> struct __static_assert_check {};
|
||||
#define static_assert(__b, __m) \
|
||||
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
|
||||
_LIBCPP_CONCAT(__t, __LINE__)
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define decltype(x) __typeof__(x)
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#define _LIBCPP_CONSTEXPR
|
||||
#else
|
||||
#define _LIBCPP_CONSTEXPR constexpr
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_DEFAULT {}
|
||||
#else
|
||||
#define _LIBCPP_DEFAULT = default;
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define _NOALIAS __attribute__((__malloc__))
|
||||
#else
|
||||
#define _NOALIAS
|
||||
#endif
|
||||
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
|
||||
# define _LIBCPP_EXPLICIT explicit
|
||||
#else
|
||||
# define _LIBCPP_EXPLICIT
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
|
||||
__lx __v_; \
|
||||
_LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
|
||||
_LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
|
||||
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
|
||||
};
|
||||
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
|
||||
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
# if _LIBCPP_DEBUG == 0
|
||||
# define _LIBCPP_DEBUG_LEVEL 1
|
||||
# elif _LIBCPP_DEBUG == 1
|
||||
# define _LIBCPP_DEBUG_LEVEL 2
|
||||
# else
|
||||
# error Supported values for _LIBCPP_DEBUG are 0 and 1
|
||||
# endif
|
||||
# define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE2
|
||||
#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__) ||defined(__minix)
|
||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#define _DECLARE_C99_LDBL_MATH 1
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
|
||||
#define _LIBCPP_WCTYPE_IS_MASK
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_STD_VER
|
||||
# if __cplusplus <= 201103L
|
||||
# define _LIBCPP_STD_VER 11
|
||||
# else
|
||||
# define _LIBCPP_STD_VER 13 // current year, or date of c++14 ratification
|
||||
# endif
|
||||
#endif // _LIBCPP_STD_VER
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
#define _LIBCPP_DEPRECATED [[deprecated]]
|
||||
#else
|
||||
#define _LIBCPP_DEPRECATED
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER <= 11
|
||||
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
#define _LIBCPP_EXPLICIT_AFTER_CXX11
|
||||
#define _LIBCPP_DEPRECATED_AFTER_CXX11
|
||||
#else
|
||||
#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
|
||||
#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
|
||||
#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
|
||||
#endif
|
||||
|
||||
// Try to find out if RTTI is disabled.
|
||||
// g++ and cl.exe have RTTI on by default and define a macro when it is.
|
||||
// g++ only defines the macro in 4.3.2 and onwards.
|
||||
#if !defined(_LIBCPP_NO_RTTI)
|
||||
# if defined(__GNUG__) && (__GNUC__ >= 4 && \
|
||||
(__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2)) && !defined(__GXX_RTTI)
|
||||
# define _LIBCPP_NO_RTTI
|
||||
# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
|
||||
# define _LIBCPP_NO_RTTI
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_WEAK
|
||||
# define _LIBCPP_WEAK __attribute__((__weak__))
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
218
external/bsd/libc++/dist/libcxx/include/__debug
vendored
Normal file
218
external/bsd/libc++/dist/libcxx/include/__debug
vendored
Normal file
|
@ -0,0 +1,218 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- __debug ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_DEBUG_H
|
||||
#define _LIBCPP_DEBUG_H
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 1
|
||||
|
||||
# include <cstdlib>
|
||||
# include <cstdio>
|
||||
# include <cstddef>
|
||||
# ifndef _LIBCPP_ASSERT
|
||||
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
struct _LIBCPP_TYPE_VIS __c_node;
|
||||
|
||||
struct _LIBCPP_TYPE_VIS __i_node
|
||||
{
|
||||
void* __i_;
|
||||
__i_node* __next_;
|
||||
__c_node* __c_;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
__i_node(const __i_node&) = delete;
|
||||
__i_node& operator=(const __i_node&) = delete;
|
||||
#else
|
||||
private:
|
||||
__i_node(const __i_node&);
|
||||
__i_node& operator=(const __i_node&);
|
||||
public:
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__i_node(void* __i, __i_node* __next, __c_node* __c)
|
||||
: __i_(__i), __next_(__next), __c_(__c) {}
|
||||
~__i_node();
|
||||
};
|
||||
|
||||
struct _LIBCPP_TYPE_VIS __c_node
|
||||
{
|
||||
void* __c_;
|
||||
__c_node* __next_;
|
||||
__i_node** beg_;
|
||||
__i_node** end_;
|
||||
__i_node** cap_;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
__c_node(const __c_node&) = delete;
|
||||
__c_node& operator=(const __c_node&) = delete;
|
||||
#else
|
||||
private:
|
||||
__c_node(const __c_node&);
|
||||
__c_node& operator=(const __c_node&);
|
||||
public:
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__c_node(void* __c, __c_node* __next)
|
||||
: __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
|
||||
virtual ~__c_node();
|
||||
|
||||
virtual bool __dereferenceable(const void*) const = 0;
|
||||
virtual bool __decrementable(const void*) const = 0;
|
||||
virtual bool __addable(const void*, ptrdiff_t) const = 0;
|
||||
virtual bool __subscriptable(const void*, ptrdiff_t) const = 0;
|
||||
|
||||
void __add(__i_node* __i);
|
||||
_LIBCPP_HIDDEN void __remove(__i_node* __i);
|
||||
};
|
||||
|
||||
template <class _Cont>
|
||||
struct _C_node
|
||||
: public __c_node
|
||||
{
|
||||
_C_node(void* __c, __c_node* __n)
|
||||
: __c_node(__c, __n) {}
|
||||
|
||||
virtual bool __dereferenceable(const void*) const;
|
||||
virtual bool __decrementable(const void*) const;
|
||||
virtual bool __addable(const void*, ptrdiff_t) const;
|
||||
virtual bool __subscriptable(const void*, ptrdiff_t) const;
|
||||
};
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__dereferenceable(const void* __i) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__dereferenceable(__j);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__decrementable(const void* __i) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__decrementable(__j);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__addable(__j, __n);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__subscriptable(__j, __n);
|
||||
}
|
||||
|
||||
class _LIBCPP_TYPE_VIS __libcpp_db
|
||||
{
|
||||
__c_node** __cbeg_;
|
||||
__c_node** __cend_;
|
||||
size_t __csz_;
|
||||
__i_node** __ibeg_;
|
||||
__i_node** __iend_;
|
||||
size_t __isz_;
|
||||
|
||||
__libcpp_db();
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
__libcpp_db(const __libcpp_db&) = delete;
|
||||
__libcpp_db& operator=(const __libcpp_db&) = delete;
|
||||
#else
|
||||
private:
|
||||
__libcpp_db(const __libcpp_db&);
|
||||
__libcpp_db& operator=(const __libcpp_db&);
|
||||
public:
|
||||
#endif
|
||||
~__libcpp_db();
|
||||
|
||||
class __db_c_iterator;
|
||||
class __db_c_const_iterator;
|
||||
class __db_i_iterator;
|
||||
class __db_i_const_iterator;
|
||||
|
||||
__db_c_const_iterator __c_end() const;
|
||||
__db_i_const_iterator __i_end() const;
|
||||
|
||||
template <class _Cont>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __insert_c(_Cont* __c)
|
||||
{
|
||||
__c_node* __n = __insert_c(static_cast<void*>(__c));
|
||||
::new(__n) _C_node<_Cont>(__n->__c_, __n->__next_);
|
||||
}
|
||||
|
||||
void __insert_i(void* __i);
|
||||
__c_node* __insert_c(void* __c);
|
||||
void __erase_c(void* __c);
|
||||
|
||||
void __insert_ic(void* __i, const void* __c);
|
||||
void __iterator_copy(void* __i, const void* __i0);
|
||||
void __erase_i(void* __i);
|
||||
|
||||
void* __find_c_from_i(void* __i) const;
|
||||
void __invalidate_all(void* __c);
|
||||
__c_node* __find_c_and_lock(void* __c) const;
|
||||
__c_node* __find_c(void* __c) const;
|
||||
void unlock() const;
|
||||
|
||||
void swap(void* __c1, void* __c2);
|
||||
|
||||
|
||||
bool __dereferenceable(const void* __i) const;
|
||||
bool __decrementable(const void* __i) const;
|
||||
bool __addable(const void* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const void* __i, ptrdiff_t __n) const;
|
||||
bool __less_than_comparable(const void* __i, const void* __j) const;
|
||||
private:
|
||||
_LIBCPP_HIDDEN
|
||||
__i_node* __insert_iterator(void* __i);
|
||||
_LIBCPP_HIDDEN
|
||||
__i_node* __find_iterator(const void* __i) const;
|
||||
|
||||
friend _LIBCPP_FUNC_VIS __libcpp_db* __get_db();
|
||||
};
|
||||
|
||||
_LIBCPP_FUNC_VIS __libcpp_db* __get_db();
|
||||
_LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_DEBUG_H
|
||||
|
2130
external/bsd/libc++/dist/libcxx/include/__functional_03
vendored
Normal file
2130
external/bsd/libc++/dist/libcxx/include/__functional_03
vendored
Normal file
File diff suppressed because it is too large
Load diff
615
external/bsd/libc++/dist/libcxx/include/__functional_base
vendored
Normal file
615
external/bsd/libc++/dist/libcxx/include/__functional_base
vendored
Normal file
|
@ -0,0 +1,615 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_FUNCTIONAL_BASE
|
||||
#define _LIBCPP_FUNCTIONAL_BASE
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
#include <typeinfo>
|
||||
#include <exception>
|
||||
#include <new>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY unary_function
|
||||
{
|
||||
typedef _Arg argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY binary_function
|
||||
{
|
||||
typedef _Arg1 first_argument_type;
|
||||
typedef _Arg2 second_argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash;
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_result_type
|
||||
{
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::result_type* = 0);
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class _Tp = void>
|
||||
#else
|
||||
template <class _Tp>
|
||||
#endif
|
||||
struct _LIBCPP_TYPE_VIS_ONLY less : binary_function<_Tp, _Tp, bool>
|
||||
{
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const _Tp& __y) const
|
||||
{return __x < __y;}
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY less<void>
|
||||
{
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
|
||||
// addressof
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
addressof(_Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
|
||||
}
|
||||
|
||||
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
|
||||
// Objective-C++ Automatic Reference Counting uses qualified pointers
|
||||
// that require special addressof() signatures. When
|
||||
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
|
||||
// itself is providing these definitions. Otherwise, we provide them.
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__strong _Tp*
|
||||
addressof(__strong _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__weak _Tp*
|
||||
addressof(__weak _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__autoreleasing _Tp*
|
||||
addressof(__autoreleasing _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__unsafe_unretained _Tp*
|
||||
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#include <__functional_base_03>
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
// __weak_result_type
|
||||
|
||||
template <class _Tp>
|
||||
struct __derives_from_unary_function
|
||||
{
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
static __two __test(...);
|
||||
template <class _Ap, class _Rp>
|
||||
static unary_function<_Ap, _Rp>
|
||||
__test(const volatile unary_function<_Ap, _Rp>*);
|
||||
public:
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __derives_from_binary_function
|
||||
{
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
static __two __test(...);
|
||||
template <class _A1, class _A2, class _Rp>
|
||||
static binary_function<_A1, _A2, _Rp>
|
||||
__test(const volatile binary_function<_A1, _A2, _Rp>*);
|
||||
public:
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
};
|
||||
|
||||
template <class _Tp, bool = __derives_from_unary_function<_Tp>::value>
|
||||
struct __maybe_derive_from_unary_function // bool is true
|
||||
: public __derives_from_unary_function<_Tp>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __maybe_derive_from_unary_function<_Tp, false>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, bool = __derives_from_binary_function<_Tp>::value>
|
||||
struct __maybe_derive_from_binary_function // bool is true
|
||||
: public __derives_from_binary_function<_Tp>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __maybe_derive_from_binary_function<_Tp, false>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, bool = __has_result_type<_Tp>::value>
|
||||
struct __weak_result_type_imp // bool is true
|
||||
: public __maybe_derive_from_unary_function<_Tp>,
|
||||
public __maybe_derive_from_binary_function<_Tp>
|
||||
{
|
||||
typedef typename _Tp::result_type result_type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __weak_result_type_imp<_Tp, false>
|
||||
: public __maybe_derive_from_unary_function<_Tp>,
|
||||
public __maybe_derive_from_binary_function<_Tp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __weak_result_type
|
||||
: public __weak_result_type_imp<_Tp>
|
||||
{
|
||||
};
|
||||
|
||||
// 0 argument case
|
||||
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp ()>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp (&)()>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp (*)()>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
// 1 argument case
|
||||
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (_A1)>
|
||||
: public unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (&)(_A1)>
|
||||
: public unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (*)(_A1)>
|
||||
: public unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)()>
|
||||
: public unary_function<_Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const>
|
||||
: public unary_function<const _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() volatile>
|
||||
: public unary_function<volatile _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const volatile>
|
||||
: public unary_function<const volatile _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
// 2 argument case
|
||||
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1)>
|
||||
: public binary_function<_Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
|
||||
: public binary_function<const _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
|
||||
: public binary_function<volatile _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
|
||||
: public binary_function<const volatile _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
// 3 or more arguments
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
// __invoke
|
||||
|
||||
// bullets 1 and 2
|
||||
|
||||
template <class _Fp, class _A0, class ..._Args,
|
||||
class>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _Fp, class _A0, class ..._Args,
|
||||
class>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
// bullets 3 and 4
|
||||
|
||||
template <class _Fp, class _A0,
|
||||
class>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_Fp&& __f, _A0&& __a0)
|
||||
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
|
||||
{
|
||||
return _VSTD::forward<_A0>(__a0).*__f;
|
||||
}
|
||||
|
||||
template <class _Fp, class _A0,
|
||||
class>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_Fp&& __f, _A0&& __a0)
|
||||
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
|
||||
{
|
||||
return (*_VSTD::forward<_A0>(__a0)).*__f;
|
||||
}
|
||||
|
||||
// bullet 5
|
||||
|
||||
template <class _Fp, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_Fp&& __f, _Args&& ...__args)
|
||||
-> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _Tp, class ..._Args>
|
||||
struct __invoke_return
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
|
||||
: public __weak_result_type<_Tp>
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef _Tp type;
|
||||
private:
|
||||
type* __f_;
|
||||
|
||||
public:
|
||||
// construct/copy/destroy
|
||||
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
|
||||
: __f_(_VSTD::addressof(__f)) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
|
||||
#endif
|
||||
|
||||
// access
|
||||
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
|
||||
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_of<type&, _ArgTypes...>::type
|
||||
operator() (_ArgTypes&&... __args) const
|
||||
{
|
||||
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp> struct ____is_reference_wrapper : public false_type {};
|
||||
template <class _Tp> struct ____is_reference_wrapper<reference_wrapper<_Tp> > : public true_type {};
|
||||
template <class _Tp> struct __is_reference_wrapper
|
||||
: public ____is_reference_wrapper<typename remove_cv<_Tp>::type> {};
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<_Tp>
|
||||
ref(_Tp& __t) _NOEXCEPT
|
||||
{
|
||||
return reference_wrapper<_Tp>(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<_Tp>
|
||||
ref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
return ref(__t.get());
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<const _Tp>
|
||||
cref(const _Tp& __t) _NOEXCEPT
|
||||
{
|
||||
return reference_wrapper<const _Tp>(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<const _Tp>
|
||||
cref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
return cref(__t.get());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
template <class _Tp> void ref(const _Tp&&) = delete;
|
||||
template <class _Tp> void cref(const _Tp&&) = delete;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
template <class _Tp> void ref(const _Tp&&);// = delete;
|
||||
template <class _Tp> void cref(const _Tp&&);// = delete;
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class _Tp1, class _Tp2 = void>
|
||||
struct __is_transparent
|
||||
{
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::is_transparent* = 0);
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp1>(0)) == 1;
|
||||
};
|
||||
#endif
|
||||
|
||||
// allocator_arg_t
|
||||
|
||||
struct _LIBCPP_TYPE_VIS_ONLY allocator_arg_t { };
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
|
||||
extern const allocator_arg_t allocator_arg;
|
||||
#else
|
||||
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
|
||||
#endif
|
||||
|
||||
// uses_allocator
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_allocator_type
|
||||
{
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::allocator_type* = 0);
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
|
||||
struct __uses_allocator
|
||||
: public integral_constant<bool,
|
||||
is_convertible<_Alloc, typename _Tp::allocator_type>::value>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
struct __uses_allocator<_Tp, _Alloc, false>
|
||||
: public false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator
|
||||
: public __uses_allocator<_Tp, _Alloc>
|
||||
{
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
// allocator construction
|
||||
|
||||
template <class _Tp, class _Alloc, class ..._Args>
|
||||
struct __uses_alloc_ctor_imp
|
||||
{
|
||||
static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
|
||||
static const bool __ic =
|
||||
is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
|
||||
static const int value = __ua ? 2 - __ic : 0;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Alloc, class ..._Args>
|
||||
struct __uses_alloc_ctor
|
||||
: integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
|
||||
{};
|
||||
|
||||
template <class _Tp, class _Allocator, class... _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
|
||||
{
|
||||
new (__storage) _Tp (_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator, class... _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
|
||||
{
|
||||
new (__storage) _Tp (allocator_arg, __a, _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator, class... _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
|
||||
{
|
||||
new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator, class... _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __args)
|
||||
{
|
||||
__user_alloc_construct_impl(
|
||||
__uses_alloc_ctor<_Tp, _Allocator>(),
|
||||
__storage, __a, _VSTD::forward<_Args>(__args)...
|
||||
);
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_FUNCTIONAL_BASE
|
1087
external/bsd/libc++/dist/libcxx/include/__functional_base_03
vendored
Normal file
1087
external/bsd/libc++/dist/libcxx/include/__functional_base_03
vendored
Normal file
File diff suppressed because it is too large
Load diff
2457
external/bsd/libc++/dist/libcxx/include/__hash_table
vendored
Normal file
2457
external/bsd/libc++/dist/libcxx/include/__hash_table
vendored
Normal file
File diff suppressed because it is too large
Load diff
1445
external/bsd/libc++/dist/libcxx/include/__locale
vendored
Normal file
1445
external/bsd/libc++/dist/libcxx/include/__locale
vendored
Normal file
File diff suppressed because it is too large
Load diff
412
external/bsd/libc++/dist/libcxx/include/__mutex_base
vendored
Normal file
412
external/bsd/libc++/dist/libcxx/include/__mutex_base
vendored
Normal file
|
@ -0,0 +1,412 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___MUTEX_BASE
|
||||
#define _LIBCPP___MUTEX_BASE
|
||||
|
||||
#include <__config>
|
||||
#include <chrono>
|
||||
#include <system_error>
|
||||
#if !defined(__minix)
|
||||
#include <pthread.h>
|
||||
#else
|
||||
#define _MTHREADIFY_PTHREADS 1
|
||||
#include <minix/mthread.h>
|
||||
#endif /* !defined(__minix) */
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_TYPE_VIS mutex
|
||||
{
|
||||
pthread_mutex_t __m_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
|
||||
#else
|
||||
mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
|
||||
#endif
|
||||
~mutex();
|
||||
|
||||
private:
|
||||
mutex(const mutex&);// = delete;
|
||||
mutex& operator=(const mutex&);// = delete;
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock() _NOEXCEPT;
|
||||
void unlock() _NOEXCEPT;
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
|
||||
};
|
||||
|
||||
struct _LIBCPP_TYPE_VIS defer_lock_t {};
|
||||
struct _LIBCPP_TYPE_VIS try_to_lock_t {};
|
||||
struct _LIBCPP_TYPE_VIS adopt_lock_t {};
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX)
|
||||
|
||||
extern const defer_lock_t defer_lock;
|
||||
extern const try_to_lock_t try_to_lock;
|
||||
extern const adopt_lock_t adopt_lock;
|
||||
|
||||
#else
|
||||
|
||||
constexpr defer_lock_t defer_lock = defer_lock_t();
|
||||
constexpr try_to_lock_t try_to_lock = try_to_lock_t();
|
||||
constexpr adopt_lock_t adopt_lock = adopt_lock_t();
|
||||
|
||||
#endif
|
||||
|
||||
template <class _Mutex>
|
||||
class _LIBCPP_TYPE_VIS_ONLY lock_guard
|
||||
{
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
|
||||
private:
|
||||
mutex_type& __m_;
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit lock_guard(mutex_type& __m)
|
||||
: __m_(__m) {__m_.lock();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
lock_guard(mutex_type& __m, adopt_lock_t)
|
||||
: __m_(__m) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~lock_guard() {__m_.unlock();}
|
||||
|
||||
private:
|
||||
lock_guard(lock_guard const&);// = delete;
|
||||
lock_guard& operator=(lock_guard const&);// = delete;
|
||||
};
|
||||
|
||||
template <class _Mutex>
|
||||
class _LIBCPP_TYPE_VIS_ONLY unique_lock
|
||||
{
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
|
||||
private:
|
||||
mutex_type* __m_;
|
||||
bool __owns_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit unique_lock(mutex_type& __m)
|
||||
: __m_(&__m), __owns_(true) {__m_->lock();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
|
||||
: __m_(&__m), __owns_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, try_to_lock_t)
|
||||
: __m_(&__m), __owns_(__m.try_lock()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, adopt_lock_t)
|
||||
: __m_(&__m), __owns_(true) {}
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t)
|
||||
: __m_(&__m), __owns_(__m.try_lock_until(__t)) {}
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d)
|
||||
: __m_(&__m), __owns_(__m.try_lock_for(__d)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~unique_lock()
|
||||
{
|
||||
if (__owns_)
|
||||
__m_->unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
unique_lock(unique_lock const&); // = delete;
|
||||
unique_lock& operator=(unique_lock const&); // = delete;
|
||||
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(unique_lock&& __u) _NOEXCEPT
|
||||
: __m_(__u.__m_), __owns_(__u.__owns_)
|
||||
{__u.__m_ = nullptr; __u.__owns_ = false;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock& operator=(unique_lock&& __u) _NOEXCEPT
|
||||
{
|
||||
if (__owns_)
|
||||
__m_->unlock();
|
||||
__m_ = __u.__m_;
|
||||
__owns_ = __u.__owns_;
|
||||
__u.__m_ = nullptr;
|
||||
__u.__owns_ = false;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d);
|
||||
template <class _Clock, class _Duration>
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
||||
void unlock();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(unique_lock& __u) _NOEXCEPT
|
||||
{
|
||||
_VSTD::swap(__m_, __u.__m_);
|
||||
_VSTD::swap(__owns_, __u.__owns_);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* release() _NOEXCEPT
|
||||
{
|
||||
mutex_type* __m = __m_;
|
||||
__m_ = nullptr;
|
||||
__owns_ = false;
|
||||
return __m;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool owns_lock() const _NOEXCEPT {return __owns_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool () const _NOEXCEPT {return __owns_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* mutex() const _NOEXCEPT {return __m_;}
|
||||
};
|
||||
|
||||
template <class _Mutex>
|
||||
void
|
||||
unique_lock<_Mutex>::lock()
|
||||
{
|
||||
if (__m_ == nullptr)
|
||||
__throw_system_error(EPERM, "unique_lock::lock: references null mutex");
|
||||
if (__owns_)
|
||||
__throw_system_error(EDEADLK, "unique_lock::lock: already locked");
|
||||
__m_->lock();
|
||||
__owns_ = true;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
bool
|
||||
unique_lock<_Mutex>::try_lock()
|
||||
{
|
||||
if (__m_ == nullptr)
|
||||
__throw_system_error(EPERM, "unique_lock::try_lock: references null mutex");
|
||||
if (__owns_)
|
||||
__throw_system_error(EDEADLK, "unique_lock::try_lock: already locked");
|
||||
__owns_ = __m_->try_lock();
|
||||
return __owns_;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
template <class _Rep, class _Period>
|
||||
bool
|
||||
unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
if (__m_ == nullptr)
|
||||
__throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex");
|
||||
if (__owns_)
|
||||
__throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked");
|
||||
__owns_ = __m_->try_lock_for(__d);
|
||||
return __owns_;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
template <class _Clock, class _Duration>
|
||||
bool
|
||||
unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
if (__m_ == nullptr)
|
||||
__throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex");
|
||||
if (__owns_)
|
||||
__throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked");
|
||||
__owns_ = __m_->try_lock_until(__t);
|
||||
return __owns_;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
void
|
||||
unique_lock<_Mutex>::unlock()
|
||||
{
|
||||
if (!__owns_)
|
||||
__throw_system_error(EPERM, "unique_lock::unlock: not locked");
|
||||
__m_->unlock();
|
||||
__owns_ = false;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) _NOEXCEPT
|
||||
{__x.swap(__y);}
|
||||
|
||||
struct _LIBCPP_TYPE_VIS cv_status
|
||||
{
|
||||
enum __lx {
|
||||
no_timeout,
|
||||
timeout
|
||||
};
|
||||
|
||||
__lx __v_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY cv_status(__lx __v) : __v_(__v) {}
|
||||
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
|
||||
|
||||
};
|
||||
|
||||
class _LIBCPP_TYPE_VIS condition_variable
|
||||
{
|
||||
pthread_cond_t __cv_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
constexpr condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {}
|
||||
#else
|
||||
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
|
||||
#endif
|
||||
~condition_variable();
|
||||
|
||||
private:
|
||||
condition_variable(const condition_variable&); // = delete;
|
||||
condition_variable& operator=(const condition_variable&); // = delete;
|
||||
|
||||
public:
|
||||
void notify_one() _NOEXCEPT;
|
||||
void notify_all() _NOEXCEPT;
|
||||
|
||||
void wait(unique_lock<mutex>& __lk);
|
||||
template <class _Predicate>
|
||||
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
||||
template <class _Clock, class _Duration, class _Predicate>
|
||||
bool
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred);
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
cv_status
|
||||
wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d);
|
||||
|
||||
template <class _Rep, class _Period, class _Predicate>
|
||||
bool
|
||||
wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred);
|
||||
|
||||
typedef pthread_cond_t* native_handle_type;
|
||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;}
|
||||
|
||||
private:
|
||||
void __do_timed_wait(unique_lock<mutex>& __lk,
|
||||
chrono::time_point<chrono::system_clock, chrono::nanoseconds>);
|
||||
};
|
||||
|
||||
template <class _To, class _Rep, class _Period>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
chrono::__is_duration<_To>::value,
|
||||
_To
|
||||
>::type
|
||||
__ceil(chrono::duration<_Rep, _Period> __d)
|
||||
{
|
||||
using namespace chrono;
|
||||
_To __r = duration_cast<_To>(__d);
|
||||
if (__r < __d)
|
||||
++__r;
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Predicate>
|
||||
void
|
||||
condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
|
||||
{
|
||||
while (!__pred())
|
||||
wait(__lk);
|
||||
}
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
cv_status
|
||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
wait_for(__lk, __t - _Clock::now());
|
||||
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
|
||||
}
|
||||
|
||||
template <class _Clock, class _Duration, class _Predicate>
|
||||
bool
|
||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred)
|
||||
{
|
||||
while (!__pred())
|
||||
{
|
||||
if (wait_until(__lk, __t) == cv_status::timeout)
|
||||
return __pred();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
cv_status
|
||||
condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
using namespace chrono;
|
||||
if (__d <= __d.zero())
|
||||
return cv_status::timeout;
|
||||
typedef time_point<system_clock, duration<long double, nano> > __sys_tpf;
|
||||
typedef time_point<system_clock, nanoseconds> __sys_tpi;
|
||||
__sys_tpf _Max = __sys_tpi::max();
|
||||
system_clock::time_point __s_now = system_clock::now();
|
||||
steady_clock::time_point __c_now = steady_clock::now();
|
||||
if (_Max - __d > __s_now)
|
||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
||||
else
|
||||
__do_timed_wait(__lk, __sys_tpi::max());
|
||||
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
}
|
||||
|
||||
template <class _Rep, class _Period, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lk, chrono::steady_clock::now() + __d,
|
||||
_VSTD::move(__pred));
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___MUTEX_BASE
|
654
external/bsd/libc++/dist/libcxx/include/__split_buffer
vendored
Normal file
654
external/bsd/libc++/dist/libcxx/include/__split_buffer
vendored
Normal file
|
@ -0,0 +1,654 @@
|
|||
// -*- C++ -*-
|
||||
#ifndef _LIBCPP_SPLIT_BUFFER
|
||||
#define _LIBCPP_SPLIT_BUFFER
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <bool>
|
||||
class __split_buffer_common
|
||||
{
|
||||
protected:
|
||||
void __throw_length_error() const;
|
||||
void __throw_out_of_range() const;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Allocator = allocator<_Tp> >
|
||||
struct __split_buffer
|
||||
: private __split_buffer_common<true>
|
||||
{
|
||||
private:
|
||||
__split_buffer(const __split_buffer&);
|
||||
__split_buffer& operator=(const __split_buffer&);
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef typename remove_reference<allocator_type>::type __alloc_rr;
|
||||
typedef allocator_traits<__alloc_rr> __alloc_traits;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef typename __alloc_traits::size_type size_type;
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
typedef typename __alloc_traits::pointer pointer;
|
||||
typedef typename __alloc_traits::const_pointer const_pointer;
|
||||
typedef pointer iterator;
|
||||
typedef const_pointer const_iterator;
|
||||
|
||||
pointer __first_;
|
||||
pointer __begin_;
|
||||
pointer __end_;
|
||||
__compressed_pair<pointer, allocator_type> __end_cap_;
|
||||
|
||||
typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref;
|
||||
typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
|
||||
|
||||
__split_buffer()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
||||
explicit __split_buffer(__alloc_rr& __a);
|
||||
explicit __split_buffer(const __alloc_rr& __a);
|
||||
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
|
||||
~__split_buffer();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
|
||||
__split_buffer& operator=(__split_buffer&& __c)
|
||||
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value) ||
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __end_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __end_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT
|
||||
{__destruct_at_end(__begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type __front_spare() const {return static_cast<size_type>(__begin_ - __first_);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type __back_spare() const {return static_cast<size_type>(__end_cap() - __end_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference front() {return *__begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return *__begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference back() {return *(__end_ - 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);}
|
||||
|
||||
void reserve(size_type __n);
|
||||
void shrink_to_fit() _NOEXCEPT;
|
||||
void push_front(const_reference __x);
|
||||
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
void push_front(value_type&& __x);
|
||||
void push_back(value_type&& __x);
|
||||
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class... _Args>
|
||||
void emplace_back(_Args&&... __args);
|
||||
#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
|
||||
|
||||
void __construct_at_end(size_type __n);
|
||||
void __construct_at_end(size_type __n, const_reference __x);
|
||||
template <class _InputIter>
|
||||
typename enable_if
|
||||
<
|
||||
__is_input_iterator<_InputIter>::value &&
|
||||
!__is_forward_iterator<_InputIter>::value,
|
||||
void
|
||||
>::type
|
||||
__construct_at_end(_InputIter __first, _InputIter __last);
|
||||
template <class _ForwardIterator>
|
||||
typename enable_if
|
||||
<
|
||||
__is_forward_iterator<_ForwardIterator>::value,
|
||||
void
|
||||
>::type
|
||||
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
|
||||
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
|
||||
void __destruct_at_begin(pointer __new_begin, false_type);
|
||||
void __destruct_at_begin(pointer __new_begin, true_type);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __destruct_at_end(pointer __new_last) _NOEXCEPT
|
||||
{__destruct_at_end(__new_last, false_type());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
|
||||
|
||||
void swap(__split_buffer& __x)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value);
|
||||
|
||||
bool __invariants() const;
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__split_buffer& __c, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
||||
{
|
||||
__alloc() = _VSTD::move(__c.__alloc());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_swap::value>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
bool
|
||||
__split_buffer<_Tp, _Allocator>::__invariants() const
|
||||
{
|
||||
if (__first_ == nullptr)
|
||||
{
|
||||
if (__begin_ != nullptr)
|
||||
return false;
|
||||
if (__end_ != nullptr)
|
||||
return false;
|
||||
if (__end_cap() != nullptr)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__begin_ < __first_)
|
||||
return false;
|
||||
if (__end_ < __begin_)
|
||||
return false;
|
||||
if (__end_cap() < __end_)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Default constructs __n objects starting at __end_
|
||||
// throws if construction throws
|
||||
// Precondition: __n > 0
|
||||
// Precondition: size() + __n <= capacity()
|
||||
// Postcondition: size() == size() + __n
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
do
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
|
||||
++this->__end_;
|
||||
--__n;
|
||||
} while (__n > 0);
|
||||
}
|
||||
|
||||
// Copy constructs __n objects starting at __end_ from __x
|
||||
// throws if construction throws
|
||||
// Precondition: __n > 0
|
||||
// Precondition: size() + __n <= capacity()
|
||||
// Postcondition: size() == old size() + __n
|
||||
// Postcondition: [i] == __x for all i in [size() - __n, __n)
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
do
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
|
||||
++this->__end_;
|
||||
--__n;
|
||||
} while (__n > 0);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _InputIter>
|
||||
typename enable_if
|
||||
<
|
||||
__is_input_iterator<_InputIter>::value &&
|
||||
!__is_forward_iterator<_InputIter>::value,
|
||||
void
|
||||
>::type
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
for (; __first != __last; ++__first)
|
||||
{
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
size_type __old_cap = __end_cap() - __first_;
|
||||
size_type __new_cap = _VSTD::max<size_type>(2 * __old_cap, 8);
|
||||
__split_buffer __buf(__new_cap, 0, __a);
|
||||
for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
|
||||
__alloc_traits::construct(__buf.__alloc(),
|
||||
_VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));
|
||||
swap(__buf);
|
||||
}
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
|
||||
++this->__end_;
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _ForwardIterator>
|
||||
typename enable_if
|
||||
<
|
||||
__is_forward_iterator<_ForwardIterator>::value,
|
||||
void
|
||||
>::type
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
for (; __first != __last; ++__first)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
|
||||
++this->__end_;
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
|
||||
{
|
||||
while (__begin_ != __new_begin)
|
||||
__alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
|
||||
{
|
||||
__begin_ = __new_begin;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
|
||||
{
|
||||
while (__new_last != __end_)
|
||||
__alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
|
||||
{
|
||||
__end_ = __new_last;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
|
||||
: __end_cap_(nullptr, __a)
|
||||
{
|
||||
__first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
|
||||
__begin_ = __end_ = __first_ + __start;
|
||||
__end_cap() = __first_ + __cap;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
|
||||
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
|
||||
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::~__split_buffer()
|
||||
{
|
||||
clear();
|
||||
if (__first_)
|
||||
__alloc_traits::deallocate(__alloc(), __first_, capacity());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
: __first_(_VSTD::move(__c.__first_)),
|
||||
__begin_(_VSTD::move(__c.__begin_)),
|
||||
__end_(_VSTD::move(__c.__end_)),
|
||||
__end_cap_(_VSTD::move(__c.__end_cap_))
|
||||
{
|
||||
__c.__first_ = nullptr;
|
||||
__c.__begin_ = nullptr;
|
||||
__c.__end_ = nullptr;
|
||||
__c.__end_cap() = nullptr;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
|
||||
: __end_cap_(__a)
|
||||
{
|
||||
if (__a == __c.__alloc())
|
||||
{
|
||||
__first_ = __c.__first_;
|
||||
__begin_ = __c.__begin_;
|
||||
__end_ = __c.__end_;
|
||||
__end_cap() = __c.__end_cap();
|
||||
__c.__first_ = nullptr;
|
||||
__c.__begin_ = nullptr;
|
||||
__c.__end_ = nullptr;
|
||||
__c.__end_cap() = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __cap = __c.size();
|
||||
__first_ = __alloc_traits::allocate(__alloc(), __cap);
|
||||
__begin_ = __end_ = __first_;
|
||||
__end_cap() = __first_ + __cap;
|
||||
typedef move_iterator<iterator> _Ip;
|
||||
__construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>&
|
||||
__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
|
||||
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value) ||
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value)
|
||||
{
|
||||
clear();
|
||||
shrink_to_fit();
|
||||
__first_ = __c.__first_;
|
||||
__begin_ = __c.__begin_;
|
||||
__end_ = __c.__end_;
|
||||
__end_cap() = __c.__end_cap();
|
||||
__move_assign_alloc(__c,
|
||||
integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_move_assignment::value>());
|
||||
__c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{
|
||||
_VSTD::swap(__first_, __x.__first_);
|
||||
_VSTD::swap(__begin_, __x.__begin_);
|
||||
_VSTD::swap(__end_, __x.__end_);
|
||||
_VSTD::swap(__end_cap(), __x.__end_cap());
|
||||
__swap_alloc(__alloc(), __x.__alloc());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::reserve(size_type __n)
|
||||
{
|
||||
if (__n < capacity())
|
||||
{
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
|
||||
{
|
||||
if (capacity() > size())
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
__t.__end_ = __t.__begin_ + (__end_ - __begin_);
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
||||
{
|
||||
if (__begin_ == __first_)
|
||||
{
|
||||
if (__end_ < __end_cap())
|
||||
{
|
||||
difference_type __d = __end_cap() - __end_;
|
||||
__d = (__d + 1) / 2;
|
||||
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__end_ += __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x);
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
{
|
||||
if (__begin_ == __first_)
|
||||
{
|
||||
if (__end_ < __end_cap())
|
||||
{
|
||||
difference_type __d = __end_cap() - __end_;
|
||||
__d = (__d + 1) / 2;
|
||||
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__end_ += __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1),
|
||||
_VSTD::move(__x));
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
{
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
if (__begin_ > __first_)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x);
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
||||
{
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
if (__begin_ > __first_)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
|
||||
_VSTD::move(__x));
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
{
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
if (__begin_ > __first_)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_SPLIT_BUFFER
|
77
external/bsd/libc++/dist/libcxx/include/__sso_allocator
vendored
Normal file
77
external/bsd/libc++/dist/libcxx/include/__sso_allocator
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___SSO_ALLOCATOR
|
||||
#define _LIBCPP___SSO_ALLOCATOR
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
#include <new>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, size_t _Np> class _LIBCPP_HIDDEN __sso_allocator;
|
||||
|
||||
template <size_t _Np>
|
||||
class _LIBCPP_HIDDEN __sso_allocator<void, _Np>
|
||||
{
|
||||
public:
|
||||
typedef const void* const_pointer;
|
||||
typedef void value_type;
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Np>
|
||||
class _LIBCPP_HIDDEN __sso_allocator
|
||||
{
|
||||
typename aligned_storage<sizeof(_Tp) * _Np>::type buf_;
|
||||
bool __allocated_;
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef _Tp* pointer;
|
||||
typedef _Tp value_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _Np>&) throw()
|
||||
: __allocated_(false) {}
|
||||
private:
|
||||
__sso_allocator& operator=(const __sso_allocator&);
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = 0)
|
||||
{
|
||||
if (!__allocated_ && __n <= _Np)
|
||||
{
|
||||
__allocated_ = true;
|
||||
return (pointer)&buf_;
|
||||
}
|
||||
return static_cast<pointer>(::operator new(__n * sizeof(_Tp)));
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type)
|
||||
{
|
||||
if (__p == (pointer)&buf_)
|
||||
__allocated_ = false;
|
||||
else
|
||||
::operator delete(__p);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(__sso_allocator& __a) const {return &buf_ == &__a.buf_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(__sso_allocator& __a) const {return &buf_ != &__a.buf_;}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___SSO_ALLOCATOR
|
359
external/bsd/libc++/dist/libcxx/include/__std_stream
vendored
Normal file
359
external/bsd/libc++/dist/libcxx/include/__std_stream
vendored
Normal file
|
@ -0,0 +1,359 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___STD_STREAM
|
||||
#define _LIBCPP___STD_STREAM
|
||||
|
||||
#include <__config>
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
#include <__locale>
|
||||
#include <cstdio>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
static const int __limit = 8;
|
||||
|
||||
// __stdinbuf
|
||||
|
||||
template <class _CharT>
|
||||
class _LIBCPP_HIDDEN __stdinbuf
|
||||
: public basic_streambuf<_CharT, char_traits<_CharT> >
|
||||
{
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
typedef char_traits<char_type> traits_type;
|
||||
typedef typename traits_type::int_type int_type;
|
||||
typedef typename traits_type::pos_type pos_type;
|
||||
typedef typename traits_type::off_type off_type;
|
||||
typedef typename traits_type::state_type state_type;
|
||||
|
||||
__stdinbuf(FILE* __fp, state_type* __st);
|
||||
|
||||
protected:
|
||||
virtual int_type underflow();
|
||||
virtual int_type uflow();
|
||||
virtual int_type pbackfail(int_type __c = traits_type::eof());
|
||||
virtual void imbue(const locale& __loc);
|
||||
|
||||
private:
|
||||
|
||||
FILE* __file_;
|
||||
const codecvt<char_type, char, state_type>* __cv_;
|
||||
state_type* __st_;
|
||||
int __encoding_;
|
||||
int_type __last_consumed_;
|
||||
bool __last_consumed_is_next_;
|
||||
bool __always_noconv_;
|
||||
|
||||
__stdinbuf(const __stdinbuf&);
|
||||
__stdinbuf& operator=(const __stdinbuf&);
|
||||
|
||||
int_type __getchar(bool __consume);
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st)
|
||||
: __file_(__fp),
|
||||
__st_(__st),
|
||||
__last_consumed_(traits_type::eof()),
|
||||
__last_consumed_is_next_(false)
|
||||
{
|
||||
imbue(this->getloc());
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
void
|
||||
__stdinbuf<_CharT>::imbue(const locale& __loc)
|
||||
{
|
||||
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
|
||||
__encoding_ = __cv_->encoding();
|
||||
__always_noconv_ = __cv_->always_noconv();
|
||||
if (__encoding_ > __limit)
|
||||
__throw_runtime_error("unsupported locale for standard input");
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::underflow()
|
||||
{
|
||||
return __getchar(false);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::uflow()
|
||||
{
|
||||
return __getchar(true);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::__getchar(bool __consume)
|
||||
{
|
||||
if (__last_consumed_is_next_)
|
||||
{
|
||||
int_type __result = __last_consumed_;
|
||||
if (__consume)
|
||||
{
|
||||
__last_consumed_ = traits_type::eof();
|
||||
__last_consumed_is_next_ = false;
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
char __extbuf[__limit];
|
||||
int __nread = _VSTD::max(1, __encoding_);
|
||||
for (int __i = 0; __i < __nread; ++__i)
|
||||
{
|
||||
int __c = getc(__file_);
|
||||
if (__c == EOF)
|
||||
return traits_type::eof();
|
||||
__extbuf[__i] = static_cast<char>(__c);
|
||||
}
|
||||
char_type __1buf;
|
||||
if (__always_noconv_)
|
||||
__1buf = static_cast<char_type>(__extbuf[0]);
|
||||
else
|
||||
{
|
||||
const char* __enxt;
|
||||
char_type* __inxt;
|
||||
codecvt_base::result __r;
|
||||
do
|
||||
{
|
||||
state_type __sv_st = *__st_;
|
||||
__r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt,
|
||||
&__1buf, &__1buf + 1, __inxt);
|
||||
switch (__r)
|
||||
{
|
||||
case _VSTD::codecvt_base::ok:
|
||||
break;
|
||||
case codecvt_base::partial:
|
||||
*__st_ = __sv_st;
|
||||
if (__nread == sizeof(__extbuf))
|
||||
return traits_type::eof();
|
||||
{
|
||||
int __c = getc(__file_);
|
||||
if (__c == EOF)
|
||||
return traits_type::eof();
|
||||
__extbuf[__nread] = static_cast<char>(__c);
|
||||
}
|
||||
++__nread;
|
||||
break;
|
||||
case codecvt_base::error:
|
||||
return traits_type::eof();
|
||||
case _VSTD::codecvt_base::noconv:
|
||||
__1buf = static_cast<char_type>(__extbuf[0]);
|
||||
break;
|
||||
}
|
||||
} while (__r == _VSTD::codecvt_base::partial);
|
||||
}
|
||||
if (!__consume)
|
||||
{
|
||||
for (int __i = __nread; __i > 0;)
|
||||
{
|
||||
if (ungetc(traits_type::to_int_type(__extbuf[--__i]), __file_) == EOF)
|
||||
return traits_type::eof();
|
||||
}
|
||||
}
|
||||
else
|
||||
__last_consumed_ = traits_type::to_int_type(__1buf);
|
||||
return traits_type::to_int_type(__1buf);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::pbackfail(int_type __c)
|
||||
{
|
||||
if (traits_type::eq_int_type(__c, traits_type::eof()))
|
||||
{
|
||||
if (!__last_consumed_is_next_)
|
||||
{
|
||||
__c = __last_consumed_;
|
||||
__last_consumed_is_next_ = !traits_type::eq_int_type(__last_consumed_,
|
||||
traits_type::eof());
|
||||
}
|
||||
return __c;
|
||||
}
|
||||
if (__last_consumed_is_next_)
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
char* __enxt;
|
||||
const char_type __ci = traits_type::to_char_type(__last_consumed_);
|
||||
const char_type* __inxt;
|
||||
switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt,
|
||||
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
|
||||
{
|
||||
case _VSTD::codecvt_base::ok:
|
||||
break;
|
||||
case _VSTD::codecvt_base::noconv:
|
||||
__extbuf[0] = static_cast<char>(__last_consumed_);
|
||||
__enxt = __extbuf + 1;
|
||||
break;
|
||||
case codecvt_base::partial:
|
||||
case codecvt_base::error:
|
||||
return traits_type::eof();
|
||||
}
|
||||
while (__enxt > __extbuf)
|
||||
if (ungetc(*--__enxt, __file_) == EOF)
|
||||
return traits_type::eof();
|
||||
}
|
||||
__last_consumed_ = __c;
|
||||
__last_consumed_is_next_ = true;
|
||||
return __c;
|
||||
}
|
||||
|
||||
// __stdoutbuf
|
||||
|
||||
template <class _CharT>
|
||||
class _LIBCPP_HIDDEN __stdoutbuf
|
||||
: public basic_streambuf<_CharT, char_traits<_CharT> >
|
||||
{
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
typedef char_traits<char_type> traits_type;
|
||||
typedef typename traits_type::int_type int_type;
|
||||
typedef typename traits_type::pos_type pos_type;
|
||||
typedef typename traits_type::off_type off_type;
|
||||
typedef typename traits_type::state_type state_type;
|
||||
|
||||
__stdoutbuf(FILE* __fp, state_type* __st);
|
||||
|
||||
protected:
|
||||
virtual int_type overflow (int_type __c = traits_type::eof());
|
||||
virtual streamsize xsputn(const char_type* __s, streamsize __n);
|
||||
virtual int sync();
|
||||
virtual void imbue(const locale& __loc);
|
||||
|
||||
private:
|
||||
FILE* __file_;
|
||||
const codecvt<char_type, char, state_type>* __cv_;
|
||||
state_type* __st_;
|
||||
bool __always_noconv_;
|
||||
|
||||
__stdoutbuf(const __stdoutbuf&);
|
||||
__stdoutbuf& operator=(const __stdoutbuf&);
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp, state_type* __st)
|
||||
: __file_(__fp),
|
||||
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
|
||||
__st_(__st),
|
||||
__always_noconv_(__cv_->always_noconv())
|
||||
{
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdoutbuf<_CharT>::int_type
|
||||
__stdoutbuf<_CharT>::overflow(int_type __c)
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
char_type __1buf;
|
||||
if (!traits_type::eq_int_type(__c, traits_type::eof()))
|
||||
{
|
||||
__1buf = traits_type::to_char_type(__c);
|
||||
if (__always_noconv_)
|
||||
{
|
||||
if (fwrite(&__1buf, sizeof(char_type), 1, __file_) != 1)
|
||||
return traits_type::eof();
|
||||
}
|
||||
else
|
||||
{
|
||||
char* __extbe = __extbuf;
|
||||
codecvt_base::result __r;
|
||||
char_type* pbase = &__1buf;
|
||||
char_type* pptr = pbase + 1;
|
||||
char_type* epptr = pptr;
|
||||
do
|
||||
{
|
||||
const char_type* __e;
|
||||
__r = __cv_->out(*__st_, pbase, pptr, __e,
|
||||
__extbuf,
|
||||
__extbuf + sizeof(__extbuf),
|
||||
__extbe);
|
||||
if (__e == pbase)
|
||||
return traits_type::eof();
|
||||
if (__r == codecvt_base::noconv)
|
||||
{
|
||||
if (fwrite(pbase, 1, 1, __file_) != 1)
|
||||
return traits_type::eof();
|
||||
}
|
||||
else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
|
||||
{
|
||||
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
|
||||
if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
|
||||
return traits_type::eof();
|
||||
if (__r == codecvt_base::partial)
|
||||
{
|
||||
pbase = (char_type*)__e;
|
||||
}
|
||||
}
|
||||
else
|
||||
return traits_type::eof();
|
||||
} while (__r == codecvt_base::partial);
|
||||
}
|
||||
}
|
||||
return traits_type::not_eof(__c);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
streamsize
|
||||
__stdoutbuf<_CharT>::xsputn(const char_type* __s, streamsize __n)
|
||||
{
|
||||
if (__always_noconv_)
|
||||
return fwrite(__s, sizeof(char_type), __n, __file_);
|
||||
streamsize __i = 0;
|
||||
for (; __i < __n; ++__i, ++__s)
|
||||
if (overflow(traits_type::to_int_type(*__s)) == traits_type::eof())
|
||||
break;
|
||||
return __i;
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
int
|
||||
__stdoutbuf<_CharT>::sync()
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
codecvt_base::result __r;
|
||||
do
|
||||
{
|
||||
char* __extbe;
|
||||
__r = __cv_->unshift(*__st_, __extbuf,
|
||||
__extbuf + sizeof(__extbuf),
|
||||
__extbe);
|
||||
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
|
||||
if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
|
||||
return -1;
|
||||
} while (__r == codecvt_base::partial);
|
||||
if (__r == codecvt_base::error)
|
||||
return -1;
|
||||
if (fflush(__file_))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
void
|
||||
__stdoutbuf<_CharT>::imbue(const locale& __loc)
|
||||
{
|
||||
sync();
|
||||
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
|
||||
__always_noconv_ = __cv_->always_noconv();
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___STD_STREAM
|
2309
external/bsd/libc++/dist/libcxx/include/__tree
vendored
Normal file
2309
external/bsd/libc++/dist/libcxx/include/__tree
vendored
Normal file
File diff suppressed because it is too large
Load diff
305
external/bsd/libc++/dist/libcxx/include/__tuple
vendored
Normal file
305
external/bsd/libc++/dist/libcxx/include/__tuple
vendored
Normal file
|
@ -0,0 +1,305 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___TUPLE
|
||||
#define _LIBCPP___TUPLE
|
||||
|
||||
#include <__config>
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#include <__tuple_03>
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_size;
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<volatile _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const volatile _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_element;
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY 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_TYPE_VIS_ONLY 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_TYPE_VIS_ONLY tuple_element<_Ip, const volatile _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <class ..._Tp> class _LIBCPP_TYPE_VIS_ONLY tuple;
|
||||
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY pair;
|
||||
template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY array;
|
||||
|
||||
template <class _Tp> struct __tuple_like : false_type {};
|
||||
|
||||
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
|
||||
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
|
||||
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
|
||||
|
||||
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
|
||||
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
|
||||
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(tuple<_Tp...>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(const tuple<_Tp...>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||
get(tuple<_Tp...>&&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(const pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||
get(pair<_T1, _T2>&&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&
|
||||
get(array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&&) _NOEXCEPT;
|
||||
|
||||
// __make_tuple_indices
|
||||
|
||||
template <size_t...> struct __tuple_indices {};
|
||||
|
||||
template <size_t _Sp, class _IntTuple, size_t _Ep>
|
||||
struct __make_indices_imp;
|
||||
|
||||
template <size_t _Sp, size_t ..._Indices, size_t _Ep>
|
||||
struct __make_indices_imp<_Sp, __tuple_indices<_Indices...>, _Ep>
|
||||
{
|
||||
typedef typename __make_indices_imp<_Sp+1, __tuple_indices<_Indices..., _Sp>, _Ep>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ep, size_t ..._Indices>
|
||||
struct __make_indices_imp<_Ep, __tuple_indices<_Indices...>, _Ep>
|
||||
{
|
||||
typedef __tuple_indices<_Indices...> type;
|
||||
};
|
||||
|
||||
template <size_t _Ep, size_t _Sp = 0>
|
||||
struct __make_tuple_indices
|
||||
{
|
||||
static_assert(_Sp <= _Ep, "__make_tuple_indices input error");
|
||||
typedef typename __make_indices_imp<_Sp, __tuple_indices<>, _Ep>::type type;
|
||||
};
|
||||
|
||||
// __tuple_types
|
||||
|
||||
template <class ..._Tp> struct __tuple_types {};
|
||||
|
||||
template <size_t _Ip>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<> >
|
||||
{
|
||||
public:
|
||||
static_assert(_Ip == 0, "tuple_element index out of range");
|
||||
static_assert(_Ip != 0, "tuple_element index out of range");
|
||||
};
|
||||
|
||||
template <class _Hp, class ..._Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, __tuple_types<_Hp, _Tp...> >
|
||||
{
|
||||
public:
|
||||
typedef _Hp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Hp, class ..._Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
|
||||
{
|
||||
public:
|
||||
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
|
||||
};
|
||||
|
||||
template <class ..._Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<__tuple_types<_Tp...> >
|
||||
: public integral_constant<size_t, sizeof...(_Tp)>
|
||||
{
|
||||
};
|
||||
|
||||
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {};
|
||||
|
||||
// __make_tuple_types
|
||||
|
||||
// __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a
|
||||
// __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep).
|
||||
// _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a
|
||||
// lvalue_reference type, then __tuple_types<_Types&...> is the result.
|
||||
|
||||
template <class _TupleTypes, class _Tp, size_t _Sp, size_t _Ep>
|
||||
struct __make_tuple_types_imp;
|
||||
|
||||
template <class ..._Types, class _Tp, size_t _Sp, size_t _Ep>
|
||||
struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
|
||||
{
|
||||
typedef typename remove_reference<_Tp>::type _Tpr;
|
||||
typedef typename __make_tuple_types_imp<__tuple_types<_Types...,
|
||||
typename conditional<is_lvalue_reference<_Tp>::value,
|
||||
typename tuple_element<_Sp, _Tpr>::type&,
|
||||
typename tuple_element<_Sp, _Tpr>::type>::type>,
|
||||
_Tp, _Sp+1, _Ep>::type type;
|
||||
};
|
||||
|
||||
template <class ..._Types, class _Tp, size_t _Ep>
|
||||
struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Ep, _Ep>
|
||||
{
|
||||
typedef __tuple_types<_Types...> type;
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, size_t _Sp = 0>
|
||||
struct __make_tuple_types
|
||||
{
|
||||
static_assert(_Sp <= _Ep, "__make_tuple_types input error");
|
||||
typedef typename __make_tuple_types_imp<__tuple_types<>, _Tp, _Sp, _Ep>::type type;
|
||||
};
|
||||
|
||||
// __tuple_convertible
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
struct __tuple_convertible_imp : public false_type {};
|
||||
|
||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
: public integral_constant<bool,
|
||||
is_convertible<_Tp0, _Up0>::value &&
|
||||
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
bool = __tuple_like<_Up>::value>
|
||||
struct __tuple_convertible
|
||||
: public false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_convertible<_Tp, _Up, true, true>
|
||||
: public __tuple_convertible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
{};
|
||||
|
||||
// __tuple_constructible
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
struct __tuple_constructible_imp : public false_type {};
|
||||
|
||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||
struct __tuple_constructible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
: public integral_constant<bool,
|
||||
is_constructible<_Up0, _Tp0>::value &&
|
||||
__tuple_constructible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_constructible_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
bool = __tuple_like<_Up>::value>
|
||||
struct __tuple_constructible
|
||||
: public false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_constructible<_Tp, _Up, true, true>
|
||||
: public __tuple_constructible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
{};
|
||||
|
||||
// __tuple_assignable
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
struct __tuple_assignable_imp : public false_type {};
|
||||
|
||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||
struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
: public integral_constant<bool,
|
||||
is_assignable<_Up0&, _Tp0>::value &&
|
||||
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
bool = __tuple_like<_Up>::value>
|
||||
struct __tuple_assignable
|
||||
: public false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_assignable<_Tp, _Up, true, true>
|
||||
: public __tuple_assignable_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
{};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#endif // _LIBCPP___TUPLE
|
27
external/bsd/libc++/dist/libcxx/include/__tuple_03
vendored
Normal file
27
external/bsd/libc++/dist/libcxx/include/__tuple_03
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___TUPLE_03
|
||||
#define _LIBCPP___TUPLE_03
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_size;
|
||||
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_element;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___TUPLE_03
|
29
external/bsd/libc++/dist/libcxx/include/__undef_min_max
vendored
Normal file
29
external/bsd/libc++/dist/libcxx/include/__undef_min_max
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifdef min
|
||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||
_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
|
||||
"before any Windows header. #undefing min")
|
||||
#else
|
||||
#warning: macro min is incompatible with C++. #undefing min
|
||||
#endif
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
#ifdef max
|
||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||
_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
|
||||
"before any Windows header. #undefing max")
|
||||
#else
|
||||
#warning: macro max is incompatible with C++. #undefing max
|
||||
#endif
|
||||
#undef max
|
||||
#endif
|
5679
external/bsd/libc++/dist/libcxx/include/algorithm
vendored
Normal file
5679
external/bsd/libc++/dist/libcxx/include/algorithm
vendored
Normal file
File diff suppressed because it is too large
Load diff
342
external/bsd/libc++/dist/libcxx/include/array
vendored
Normal file
342
external/bsd/libc++/dist/libcxx/include/array
vendored
Normal file
|
@ -0,0 +1,342 @@
|
|||
// -*- C++ -*-
|
||||
//===---------------------------- array -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_ARRAY
|
||||
#define _LIBCPP_ARRAY
|
||||
|
||||
/*
|
||||
array synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <class T, size_t N >
|
||||
struct array
|
||||
{
|
||||
// types:
|
||||
typedef T & reference;
|
||||
typedef const T & const_reference;
|
||||
typedef implementation defined iterator;
|
||||
typedef implementation defined const_iterator;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
void fill(const T& u);
|
||||
void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>())));
|
||||
|
||||
// iterators:
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// capacity:
|
||||
constexpr size_type size() const noexcept;
|
||||
constexpr size_type max_size() const noexcept;
|
||||
constexpr bool empty() const noexcept;
|
||||
|
||||
// element access:
|
||||
reference operator[](size_type n);
|
||||
const_reference operator[](size_type n) const; // constexpr in C++14
|
||||
const_reference at(size_type n) const; // constexpr in C++14
|
||||
reference at(size_type n);
|
||||
|
||||
reference front();
|
||||
const_reference front() const; // constexpr in C++14
|
||||
reference back();
|
||||
const_reference back() const; // constexpr in C++14
|
||||
|
||||
T* data() noexcept;
|
||||
const T* data() const noexcept;
|
||||
};
|
||||
|
||||
template <class T, size_t N>
|
||||
bool operator==(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator!=(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator<(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator>(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator<=(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator>=(const array<T,N>& x, const array<T,N>& y);
|
||||
|
||||
template <class T, size_t N >
|
||||
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class T> class tuple_size;
|
||||
template <int I, class T> class tuple_element;
|
||||
template <class T, size_t N> struct tuple_size<array<T, N>>;
|
||||
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
|
||||
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
|
||||
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
|
||||
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
#if defined(_LIBCPP_NO_EXCEPTIONS)
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY array
|
||||
{
|
||||
// types:
|
||||
typedef array __self;
|
||||
typedef _Tp value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef value_type* iterator;
|
||||
typedef const value_type* const_iterator;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
value_type __elems_[_Size > 0 ? _Size : 1];
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
|
||||
{_VSTD::fill_n(__elems_, _Size, __u);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{_VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
|
||||
|
||||
// iterators:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT {return iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const _NOEXCEPT {return begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const _NOEXCEPT {return end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
|
||||
|
||||
// capacity:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
|
||||
|
||||
// element access:
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];}
|
||||
reference at(size_type __n);
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}
|
||||
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type* data() _NOEXCEPT {return __elems_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const value_type* data() const _NOEXCEPT {return __elems_;}
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
typename array<_Tp, _Size>::reference
|
||||
array<_Tp, _Size>::at(size_type __n)
|
||||
{
|
||||
if (__n >= _Size)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw out_of_range("array::at");
|
||||
#else
|
||||
assert(!"array::at out_of_range");
|
||||
#endif
|
||||
return __elems_[__n];
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename array<_Tp, _Size>::const_reference
|
||||
array<_Tp, _Size>::at(size_type __n) const
|
||||
{
|
||||
if (__n >= _Size)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw out_of_range("array::at");
|
||||
#else
|
||||
assert(!"array::at out_of_range");
|
||||
#endif
|
||||
return __elems_[__n];
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return _VSTD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return _VSTD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
__is_swappable<_Tp>::value,
|
||||
void
|
||||
>::type
|
||||
swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<array<_Tp, _Size> >
|
||||
: public integral_constant<size_t, _Size> {};
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const array<_Tp, _Size> >
|
||||
: public integral_constant<size_t, _Size> {};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, array<_Tp, _Size> >
|
||||
{
|
||||
public:
|
||||
typedef _Tp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const array<_Tp, _Size> >
|
||||
{
|
||||
public:
|
||||
typedef const _Tp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&
|
||||
get(array<_Tp, _Size>& __a) _NOEXCEPT
|
||||
{
|
||||
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
|
||||
return __a.__elems_[_Ip];
|
||||
}
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>& __a) _NOEXCEPT
|
||||
{
|
||||
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
|
||||
return __a.__elems_[_Ip];
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&& __a) _NOEXCEPT
|
||||
{
|
||||
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
|
||||
return _VSTD::move(__a.__elems_[_Ip]);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_ARRAY
|
1531
external/bsd/libc++/dist/libcxx/include/atomic
vendored
Normal file
1531
external/bsd/libc++/dist/libcxx/include/atomic
vendored
Normal file
File diff suppressed because it is too large
Load diff
1081
external/bsd/libc++/dist/libcxx/include/bitset
vendored
Normal file
1081
external/bsd/libc++/dist/libcxx/include/bitset
vendored
Normal file
File diff suppressed because it is too large
Load diff
25
external/bsd/libc++/dist/libcxx/include/cassert
vendored
Normal file
25
external/bsd/libc++/dist/libcxx/include/cassert
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
// -*- C++ -*-
|
||||
//===-------------------------- cassert -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/*
|
||||
cassert synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
assert
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <assert.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
29
external/bsd/libc++/dist/libcxx/include/ccomplex
vendored
Normal file
29
external/bsd/libc++/dist/libcxx/include/ccomplex
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- ccomplex ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CCOMPLEX
|
||||
#define _LIBCPP_CCOMPLEX
|
||||
|
||||
/*
|
||||
ccomplex synopsis
|
||||
|
||||
#include <complex>
|
||||
|
||||
*/
|
||||
|
||||
#include <complex>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
// hh 080623 Created
|
||||
|
||||
#endif // _LIBCPP_CCOMPLEX
|
164
external/bsd/libc++/dist/libcxx/include/cctype
vendored
Normal file
164
external/bsd/libc++/dist/libcxx/include/cctype
vendored
Normal file
|
@ -0,0 +1,164 @@
|
|||
// -*- C++ -*-
|
||||
//===---------------------------- cctype ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CCTYPE
|
||||
#define _LIBCPP_CCTYPE
|
||||
|
||||
/*
|
||||
cctype synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
int isalnum(int c);
|
||||
int isalpha(int c);
|
||||
int isblank(int c); // C99
|
||||
int iscntrl(int c);
|
||||
int isdigit(int c);
|
||||
int isgraph(int c);
|
||||
int islower(int c);
|
||||
int isprint(int c);
|
||||
int ispunct(int c);
|
||||
int isspace(int c);
|
||||
int isupper(int c);
|
||||
int isxdigit(int c);
|
||||
int tolower(int c);
|
||||
int toupper(int c);
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <ctype.h>
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
#include "support/win32/support.h"
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifdef isalnum
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalnum(int __c) {return isalnum(__c);}
|
||||
#undef isalnum
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isalnum(int __c) {return __libcpp_isalnum(__c);}
|
||||
#else // isalnum
|
||||
using ::isalnum;
|
||||
#endif // isalnum
|
||||
|
||||
#ifdef isalpha
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalpha(int __c) {return isalpha(__c);}
|
||||
#undef isalpha
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isalpha(int __c) {return __libcpp_isalpha(__c);}
|
||||
#else // isalpha
|
||||
using ::isalpha;
|
||||
#endif // isalpha
|
||||
|
||||
#ifdef isblank
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isblank(int __c) {return isblank(__c);}
|
||||
#undef isblank
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isblank(int __c) {return __libcpp_isblank(__c);}
|
||||
#else // isblank
|
||||
using ::isblank;
|
||||
#endif // isblank
|
||||
|
||||
#ifdef iscntrl
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iscntrl(int __c) {return iscntrl(__c);}
|
||||
#undef iscntrl
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iscntrl(int __c) {return __libcpp_iscntrl(__c);}
|
||||
#else // iscntrl
|
||||
using ::iscntrl;
|
||||
#endif // iscntrl
|
||||
|
||||
#ifdef isdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isdigit(int __c) {return isdigit(__c);}
|
||||
#undef isdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isdigit(int __c) {return __libcpp_isdigit(__c);}
|
||||
#else // isdigit
|
||||
using ::isdigit;
|
||||
#endif // isdigit
|
||||
|
||||
#ifdef isgraph
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isgraph(int __c) {return isgraph(__c);}
|
||||
#undef isgraph
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isgraph(int __c) {return __libcpp_isgraph(__c);}
|
||||
#else // isgraph
|
||||
using ::isgraph;
|
||||
#endif // isgraph
|
||||
|
||||
#ifdef islower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_islower(int __c) {return islower(__c);}
|
||||
#undef islower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int islower(int __c) {return __libcpp_islower(__c);}
|
||||
#else // islower
|
||||
using ::islower;
|
||||
#endif // islower
|
||||
|
||||
#ifdef isprint
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isprint(int __c) {return isprint(__c);}
|
||||
#undef isprint
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isprint(int __c) {return __libcpp_isprint(__c);}
|
||||
#else // isprint
|
||||
using ::isprint;
|
||||
#endif // isprint
|
||||
|
||||
#ifdef ispunct
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ispunct(int __c) {return ispunct(__c);}
|
||||
#undef ispunct
|
||||
inline _LIBCPP_INLINE_VISIBILITY int ispunct(int __c) {return __libcpp_ispunct(__c);}
|
||||
#else // ispunct
|
||||
using ::ispunct;
|
||||
#endif // ispunct
|
||||
|
||||
#ifdef isspace
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isspace(int __c) {return isspace(__c);}
|
||||
#undef isspace
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isspace(int __c) {return __libcpp_isspace(__c);}
|
||||
#else // isspace
|
||||
using ::isspace;
|
||||
#endif // isspace
|
||||
|
||||
#ifdef isupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isupper(int __c) {return isupper(__c);}
|
||||
#undef isupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isupper(int __c) {return __libcpp_isupper(__c);}
|
||||
#else // isupper
|
||||
using ::isupper;
|
||||
#endif // isupper
|
||||
|
||||
#ifdef isxdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isxdigit(int __c) {return isxdigit(__c);}
|
||||
#undef isxdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isxdigit(int __c) {return __libcpp_isxdigit(__c);}
|
||||
#else // isxdigit
|
||||
using ::isxdigit;
|
||||
#endif // isxdigit
|
||||
|
||||
#ifdef tolower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_tolower(int __c) {return tolower(__c);}
|
||||
#undef tolower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int tolower(int __c) {return __libcpp_tolower(__c);}
|
||||
#else // tolower
|
||||
using ::tolower;
|
||||
#endif // tolower
|
||||
|
||||
#ifdef toupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_toupper(int __c) {return toupper(__c);}
|
||||
#undef toupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int toupper(int __c) {return __libcpp_toupper(__c);}
|
||||
#else // toupper
|
||||
using ::toupper;
|
||||
#endif // toupper
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CCTYPE
|
393
external/bsd/libc++/dist/libcxx/include/cerrno
vendored
Normal file
393
external/bsd/libc++/dist/libcxx/include/cerrno
vendored
Normal file
|
@ -0,0 +1,393 @@
|
|||
// -*- C++ -*-
|
||||
//===-------------------------- cerrno ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CERRNO
|
||||
#define _LIBCPP_CERRNO
|
||||
|
||||
/*
|
||||
cerrno synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
EDOM
|
||||
EILSEQ // C99
|
||||
ERANGE
|
||||
errno
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <errno.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||
|
||||
#ifdef ELAST
|
||||
|
||||
const int __elast1 = ELAST+1;
|
||||
const int __elast2 = ELAST+2;
|
||||
|
||||
#else
|
||||
|
||||
const int __elast1 = 104;
|
||||
const int __elast2 = 105;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENOTRECOVERABLE
|
||||
|
||||
#define EOWNERDEAD __elast1
|
||||
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST EOWNERDEAD
|
||||
#endif
|
||||
|
||||
#elif defined(EOWNERDEAD)
|
||||
|
||||
#define ENOTRECOVERABLE __elast1
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST ENOTRECOVERABLE
|
||||
#endif
|
||||
|
||||
#else // defined(EOWNERDEAD)
|
||||
|
||||
#define EOWNERDEAD __elast1
|
||||
#define ENOTRECOVERABLE __elast2
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST ENOTRECOVERABLE
|
||||
#endif
|
||||
|
||||
#endif // defined(EOWNERDEAD)
|
||||
|
||||
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||
|
||||
// supply errno values likely to be missing, particularly on Windows
|
||||
|
||||
#ifndef EAFNOSUPPORT
|
||||
#define EAFNOSUPPORT 9901
|
||||
#endif
|
||||
|
||||
#ifndef EADDRINUSE
|
||||
#define EADDRINUSE 9902
|
||||
#endif
|
||||
|
||||
#ifndef EADDRNOTAVAIL
|
||||
#define EADDRNOTAVAIL 9903
|
||||
#endif
|
||||
|
||||
#ifndef EISCONN
|
||||
#define EISCONN 9904
|
||||
#endif
|
||||
|
||||
#ifndef EBADMSG
|
||||
#define EBADMSG 9905
|
||||
#endif
|
||||
|
||||
#ifndef ECONNABORTED
|
||||
#define ECONNABORTED 9906
|
||||
#endif
|
||||
|
||||
#ifndef EALREADY
|
||||
#define EALREADY 9907
|
||||
#endif
|
||||
|
||||
#ifndef ECONNREFUSED
|
||||
#define ECONNREFUSED 9908
|
||||
#endif
|
||||
|
||||
#ifndef ECONNRESET
|
||||
#define ECONNRESET 9909
|
||||
#endif
|
||||
|
||||
#ifndef EDESTADDRREQ
|
||||
#define EDESTADDRREQ 9910
|
||||
#endif
|
||||
|
||||
#ifndef EHOSTUNREACH
|
||||
#define EHOSTUNREACH 9911
|
||||
#endif
|
||||
|
||||
#ifndef EIDRM
|
||||
#define EIDRM 9912
|
||||
#endif
|
||||
|
||||
#ifndef EMSGSIZE
|
||||
#define EMSGSIZE 9913
|
||||
#endif
|
||||
|
||||
#ifndef ENETDOWN
|
||||
#define ENETDOWN 9914
|
||||
#endif
|
||||
|
||||
#ifndef ENETRESET
|
||||
#define ENETRESET 9915
|
||||
#endif
|
||||
|
||||
#ifndef ENETUNREACH
|
||||
#define ENETUNREACH 9916
|
||||
#endif
|
||||
|
||||
#ifndef ENOBUFS
|
||||
#define ENOBUFS 9917
|
||||
#endif
|
||||
|
||||
#ifndef ENOLINK
|
||||
#define ENOLINK 9918
|
||||
#endif
|
||||
|
||||
#ifndef ENODATA
|
||||
#define ENODATA 9919
|
||||
#endif
|
||||
|
||||
#ifndef ENOMSG
|
||||
#define ENOMSG 9920
|
||||
#endif
|
||||
|
||||
#ifndef ENOPROTOOPT
|
||||
#define ENOPROTOOPT 9921
|
||||
#endif
|
||||
|
||||
#ifndef ENOSR
|
||||
#define ENOSR 9922
|
||||
#endif
|
||||
|
||||
#ifndef ENOTSOCK
|
||||
#define ENOTSOCK 9923
|
||||
#endif
|
||||
|
||||
#ifndef ENOSTR
|
||||
#define ENOSTR 9924
|
||||
#endif
|
||||
|
||||
#ifndef ENOTCONN
|
||||
#define ENOTCONN 9925
|
||||
#endif
|
||||
|
||||
#ifndef ENOTSUP
|
||||
#define ENOTSUP 9926
|
||||
#endif
|
||||
|
||||
#ifndef ECANCELED
|
||||
#define ECANCELED 9927
|
||||
#endif
|
||||
|
||||
#ifndef EINPROGRESS
|
||||
#define EINPROGRESS 9928
|
||||
#endif
|
||||
|
||||
#ifndef EOPNOTSUPP
|
||||
#define EOPNOTSUPP 9929
|
||||
#endif
|
||||
|
||||
#ifndef EWOULDBLOCK
|
||||
#define EWOULDBLOCK 9930
|
||||
#endif
|
||||
|
||||
#ifndef EOWNERDEAD
|
||||
#define EOWNERDEAD 9931
|
||||
#endif
|
||||
|
||||
#ifndef EPROTO
|
||||
#define EPROTO 9932
|
||||
#endif
|
||||
|
||||
#ifndef EPROTONOSUPPORT
|
||||
#define EPROTONOSUPPORT 9933
|
||||
#endif
|
||||
|
||||
#ifndef ENOTRECOVERABLE
|
||||
#define ENOTRECOVERABLE 9934
|
||||
#endif
|
||||
|
||||
#ifndef ETIME
|
||||
#define ETIME 9935
|
||||
#endif
|
||||
|
||||
#ifndef ETXTBSY
|
||||
#define ETXTBSY 9936
|
||||
#endif
|
||||
|
||||
#ifndef ETIMEDOUT
|
||||
#define ETIMEDOUT 9938
|
||||
#endif
|
||||
|
||||
#ifndef ELOOP
|
||||
#define ELOOP 9939
|
||||
#endif
|
||||
|
||||
#ifndef EOVERFLOW
|
||||
#define EOVERFLOW 9940
|
||||
#endif
|
||||
|
||||
#ifndef EPROTOTYPE
|
||||
#define EPROTOTYPE 9941
|
||||
#endif
|
||||
|
||||
#ifndef ENOSYS
|
||||
#define ENOSYS 9942
|
||||
#endif
|
||||
|
||||
#ifndef EINVAL
|
||||
#define EINVAL 9943
|
||||
#endif
|
||||
|
||||
#ifndef ERANGE
|
||||
#define ERANGE 9944
|
||||
#endif
|
||||
|
||||
#ifndef EILSEQ
|
||||
#define EILSEQ 9945
|
||||
#endif
|
||||
|
||||
// Windows Mobile doesn't appear to define these:
|
||||
|
||||
#ifndef E2BIG
|
||||
#define E2BIG 9946
|
||||
#endif
|
||||
|
||||
#ifndef EDOM
|
||||
#define EDOM 9947
|
||||
#endif
|
||||
|
||||
#ifndef EFAULT
|
||||
#define EFAULT 9948
|
||||
#endif
|
||||
|
||||
#ifndef EBADF
|
||||
#define EBADF 9949
|
||||
#endif
|
||||
|
||||
#ifndef EPIPE
|
||||
#define EPIPE 9950
|
||||
#endif
|
||||
|
||||
#ifndef EXDEV
|
||||
#define EXDEV 9951
|
||||
#endif
|
||||
|
||||
#ifndef EBUSY
|
||||
#define EBUSY 9952
|
||||
#endif
|
||||
|
||||
#ifndef ENOTEMPTY
|
||||
#define ENOTEMPTY 9953
|
||||
#endif
|
||||
|
||||
#ifndef ENOEXEC
|
||||
#define ENOEXEC 9954
|
||||
#endif
|
||||
|
||||
#ifndef EEXIST
|
||||
#define EEXIST 9955
|
||||
#endif
|
||||
|
||||
#ifndef EFBIG
|
||||
#define EFBIG 9956
|
||||
#endif
|
||||
|
||||
#ifndef ENAMETOOLONG
|
||||
#define ENAMETOOLONG 9957
|
||||
#endif
|
||||
|
||||
#ifndef ENOTTY
|
||||
#define ENOTTY 9958
|
||||
#endif
|
||||
|
||||
#ifndef EINTR
|
||||
#define EINTR 9959
|
||||
#endif
|
||||
|
||||
#ifndef ESPIPE
|
||||
#define ESPIPE 9960
|
||||
#endif
|
||||
|
||||
#ifndef EIO
|
||||
#define EIO 9961
|
||||
#endif
|
||||
|
||||
#ifndef EISDIR
|
||||
#define EISDIR 9962
|
||||
#endif
|
||||
|
||||
#ifndef ECHILD
|
||||
#define ECHILD 9963
|
||||
#endif
|
||||
|
||||
#ifndef ENOLCK
|
||||
#define ENOLCK 9964
|
||||
#endif
|
||||
|
||||
#ifndef ENOSPC
|
||||
#define ENOSPC 9965
|
||||
#endif
|
||||
|
||||
#ifndef ENXIO
|
||||
#define ENXIO 9966
|
||||
#endif
|
||||
|
||||
#ifndef ENODEV
|
||||
#define ENODEV 9967
|
||||
#endif
|
||||
|
||||
#ifndef ENOENT
|
||||
#define ENOENT 9968
|
||||
#endif
|
||||
|
||||
#ifndef ESRCH
|
||||
#define ESRCH 9969
|
||||
#endif
|
||||
|
||||
#ifndef ENOTDIR
|
||||
#define ENOTDIR 9970
|
||||
#endif
|
||||
|
||||
#ifndef ENOMEM
|
||||
#define ENOMEM 9971
|
||||
#endif
|
||||
|
||||
#ifndef EPERM
|
||||
#define EPERM 9972
|
||||
#endif
|
||||
|
||||
#ifndef EACCES
|
||||
#define EACCES 9973
|
||||
#endif
|
||||
|
||||
#ifndef EROFS
|
||||
#define EROFS 9974
|
||||
#endif
|
||||
|
||||
#ifndef EDEADLK
|
||||
#define EDEADLK 9975
|
||||
#endif
|
||||
|
||||
#ifndef EAGAIN
|
||||
#define EAGAIN 9976
|
||||
#endif
|
||||
|
||||
#ifndef ENFILE
|
||||
#define ENFILE 9977
|
||||
#endif
|
||||
|
||||
#ifndef EMFILE
|
||||
#define EMFILE 9978
|
||||
#endif
|
||||
|
||||
#ifndef EMLINK
|
||||
#define EMLINK 9979
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CERRNO
|
82
external/bsd/libc++/dist/libcxx/include/cfenv
vendored
Normal file
82
external/bsd/libc++/dist/libcxx/include/cfenv
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
// -*- C++ -*-
|
||||
//===---------------------------- cctype ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CFENV
|
||||
#define _LIBCPP_CFENV
|
||||
|
||||
/*
|
||||
cfenv synopsis
|
||||
|
||||
This entire header is C99 / C++0X
|
||||
|
||||
Macros:
|
||||
|
||||
FE_DIVBYZERO
|
||||
FE_INEXACT
|
||||
FE_INVALID
|
||||
FE_OVERFLOW
|
||||
FE_UNDERFLOW
|
||||
FE_ALL_EXCEPT
|
||||
FE_DOWNWARD
|
||||
FE_TONEAREST
|
||||
FE_TOWARDZERO
|
||||
FE_UPWARD
|
||||
FE_DFL_ENV
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
fenv_t
|
||||
fexcept_t
|
||||
|
||||
int feclearexcept(int excepts);
|
||||
int fegetexceptflag(fexcept_t* flagp, int excepts);
|
||||
int feraiseexcept(int excepts);
|
||||
int fesetexceptflag(const fexcept_t* flagp, int excepts);
|
||||
int fetestexcept(int excepts);
|
||||
int fegetround();
|
||||
int fesetround(int round);
|
||||
int fegetenv(fenv_t* envp);
|
||||
int feholdexcept(fenv_t* envp);
|
||||
int fesetenv(const fenv_t* envp);
|
||||
int feupdateenv(const fenv_t* envp);
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <fenv.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::fenv_t;
|
||||
using ::fexcept_t;
|
||||
|
||||
using ::feclearexcept;
|
||||
using ::fegetexceptflag;
|
||||
using ::feraiseexcept;
|
||||
using ::fesetexceptflag;
|
||||
using ::fetestexcept;
|
||||
using ::fegetround;
|
||||
using ::fesetround;
|
||||
using ::fegetenv;
|
||||
using ::feholdexcept;
|
||||
using ::fesetenv;
|
||||
using ::feupdateenv;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CFENV
|
78
external/bsd/libc++/dist/libcxx/include/cfloat
vendored
Normal file
78
external/bsd/libc++/dist/libcxx/include/cfloat
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- cfloat -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CFLOAT
|
||||
#define _LIBCPP_CFLOAT
|
||||
|
||||
/*
|
||||
cfloat synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
FLT_ROUNDS
|
||||
FLT_EVAL_METHOD // C99
|
||||
FLT_RADIX
|
||||
|
||||
FLT_MANT_DIG
|
||||
DBL_MANT_DIG
|
||||
LDBL_MANT_DIG
|
||||
|
||||
DECIMAL_DIG // C99
|
||||
|
||||
FLT_DIG
|
||||
DBL_DIG
|
||||
LDBL_DIG
|
||||
|
||||
FLT_MIN_EXP
|
||||
DBL_MIN_EXP
|
||||
LDBL_MIN_EXP
|
||||
|
||||
FLT_MIN_10_EXP
|
||||
DBL_MIN_10_EXP
|
||||
LDBL_MIN_10_EXP
|
||||
|
||||
FLT_MAX_EXP
|
||||
DBL_MAX_EXP
|
||||
LDBL_MAX_EXP
|
||||
|
||||
FLT_MAX_10_EXP
|
||||
DBL_MAX_10_EXP
|
||||
LDBL_MAX_10_EXP
|
||||
|
||||
FLT_MAX
|
||||
DBL_MAX
|
||||
LDBL_MAX
|
||||
|
||||
FLT_EPSILON
|
||||
DBL_EPSILON
|
||||
LDBL_EPSILON
|
||||
|
||||
FLT_MIN
|
||||
DBL_MIN
|
||||
LDBL_MIN
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <float.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef FLT_EVAL_METHOD
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
#endif
|
||||
|
||||
#ifndef DECIMAL_DIG
|
||||
#define DECIMAL_DIG __DECIMAL_DIG__
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CFLOAT
|
1027
external/bsd/libc++/dist/libcxx/include/chrono
vendored
Normal file
1027
external/bsd/libc++/dist/libcxx/include/chrono
vendored
Normal file
File diff suppressed because it is too large
Load diff
259
external/bsd/libc++/dist/libcxx/include/cinttypes
vendored
Normal file
259
external/bsd/libc++/dist/libcxx/include/cinttypes
vendored
Normal file
|
@ -0,0 +1,259 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- cinttypes --------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CINTTYPES
|
||||
#define _LIBCPP_CINTTYPES
|
||||
|
||||
/*
|
||||
cinttypes synopsis
|
||||
|
||||
This entire header is C99 / C++0X
|
||||
|
||||
#include <cstdint> // <cinttypes> includes <cstdint>
|
||||
|
||||
Macros:
|
||||
|
||||
PRId8
|
||||
PRId16
|
||||
PRId32
|
||||
PRId64
|
||||
|
||||
PRIdLEAST8
|
||||
PRIdLEAST16
|
||||
PRIdLEAST32
|
||||
PRIdLEAST64
|
||||
|
||||
PRIdFAST8
|
||||
PRIdFAST16
|
||||
PRIdFAST32
|
||||
PRIdFAST64
|
||||
|
||||
PRIdMAX
|
||||
PRIdPTR
|
||||
|
||||
PRIi8
|
||||
PRIi16
|
||||
PRIi32
|
||||
PRIi64
|
||||
|
||||
PRIiLEAST8
|
||||
PRIiLEAST16
|
||||
PRIiLEAST32
|
||||
PRIiLEAST64
|
||||
|
||||
PRIiFAST8
|
||||
PRIiFAST16
|
||||
PRIiFAST32
|
||||
PRIiFAST64
|
||||
|
||||
PRIiMAX
|
||||
PRIiPTR
|
||||
|
||||
PRIo8
|
||||
PRIo16
|
||||
PRIo32
|
||||
PRIo64
|
||||
|
||||
PRIoLEAST8
|
||||
PRIoLEAST16
|
||||
PRIoLEAST32
|
||||
PRIoLEAST64
|
||||
|
||||
PRIoFAST8
|
||||
PRIoFAST16
|
||||
PRIoFAST32
|
||||
PRIoFAST64
|
||||
|
||||
PRIoMAX
|
||||
PRIoPTR
|
||||
|
||||
PRIu8
|
||||
PRIu16
|
||||
PRIu32
|
||||
PRIu64
|
||||
|
||||
PRIuLEAST8
|
||||
PRIuLEAST16
|
||||
PRIuLEAST32
|
||||
PRIuLEAST64
|
||||
|
||||
PRIuFAST8
|
||||
PRIuFAST16
|
||||
PRIuFAST32
|
||||
PRIuFAST64
|
||||
|
||||
PRIuMAX
|
||||
PRIuPTR
|
||||
|
||||
PRIx8
|
||||
PRIx16
|
||||
PRIx32
|
||||
PRIx64
|
||||
|
||||
PRIxLEAST8
|
||||
PRIxLEAST16
|
||||
PRIxLEAST32
|
||||
PRIxLEAST64
|
||||
|
||||
PRIxFAST8
|
||||
PRIxFAST16
|
||||
PRIxFAST32
|
||||
PRIxFAST64
|
||||
|
||||
PRIxMAX
|
||||
PRIxPTR
|
||||
|
||||
PRIX8
|
||||
PRIX16
|
||||
PRIX32
|
||||
PRIX64
|
||||
|
||||
PRIXLEAST8
|
||||
PRIXLEAST16
|
||||
PRIXLEAST32
|
||||
PRIXLEAST64
|
||||
|
||||
PRIXFAST8
|
||||
PRIXFAST16
|
||||
PRIXFAST32
|
||||
PRIXFAST64
|
||||
|
||||
PRIXMAX
|
||||
PRIXPTR
|
||||
|
||||
SCNd8
|
||||
SCNd16
|
||||
SCNd32
|
||||
SCNd64
|
||||
|
||||
SCNdLEAST8
|
||||
SCNdLEAST16
|
||||
SCNdLEAST32
|
||||
SCNdLEAST64
|
||||
|
||||
SCNdFAST8
|
||||
SCNdFAST16
|
||||
SCNdFAST32
|
||||
SCNdFAST64
|
||||
|
||||
SCNdMAX
|
||||
SCNdPTR
|
||||
|
||||
SCNi8
|
||||
SCNi16
|
||||
SCNi32
|
||||
SCNi64
|
||||
|
||||
SCNiLEAST8
|
||||
SCNiLEAST16
|
||||
SCNiLEAST32
|
||||
SCNiLEAST64
|
||||
|
||||
SCNiFAST8
|
||||
SCNiFAST16
|
||||
SCNiFAST32
|
||||
SCNiFAST64
|
||||
|
||||
SCNiMAX
|
||||
SCNiPTR
|
||||
|
||||
SCNo8
|
||||
SCNo16
|
||||
SCNo32
|
||||
SCNo64
|
||||
|
||||
SCNoLEAST8
|
||||
SCNoLEAST16
|
||||
SCNoLEAST32
|
||||
SCNoLEAST64
|
||||
|
||||
SCNoFAST8
|
||||
SCNoFAST16
|
||||
SCNoFAST32
|
||||
SCNoFAST64
|
||||
|
||||
SCNoMAX
|
||||
SCNoPTR
|
||||
|
||||
SCNu8
|
||||
SCNu16
|
||||
SCNu32
|
||||
SCNu64
|
||||
|
||||
SCNuLEAST8
|
||||
SCNuLEAST16
|
||||
SCNuLEAST32
|
||||
SCNuLEAST64
|
||||
|
||||
SCNuFAST8
|
||||
SCNuFAST16
|
||||
SCNuFAST32
|
||||
SCNuFAST64
|
||||
|
||||
SCNuMAX
|
||||
SCNuPTR
|
||||
|
||||
SCNx8
|
||||
SCNx16
|
||||
SCNx32
|
||||
SCNx64
|
||||
|
||||
SCNxLEAST8
|
||||
SCNxLEAST16
|
||||
SCNxLEAST32
|
||||
SCNxLEAST64
|
||||
|
||||
SCNxFAST8
|
||||
SCNxFAST16
|
||||
SCNxFAST32
|
||||
SCNxFAST64
|
||||
|
||||
SCNxMAX
|
||||
SCNxPTR
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
imaxdiv_t
|
||||
|
||||
intmax_t imaxabs(intmax_t j);
|
||||
imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
|
||||
intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base);
|
||||
uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base);
|
||||
intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
|
||||
uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cstdint>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using::imaxdiv_t;
|
||||
|
||||
using::imaxabs;
|
||||
using::imaxdiv;
|
||||
using::strtoimax;
|
||||
using::strtoumax;
|
||||
using::wcstoimax;
|
||||
using::wcstoumax;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CINTTYPES
|
25
external/bsd/libc++/dist/libcxx/include/ciso646
vendored
Normal file
25
external/bsd/libc++/dist/libcxx/include/ciso646
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- ciso646 ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CISO646
|
||||
#define _LIBCPP_CISO646
|
||||
|
||||
/*
|
||||
ciso646 synopsis
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CISO646
|
48
external/bsd/libc++/dist/libcxx/include/climits
vendored
Normal file
48
external/bsd/libc++/dist/libcxx/include/climits
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- climits ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CLIMITS
|
||||
#define _LIBCPP_CLIMITS
|
||||
|
||||
/*
|
||||
climits synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
CHAR_BIT
|
||||
SCHAR_MIN
|
||||
SCHAR_MAX
|
||||
UCHAR_MAX
|
||||
CHAR_MIN
|
||||
CHAR_MAX
|
||||
MB_LEN_MAX
|
||||
SHRT_MIN
|
||||
SHRT_MAX
|
||||
USHRT_MAX
|
||||
INT_MIN
|
||||
INT_MAX
|
||||
UINT_MAX
|
||||
LONG_MIN
|
||||
LONG_MAX
|
||||
ULONG_MAX
|
||||
LLONG_MIN // C99
|
||||
LLONG_MAX // C99
|
||||
ULLONG_MAX // C99
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <limits.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CLIMITS
|
53
external/bsd/libc++/dist/libcxx/include/clocale
vendored
Normal file
53
external/bsd/libc++/dist/libcxx/include/clocale
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- clocale ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CLOCALE
|
||||
#define _LIBCPP_CLOCALE
|
||||
|
||||
/*
|
||||
clocale synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
LC_ALL
|
||||
LC_COLLATE
|
||||
LC_CTYPE
|
||||
LC_MONETARY
|
||||
LC_NUMERIC
|
||||
LC_TIME
|
||||
NULL
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
struct lconv;
|
||||
char* setlocale(int category, const char* locale);
|
||||
lconv* localeconv();
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <locale.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::lconv;
|
||||
using ::setlocale;
|
||||
using ::localeconv;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CLOCALE
|
1690
external/bsd/libc++/dist/libcxx/include/cmath
vendored
Normal file
1690
external/bsd/libc++/dist/libcxx/include/cmath
vendored
Normal file
File diff suppressed because it is too large
Load diff
550
external/bsd/libc++/dist/libcxx/include/codecvt
vendored
Normal file
550
external/bsd/libc++/dist/libcxx/include/codecvt
vendored
Normal file
|
@ -0,0 +1,550 @@
|
|||
// -*- C++ -*-
|
||||
//===-------------------------- codecvt -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CODECVT
|
||||
#define _LIBCPP_CODECVT
|
||||
|
||||
/*
|
||||
codecvt synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
enum codecvt_mode
|
||||
{
|
||||
consume_header = 4,
|
||||
generate_header = 2,
|
||||
little_endian = 1
|
||||
};
|
||||
|
||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
codecvt_mode Mode = (codecvt_mode)0>
|
||||
class codecvt_utf8
|
||||
: public codecvt<Elem, char, mbstate_t>
|
||||
{
|
||||
explicit codecvt_utf8(size_t refs = 0);
|
||||
~codecvt_utf8();
|
||||
};
|
||||
|
||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
codecvt_mode Mode = (codecvt_mode)0>
|
||||
class codecvt_utf16
|
||||
: public codecvt<Elem, char, mbstate_t>
|
||||
{
|
||||
explicit codecvt_utf16(size_t refs = 0);
|
||||
~codecvt_utf16();
|
||||
};
|
||||
|
||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
codecvt_mode Mode = (codecvt_mode)0>
|
||||
class codecvt_utf8_utf16
|
||||
: public codecvt<Elem, char, mbstate_t>
|
||||
{
|
||||
explicit codecvt_utf8_utf16(size_t refs = 0);
|
||||
~codecvt_utf8_utf16();
|
||||
};
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__locale>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
enum codecvt_mode
|
||||
{
|
||||
consume_header = 4,
|
||||
generate_header = 2,
|
||||
little_endian = 1
|
||||
};
|
||||
|
||||
// codecvt_utf8
|
||||
|
||||
template <class _Elem> class __codecvt_utf8;
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8
|
||||
: public __codecvt_utf8<_Elem>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_utf8(size_t __refs = 0)
|
||||
: __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf8() {}
|
||||
};
|
||||
|
||||
// codecvt_utf16
|
||||
|
||||
template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf16
|
||||
: public __codecvt_utf16<_Elem, _Mode & little_endian>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_utf16(size_t __refs = 0)
|
||||
: __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf16() {}
|
||||
};
|
||||
|
||||
// codecvt_utf8_utf16
|
||||
|
||||
template <class _Elem> class __codecvt_utf8_utf16;
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8_utf16
|
||||
: public __codecvt_utf8_utf16<_Elem>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_utf8_utf16(size_t __refs = 0)
|
||||
: __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf8_utf16() {}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CODECVT
|
1567
external/bsd/libc++/dist/libcxx/include/complex
vendored
Normal file
1567
external/bsd/libc++/dist/libcxx/include/complex
vendored
Normal file
File diff suppressed because it is too large
Load diff
35
external/bsd/libc++/dist/libcxx/include/complex.h
vendored
Normal file
35
external/bsd/libc++/dist/libcxx/include/complex.h
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- complex.h --------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_COMPLEX_H
|
||||
#define _LIBCPP_COMPLEX_H
|
||||
|
||||
/*
|
||||
complex.h synopsis
|
||||
|
||||
#include <ccomplex>
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <ccomplex>
|
||||
|
||||
#else // __cplusplus
|
||||
|
||||
#include_next <complex.h>
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_COMPLEX_H
|
256
external/bsd/libc++/dist/libcxx/include/condition_variable
vendored
Normal file
256
external/bsd/libc++/dist/libcxx/include/condition_variable
vendored
Normal file
|
@ -0,0 +1,256 @@
|
|||
// -*- C++ -*-
|
||||
//===---------------------- condition_variable ----------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CONDITION_VARIABLE
|
||||
#define _LIBCPP_CONDITION_VARIABLE
|
||||
|
||||
/*
|
||||
condition_variable synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
enum class cv_status { no_timeout, timeout };
|
||||
|
||||
class condition_variable
|
||||
{
|
||||
public:
|
||||
condition_variable();
|
||||
~condition_variable();
|
||||
|
||||
condition_variable(const condition_variable&) = delete;
|
||||
condition_variable& operator=(const condition_variable&) = delete;
|
||||
|
||||
void notify_one() noexcept;
|
||||
void notify_all() noexcept;
|
||||
|
||||
void wait(unique_lock<mutex>& lock);
|
||||
template <class Predicate>
|
||||
void wait(unique_lock<mutex>& lock, Predicate pred);
|
||||
|
||||
template <class Clock, class Duration>
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& lock,
|
||||
const chrono::time_point<Clock, Duration>& abs_time);
|
||||
|
||||
template <class Clock, class Duration, class Predicate>
|
||||
bool
|
||||
wait_until(unique_lock<mutex>& lock,
|
||||
const chrono::time_point<Clock, Duration>& abs_time,
|
||||
Predicate pred);
|
||||
|
||||
template <class Rep, class Period>
|
||||
cv_status
|
||||
wait_for(unique_lock<mutex>& lock,
|
||||
const chrono::duration<Rep, Period>& rel_time);
|
||||
|
||||
template <class Rep, class Period, class Predicate>
|
||||
bool
|
||||
wait_for(unique_lock<mutex>& lock,
|
||||
const chrono::duration<Rep, Period>& rel_time,
|
||||
Predicate pred);
|
||||
|
||||
typedef pthread_cond_t* native_handle_type;
|
||||
native_handle_type native_handle();
|
||||
};
|
||||
|
||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
class condition_variable_any
|
||||
{
|
||||
public:
|
||||
condition_variable_any();
|
||||
~condition_variable_any();
|
||||
|
||||
condition_variable_any(const condition_variable_any&) = delete;
|
||||
condition_variable_any& operator=(const condition_variable_any&) = delete;
|
||||
|
||||
void notify_one() noexcept;
|
||||
void notify_all() noexcept;
|
||||
|
||||
template <class Lock>
|
||||
void wait(Lock& lock);
|
||||
template <class Lock, class Predicate>
|
||||
void wait(Lock& lock, Predicate pred);
|
||||
|
||||
template <class Lock, class Clock, class Duration>
|
||||
cv_status
|
||||
wait_until(Lock& lock,
|
||||
const chrono::time_point<Clock, Duration>& abs_time);
|
||||
|
||||
template <class Lock, class Clock, class Duration, class Predicate>
|
||||
bool
|
||||
wait_until(Lock& lock,
|
||||
const chrono::time_point<Clock, Duration>& abs_time,
|
||||
Predicate pred);
|
||||
|
||||
template <class Lock, class Rep, class Period>
|
||||
cv_status
|
||||
wait_for(Lock& lock,
|
||||
const chrono::duration<Rep, Period>& rel_time);
|
||||
|
||||
template <class Lock, class Rep, class Period, class Predicate>
|
||||
bool
|
||||
wait_for(Lock& lock,
|
||||
const chrono::duration<Rep, Period>& rel_time,
|
||||
Predicate pred);
|
||||
};
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__mutex_base>
|
||||
#include <memory>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_TYPE_VIS condition_variable_any
|
||||
{
|
||||
condition_variable __cv_;
|
||||
shared_ptr<mutex> __mut_;
|
||||
public:
|
||||
condition_variable_any();
|
||||
|
||||
void notify_one() _NOEXCEPT;
|
||||
void notify_all() _NOEXCEPT;
|
||||
|
||||
template <class _Lock>
|
||||
void wait(_Lock& __lock);
|
||||
template <class _Lock, class _Predicate>
|
||||
void wait(_Lock& __lock, _Predicate __pred);
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration>
|
||||
cv_status
|
||||
wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
||||
bool
|
||||
wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred);
|
||||
|
||||
template <class _Lock, class _Rep, class _Period>
|
||||
cv_status
|
||||
wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d);
|
||||
|
||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||
bool
|
||||
wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred);
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
condition_variable_any::condition_variable_any()
|
||||
: __mut_(make_shared<mutex>()) {}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::notify_one() _NOEXCEPT
|
||||
{
|
||||
{lock_guard<mutex> __lx(*__mut_);}
|
||||
__cv_.notify_one();
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::notify_all() _NOEXCEPT
|
||||
{
|
||||
{lock_guard<mutex> __lx(*__mut_);}
|
||||
__cv_.notify_all();
|
||||
}
|
||||
|
||||
struct __lock_external
|
||||
{
|
||||
template <class _Lock>
|
||||
void operator()(_Lock* __m) {__m->lock();}
|
||||
};
|
||||
|
||||
template <class _Lock>
|
||||
void
|
||||
condition_variable_any::wait(_Lock& __lock)
|
||||
{
|
||||
shared_ptr<mutex> __mut = __mut_;
|
||||
unique_lock<mutex> __lk(*__mut);
|
||||
__lock.unlock();
|
||||
unique_ptr<_Lock, __lock_external> __lxx(&__lock);
|
||||
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
|
||||
__cv_.wait(__lk);
|
||||
} // __mut_.unlock(), __lock.lock()
|
||||
|
||||
template <class _Lock, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
|
||||
{
|
||||
while (!__pred())
|
||||
wait(__lock);
|
||||
}
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration>
|
||||
cv_status
|
||||
condition_variable_any::wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
shared_ptr<mutex> __mut = __mut_;
|
||||
unique_lock<mutex> __lk(*__mut);
|
||||
__lock.unlock();
|
||||
unique_ptr<_Lock, __lock_external> __lxx(&__lock);
|
||||
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
|
||||
return __cv_.wait_until(__lk, __t);
|
||||
} // __mut_.unlock(), __lock.lock()
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable_any::wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred)
|
||||
{
|
||||
while (!__pred())
|
||||
if (wait_until(__lock, __t) == cv_status::timeout)
|
||||
return __pred();
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Lock, class _Rep, class _Period>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
cv_status
|
||||
condition_variable_any::wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d);
|
||||
}
|
||||
|
||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable_any::wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d,
|
||||
_VSTD::move(__pred));
|
||||
}
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CONDITION_VARIABLE
|
52
external/bsd/libc++/dist/libcxx/include/csetjmp
vendored
Normal file
52
external/bsd/libc++/dist/libcxx/include/csetjmp
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- csetjmp ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSETJMP
|
||||
#define _LIBCPP_CSETJMP
|
||||
|
||||
/*
|
||||
csetjmp synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
setjmp
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
jmp_buf
|
||||
|
||||
void longjmp(jmp_buf env, int val);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <setjmp.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef setjmp
|
||||
#define setjmp(env) setjmp(env)
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::jmp_buf;
|
||||
using ::longjmp;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSETJMP
|
58
external/bsd/libc++/dist/libcxx/include/csignal
vendored
Normal file
58
external/bsd/libc++/dist/libcxx/include/csignal
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- csignal ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSIGNAL
|
||||
#define _LIBCPP_CSIGNAL
|
||||
|
||||
/*
|
||||
csignal synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
SIG_DFL
|
||||
SIG_ERR
|
||||
SIG_IGN
|
||||
SIGABRT
|
||||
SIGFPE
|
||||
SIGILL
|
||||
SIGINT
|
||||
SIGSEGV
|
||||
SIGTERM
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
sig_atomic_t
|
||||
|
||||
void (*signal(int sig, void (*func)(int)))(int);
|
||||
int raise(int sig);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <signal.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::sig_atomic_t;
|
||||
using ::signal;
|
||||
using ::raise;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSIGNAL
|
48
external/bsd/libc++/dist/libcxx/include/cstdarg
vendored
Normal file
48
external/bsd/libc++/dist/libcxx/include/cstdarg
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- cstdarg ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDARG
|
||||
#define _LIBCPP_CSTDARG
|
||||
|
||||
/*
|
||||
cstdarg synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
type va_arg(va_list ap, type);
|
||||
void va_copy(va_list dest, va_list src); // C99
|
||||
void va_end(va_list ap);
|
||||
void va_start(va_list ap, parmN);
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
va_list
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::va_list;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTDARG
|
32
external/bsd/libc++/dist/libcxx/include/cstdbool
vendored
Normal file
32
external/bsd/libc++/dist/libcxx/include/cstdbool
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- cstdbool ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDBOOL
|
||||
#define _LIBCPP_CSTDBOOL
|
||||
|
||||
/*
|
||||
cstdbool synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
__bool_true_false_are_defined
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#undef __bool_true_false_are_defined
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif // _LIBCPP_CSTDBOOL
|
103
external/bsd/libc++/dist/libcxx/include/cstddef
vendored
Normal file
103
external/bsd/libc++/dist/libcxx/include/cstddef
vendored
Normal file
|
@ -0,0 +1,103 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- cstddef ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDDEF
|
||||
#define _LIBCPP_CSTDDEF
|
||||
|
||||
/*
|
||||
cstddef synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
offsetof(type,member-designator)
|
||||
NULL
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
ptrdiff_t
|
||||
size_t
|
||||
max_align_t
|
||||
nullptr_t
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
|
||||
#ifdef __GLIBC__
|
||||
#define __need_NULL
|
||||
#define __need_ptrdiff_t
|
||||
#define __need_size_t
|
||||
#endif // __GLIBC__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::ptrdiff_t;
|
||||
using ::size_t;
|
||||
|
||||
typedef long double max_align_t;
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
|
||||
{
|
||||
void* __lx;
|
||||
|
||||
struct __nat {int __for_bool_;};
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
|
||||
operator _Tp* () const {return 0;}
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
operator _Tp _Up::* () const {return 0;}
|
||||
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
|
||||
};
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||
|
||||
#define nullptr _VSTD::__get_nullptr_t()
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
namespace std
|
||||
{
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
#endif // _LIBCPP_CSTDDEF
|
191
external/bsd/libc++/dist/libcxx/include/cstdint
vendored
Normal file
191
external/bsd/libc++/dist/libcxx/include/cstdint
vendored
Normal file
|
@ -0,0 +1,191 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- cstdint ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDINT
|
||||
#define _LIBCPP_CSTDINT
|
||||
|
||||
/*
|
||||
cstdint synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
INT8_MIN
|
||||
INT16_MIN
|
||||
INT32_MIN
|
||||
INT64_MIN
|
||||
|
||||
INT8_MAX
|
||||
INT16_MAX
|
||||
INT32_MAX
|
||||
INT64_MAX
|
||||
|
||||
UINT8_MAX
|
||||
UINT16_MAX
|
||||
UINT32_MAX
|
||||
UINT64_MAX
|
||||
|
||||
INT_LEAST8_MIN
|
||||
INT_LEAST16_MIN
|
||||
INT_LEAST32_MIN
|
||||
INT_LEAST64_MIN
|
||||
|
||||
INT_LEAST8_MAX
|
||||
INT_LEAST16_MAX
|
||||
INT_LEAST32_MAX
|
||||
INT_LEAST64_MAX
|
||||
|
||||
UINT_LEAST8_MAX
|
||||
UINT_LEAST16_MAX
|
||||
UINT_LEAST32_MAX
|
||||
UINT_LEAST64_MAX
|
||||
|
||||
INT_FAST8_MIN
|
||||
INT_FAST16_MIN
|
||||
INT_FAST32_MIN
|
||||
INT_FAST64_MIN
|
||||
|
||||
INT_FAST8_MAX
|
||||
INT_FAST16_MAX
|
||||
INT_FAST32_MAX
|
||||
INT_FAST64_MAX
|
||||
|
||||
UINT_FAST8_MAX
|
||||
UINT_FAST16_MAX
|
||||
UINT_FAST32_MAX
|
||||
UINT_FAST64_MAX
|
||||
|
||||
INTPTR_MIN
|
||||
INTPTR_MAX
|
||||
UINTPTR_MAX
|
||||
|
||||
INTMAX_MIN
|
||||
INTMAX_MAX
|
||||
|
||||
UINTMAX_MAX
|
||||
|
||||
PTRDIFF_MIN
|
||||
PTRDIFF_MAX
|
||||
|
||||
SIG_ATOMIC_MIN
|
||||
SIG_ATOMIC_MAX
|
||||
|
||||
SIZE_MAX
|
||||
|
||||
WCHAR_MIN
|
||||
WCHAR_MAX
|
||||
|
||||
WINT_MIN
|
||||
WINT_MAX
|
||||
|
||||
INT8_C(value)
|
||||
INT16_C(value)
|
||||
INT32_C(value)
|
||||
INT64_C(value)
|
||||
|
||||
UINT8_C(value)
|
||||
UINT16_C(value)
|
||||
UINT32_C(value)
|
||||
UINT64_C(value)
|
||||
|
||||
INTMAX_C(value)
|
||||
UINTMAX_C(value)
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
int8_t
|
||||
int16_t
|
||||
int32_t
|
||||
int64_t
|
||||
|
||||
uint8_t
|
||||
uint16_t
|
||||
uint32_t
|
||||
uint64_t
|
||||
|
||||
int_least8_t
|
||||
int_least16_t
|
||||
int_least32_t
|
||||
int_least64_t
|
||||
|
||||
uint_least8_t
|
||||
uint_least16_t
|
||||
uint_least32_t
|
||||
uint_least64_t
|
||||
|
||||
int_fast8_t
|
||||
int_fast16_t
|
||||
int_fast32_t
|
||||
int_fast64_t
|
||||
|
||||
uint_fast8_t
|
||||
uint_fast16_t
|
||||
uint_fast32_t
|
||||
uint_fast64_t
|
||||
|
||||
intptr_t
|
||||
uintptr_t
|
||||
|
||||
intmax_t
|
||||
uintmax_t
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <stdint.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using::int8_t;
|
||||
using::int16_t;
|
||||
using::int32_t;
|
||||
using::int64_t;
|
||||
|
||||
using::uint8_t;
|
||||
using::uint16_t;
|
||||
using::uint32_t;
|
||||
using::uint64_t;
|
||||
|
||||
using::int_least8_t;
|
||||
using::int_least16_t;
|
||||
using::int_least32_t;
|
||||
using::int_least64_t;
|
||||
|
||||
using::uint_least8_t;
|
||||
using::uint_least16_t;
|
||||
using::uint_least32_t;
|
||||
using::uint_least64_t;
|
||||
|
||||
using::int_fast8_t;
|
||||
using::int_fast16_t;
|
||||
using::int_fast32_t;
|
||||
using::int_fast64_t;
|
||||
|
||||
using::uint_fast8_t;
|
||||
using::uint_fast16_t;
|
||||
using::uint_fast32_t;
|
||||
using::uint_fast64_t;
|
||||
|
||||
using::intptr_t;
|
||||
using::uintptr_t;
|
||||
|
||||
using::intmax_t;
|
||||
using::uintmax_t;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTDINT
|
182
external/bsd/libc++/dist/libcxx/include/cstdio
vendored
Normal file
182
external/bsd/libc++/dist/libcxx/include/cstdio
vendored
Normal file
|
@ -0,0 +1,182 @@
|
|||
// -*- C++ -*-
|
||||
//===---------------------------- cstdio ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDIO
|
||||
#define _LIBCPP_CSTDIO
|
||||
|
||||
/*
|
||||
cstdio synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
BUFSIZ
|
||||
EOF
|
||||
FILENAME_MAX
|
||||
FOPEN_MAX
|
||||
L_tmpnam
|
||||
NULL
|
||||
SEEK_CUR
|
||||
SEEK_END
|
||||
SEEK_SET
|
||||
TMP_MAX
|
||||
_IOFBF
|
||||
_IOLBF
|
||||
_IONBF
|
||||
stderr
|
||||
stdin
|
||||
stdout
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
FILE
|
||||
fpos_t
|
||||
size_t
|
||||
|
||||
int remove(const char* filename);
|
||||
int rename(const char* old, const char* new);
|
||||
FILE* tmpfile(void);
|
||||
char* tmpnam(char* s);
|
||||
int fclose(FILE* stream);
|
||||
int fflush(FILE* stream);
|
||||
FILE* fopen(const char* restrict filename, const char* restrict mode);
|
||||
FILE* freopen(const char* restrict filename, const char * restrict mode,
|
||||
FILE * restrict stream);
|
||||
void setbuf(FILE* restrict stream, char* restrict buf);
|
||||
int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
|
||||
int fprintf(FILE* restrict stream, const char* restrict format, ...);
|
||||
int fscanf(FILE* restrict stream, const char * restrict format, ...);
|
||||
int printf(const char* restrict format, ...);
|
||||
int scanf(const char* restrict format, ...);
|
||||
int snprintf(char* restrict s, size_t n, const char* restrict format, ...); // C99
|
||||
int sprintf(char* restrict s, const char* restrict format, ...);
|
||||
int sscanf(const char* restrict s, const char* restrict format, ...);
|
||||
int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
|
||||
int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); // C99
|
||||
int vprintf(const char* restrict format, va_list arg);
|
||||
int vscanf(const char* restrict format, va_list arg); // C99
|
||||
int vsnprintf(char* restrict s, size_t n, const char* restrict format, // C99
|
||||
va_list arg);
|
||||
int vsprintf(char* restrict s, const char* restrict format, va_list arg);
|
||||
int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
|
||||
int fgetc(FILE* stream);
|
||||
char* fgets(char* restrict s, int n, FILE* restrict stream);
|
||||
int fputc(int c, FILE* stream);
|
||||
int fputs(const char* restrict s, FILE* restrict stream);
|
||||
int getc(FILE* stream);
|
||||
int getchar(void);
|
||||
char* gets(char* s); // removed in C++14
|
||||
int putc(int c, FILE* stream);
|
||||
int putchar(int c);
|
||||
int puts(const char* s);
|
||||
int ungetc(int c, FILE* stream);
|
||||
size_t fread(void* restrict ptr, size_t size, size_t nmemb,
|
||||
FILE* restrict stream);
|
||||
size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
|
||||
FILE* restrict stream);
|
||||
int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
|
||||
int fseek(FILE* stream, long offset, int whence);
|
||||
int fsetpos(FILE*stream, const fpos_t* pos);
|
||||
long ftell(FILE* stream);
|
||||
void rewind(FILE* stream);
|
||||
void clearerr(FILE* stream);
|
||||
int feof(FILE* stream);
|
||||
int ferror(FILE* stream);
|
||||
void perror(const char* s);
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <stdio.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
// snprintf
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
#include "support/win32/support.h"
|
||||
#endif
|
||||
|
||||
#ifdef getc
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
|
||||
#undef getc
|
||||
inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
|
||||
#endif // getc
|
||||
|
||||
#ifdef putc
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
|
||||
#undef putc
|
||||
inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
|
||||
#endif // putc
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::FILE;
|
||||
using ::fpos_t;
|
||||
using ::size_t;
|
||||
|
||||
using ::remove;
|
||||
using ::rename;
|
||||
using ::tmpfile;
|
||||
using ::tmpnam;
|
||||
using ::fclose;
|
||||
using ::fflush;
|
||||
using ::fopen;
|
||||
using ::freopen;
|
||||
using ::setbuf;
|
||||
using ::setvbuf;
|
||||
using ::fprintf;
|
||||
using ::fscanf;
|
||||
using ::printf;
|
||||
using ::scanf;
|
||||
using ::snprintf;
|
||||
using ::sprintf;
|
||||
using ::sscanf;
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::vfprintf;
|
||||
using ::vfscanf;
|
||||
using ::vscanf;
|
||||
using ::vsscanf;
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
using ::vprintf;
|
||||
using ::vsnprintf;
|
||||
using ::vsprintf;
|
||||
using ::fgetc;
|
||||
using ::fgets;
|
||||
using ::fputc;
|
||||
using ::fputs;
|
||||
using ::getc;
|
||||
using ::getchar;
|
||||
#if _LIBCPP_STD_VER <= 11
|
||||
using ::gets;
|
||||
#endif
|
||||
using ::putc;
|
||||
using ::putchar;
|
||||
using ::puts;
|
||||
using ::ungetc;
|
||||
using ::fread;
|
||||
using ::fwrite;
|
||||
using ::fgetpos;
|
||||
using ::fseek;
|
||||
using ::fsetpos;
|
||||
using ::ftell;
|
||||
using ::rewind;
|
||||
using ::clearerr;
|
||||
using ::feof;
|
||||
using ::ferror;
|
||||
using ::perror;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTDIO
|
172
external/bsd/libc++/dist/libcxx/include/cstdlib
vendored
Normal file
172
external/bsd/libc++/dist/libcxx/include/cstdlib
vendored
Normal file
|
@ -0,0 +1,172 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- cstdlib ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDLIB
|
||||
#define _LIBCPP_CSTDLIB
|
||||
|
||||
/*
|
||||
cstdlib synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
EXIT_FAILURE
|
||||
EXIT_SUCCESS
|
||||
MB_CUR_MAX
|
||||
NULL
|
||||
RAND_MAX
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
size_t
|
||||
div_t
|
||||
ldiv_t
|
||||
lldiv_t // C99
|
||||
|
||||
double atof (const char* nptr);
|
||||
int atoi (const char* nptr);
|
||||
long atol (const char* nptr);
|
||||
long long atoll(const char* nptr); // C99
|
||||
double strtod (const char* restrict nptr, char** restrict endptr);
|
||||
float strtof (const char* restrict nptr, char** restrict endptr); // C99
|
||||
long double strtold (const char* restrict nptr, char** restrict endptr); // C99
|
||||
long strtol (const char* restrict nptr, char** restrict endptr, int base);
|
||||
long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99
|
||||
unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base);
|
||||
unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99
|
||||
int rand(void);
|
||||
void srand(unsigned int seed);
|
||||
void* calloc(size_t nmemb, size_t size);
|
||||
void free(void* ptr);
|
||||
void* malloc(size_t size);
|
||||
void* realloc(void* ptr, size_t size);
|
||||
void abort(void);
|
||||
int atexit(void (*func)(void));
|
||||
void exit(int status);
|
||||
void _Exit(int status);
|
||||
char* getenv(const char* name);
|
||||
int system(const char* string);
|
||||
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
|
||||
int (*compar)(const void *, const void *));
|
||||
void qsort(void* base, size_t nmemb, size_t size,
|
||||
int (*compar)(const void *, const void *));
|
||||
int abs( int j);
|
||||
long abs( long j);
|
||||
long long abs(long long j); // C++0X
|
||||
long labs( long j);
|
||||
long long llabs(long long j); // C99
|
||||
div_t div( int numer, int denom);
|
||||
ldiv_t div( long numer, long denom);
|
||||
lldiv_t div(long long numer, long long denom); // C++0X
|
||||
ldiv_t ldiv( long numer, long denom);
|
||||
lldiv_t lldiv(long long numer, long long denom); // C99
|
||||
int mblen(const char* s, size_t n);
|
||||
int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
|
||||
int wctomb(char* s, wchar_t wchar);
|
||||
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
|
||||
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
|
||||
int at_quick_exit(void (*func)(void)) // C++11
|
||||
void quick_exit(int status); // C++11
|
||||
void *aligned_alloc(size_t alignment, size_t size); // C11
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <stdlib.h>
|
||||
#ifdef _LIBCPP_MSVCRT
|
||||
#include "support/win32/locale_win32.h"
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::size_t;
|
||||
using ::div_t;
|
||||
using ::ldiv_t;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::lldiv_t;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::atof;
|
||||
using ::atoi;
|
||||
using ::atol;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::atoll;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::strtod;
|
||||
using ::strtof;
|
||||
using ::strtold;
|
||||
using ::strtol;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::strtoll;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::strtoul;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::strtoull;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::rand;
|
||||
using ::srand;
|
||||
using ::calloc;
|
||||
using ::free;
|
||||
using ::malloc;
|
||||
using ::realloc;
|
||||
using ::abort;
|
||||
using ::atexit;
|
||||
using ::exit;
|
||||
using ::_Exit;
|
||||
using ::getenv;
|
||||
using ::system;
|
||||
using ::bsearch;
|
||||
using ::qsort;
|
||||
using ::abs;
|
||||
using ::labs;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::llabs;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::div;
|
||||
using ::ldiv;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::lldiv;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::mblen;
|
||||
using ::mbtowc;
|
||||
using ::wctomb;
|
||||
using ::mbstowcs;
|
||||
using ::wcstombs;
|
||||
#ifdef _LIBCPP_HAS_QUICK_EXIT
|
||||
using ::at_quick_exit;
|
||||
using ::quick_exit;
|
||||
#endif
|
||||
#ifdef _LIBCPP_HAS_C11_FEATURES
|
||||
using ::aligned_alloc;
|
||||
#endif
|
||||
|
||||
// MSVCRT already has the correct prototype in <stdlib.h> #ifdef __cplusplus
|
||||
#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
|
||||
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTDLIB
|
112
external/bsd/libc++/dist/libcxx/include/cstring
vendored
Normal file
112
external/bsd/libc++/dist/libcxx/include/cstring
vendored
Normal file
|
@ -0,0 +1,112 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- cstring ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTRING
|
||||
#define _LIBCPP_CSTRING
|
||||
|
||||
/*
|
||||
cstring synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
NULL
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
size_t
|
||||
|
||||
void* memcpy(void* restrict s1, const void* restrict s2, size_t n);
|
||||
void* memmove(void* s1, const void* s2, size_t n);
|
||||
char* strcpy (char* restrict s1, const char* restrict s2);
|
||||
char* strncpy(char* restrict s1, const char* restrict s2, size_t n);
|
||||
char* strcat (char* restrict s1, const char* restrict s2);
|
||||
char* strncat(char* restrict s1, const char* restrict s2, size_t n);
|
||||
int memcmp(const void* s1, const void* s2, size_t n);
|
||||
int strcmp (const char* s1, const char* s2);
|
||||
int strncmp(const char* s1, const char* s2, size_t n);
|
||||
int strcoll(const char* s1, const char* s2);
|
||||
size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n);
|
||||
const void* memchr(const void* s, int c, size_t n);
|
||||
void* memchr( void* s, int c, size_t n);
|
||||
const char* strchr(const char* s, int c);
|
||||
char* strchr( char* s, int c);
|
||||
size_t strcspn(const char* s1, const char* s2);
|
||||
const char* strpbrk(const char* s1, const char* s2);
|
||||
char* strpbrk( char* s1, const char* s2);
|
||||
const char* strrchr(const char* s, int c);
|
||||
char* strrchr( char* s, int c);
|
||||
size_t strspn(const char* s1, const char* s2);
|
||||
const char* strstr(const char* s1, const char* s2);
|
||||
char* strstr( char* s1, const char* s2);
|
||||
char* strtok(char* restrict s1, const char* restrict s2);
|
||||
void* memset(void* s, int c, size_t n);
|
||||
char* strerror(int errnum);
|
||||
size_t strlen(const char* s);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::size_t;
|
||||
using ::memcpy;
|
||||
using ::memmove;
|
||||
using ::strcpy;
|
||||
using ::strncpy;
|
||||
using ::strcat;
|
||||
using ::strncat;
|
||||
using ::memcmp;
|
||||
using ::strcmp;
|
||||
using ::strncmp;
|
||||
using ::strcoll;
|
||||
using ::strxfrm;
|
||||
|
||||
using ::memchr;
|
||||
|
||||
using ::strchr;
|
||||
|
||||
using ::strcspn;
|
||||
|
||||
using ::strpbrk;
|
||||
|
||||
using ::strrchr;
|
||||
|
||||
using ::strspn;
|
||||
|
||||
using ::strstr;
|
||||
|
||||
// MSVCRT, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
|
||||
#if !defined(__GLIBC__) && !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
|
||||
#endif
|
||||
|
||||
using ::strtok;
|
||||
using ::memset;
|
||||
using ::strerror;
|
||||
using ::strlen;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTRING
|
29
external/bsd/libc++/dist/libcxx/include/ctgmath
vendored
Normal file
29
external/bsd/libc++/dist/libcxx/include/ctgmath
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
// -*- C++ -*-
|
||||
//===-------------------------- ctgmath -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CTGMATH
|
||||
#define _LIBCPP_CTGMATH
|
||||
|
||||
/*
|
||||
ctgmath synopsis
|
||||
|
||||
#include <ccomplex>
|
||||
#include <cmath>
|
||||
|
||||
*/
|
||||
|
||||
#include <ccomplex>
|
||||
#include <cmath>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CTGMATH
|
72
external/bsd/libc++/dist/libcxx/include/ctime
vendored
Normal file
72
external/bsd/libc++/dist/libcxx/include/ctime
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
// -*- C++ -*-
|
||||
//===---------------------------- ctime -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CTIME
|
||||
#define _LIBCPP_CTIME
|
||||
|
||||
/*
|
||||
ctime synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
NULL
|
||||
CLOCKS_PER_SEC
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
clock_t
|
||||
size_t
|
||||
time_t
|
||||
tm
|
||||
|
||||
clock_t clock();
|
||||
double difftime(time_t time1, time_t time0);
|
||||
time_t mktime(tm* timeptr);
|
||||
time_t time(time_t* timer);
|
||||
char* asctime(const tm* timeptr);
|
||||
char* ctime(const time_t* timer);
|
||||
tm* gmtime(const time_t* timer);
|
||||
tm* localtime(const time_t* timer);
|
||||
size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
|
||||
const tm* restrict timeptr);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <time.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::clock_t;
|
||||
using ::size_t;
|
||||
using ::time_t;
|
||||
using ::tm;
|
||||
using ::clock;
|
||||
using ::difftime;
|
||||
using ::mktime;
|
||||
using ::time;
|
||||
using ::asctime;
|
||||
using ::ctime;
|
||||
using ::gmtime;
|
||||
using ::localtime;
|
||||
using ::strftime;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CTIME
|
217
external/bsd/libc++/dist/libcxx/include/cwchar
vendored
Normal file
217
external/bsd/libc++/dist/libcxx/include/cwchar
vendored
Normal file
|
@ -0,0 +1,217 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- cwchar -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CWCHAR
|
||||
#define _LIBCPP_CWCHAR
|
||||
|
||||
/*
|
||||
cwchar synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
NULL
|
||||
WCHAR_MAX
|
||||
WCHAR_MIN
|
||||
WEOF
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
mbstate_t
|
||||
size_t
|
||||
tm
|
||||
wint_t
|
||||
|
||||
int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
|
||||
int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
|
||||
int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
|
||||
int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
|
||||
int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
|
||||
int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99
|
||||
int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
|
||||
int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99
|
||||
int vwprintf(const wchar_t* restrict format, va_list arg);
|
||||
int vwscanf(const wchar_t* restrict format, va_list arg); // C99
|
||||
int wprintf(const wchar_t* restrict format, ...);
|
||||
int wscanf(const wchar_t* restrict format, ...);
|
||||
wint_t fgetwc(FILE* stream);
|
||||
wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
|
||||
wint_t fputwc(wchar_t c, FILE* stream);
|
||||
int fputws(const wchar_t* restrict s, FILE* restrict stream);
|
||||
int fwide(FILE* stream, int mode);
|
||||
wint_t getwc(FILE* stream);
|
||||
wint_t getwchar();
|
||||
wint_t putwc(wchar_t c, FILE* stream);
|
||||
wint_t putwchar(wchar_t c);
|
||||
wint_t ungetwc(wint_t c, FILE* stream);
|
||||
double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
|
||||
float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
|
||||
long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
|
||||
long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
|
||||
long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
|
||||
unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
|
||||
unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
|
||||
wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
|
||||
wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
||||
wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
|
||||
wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
||||
int wcscmp(const wchar_t* s1, const wchar_t* s2);
|
||||
int wcscoll(const wchar_t* s1, const wchar_t* s2);
|
||||
int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
|
||||
size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
||||
const wchar_t* wcschr(const wchar_t* s, wchar_t c);
|
||||
wchar_t* wcschr( wchar_t* s, wchar_t c);
|
||||
size_t wcscspn(const wchar_t* s1, const wchar_t* s2);
|
||||
size_t wcslen(const wchar_t* s);
|
||||
const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
|
||||
wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2);
|
||||
const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
|
||||
wchar_t* wcsrchr( wchar_t* s, wchar_t c);
|
||||
size_t wcsspn(const wchar_t* s1, const wchar_t* s2);
|
||||
const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
|
||||
wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2);
|
||||
wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
|
||||
const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
|
||||
wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n);
|
||||
int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
||||
wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
||||
wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
|
||||
wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
|
||||
size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
|
||||
const tm* restrict timeptr);
|
||||
wint_t btowc(int c);
|
||||
int wctob(wint_t c);
|
||||
int mbsinit(const mbstate_t* ps);
|
||||
size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
|
||||
size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
|
||||
size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
|
||||
size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
|
||||
mbstate_t* restrict ps);
|
||||
size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
|
||||
mbstate_t* restrict ps);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cwctype>
|
||||
#include <wchar.h>
|
||||
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||
#include <support/win32/support.h> // pull in *swprintf defines
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::mbstate_t;
|
||||
using ::size_t;
|
||||
using ::tm;
|
||||
using ::wint_t;
|
||||
using ::FILE;
|
||||
using ::fwprintf;
|
||||
using ::fwscanf;
|
||||
using ::swprintf;
|
||||
using ::vfwprintf;
|
||||
using ::vswprintf;
|
||||
using ::vwprintf;
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::swscanf;
|
||||
using ::vfwscanf;
|
||||
using ::vswscanf;
|
||||
using ::vwscanf;
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
using ::wprintf;
|
||||
using ::wscanf;
|
||||
using ::fgetwc;
|
||||
using ::fgetws;
|
||||
using ::fputwc;
|
||||
using ::fputws;
|
||||
using ::fwide;
|
||||
using ::getwc;
|
||||
using ::getwchar;
|
||||
using ::putwc;
|
||||
using ::putwchar;
|
||||
using ::ungetwc;
|
||||
using ::wcstod;
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::wcstof;
|
||||
using ::wcstold;
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
using ::wcstol;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::wcstoll;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::wcstoul;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::wcstoull;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::wcscpy;
|
||||
using ::wcsncpy;
|
||||
using ::wcscat;
|
||||
using ::wcsncat;
|
||||
using ::wcscmp;
|
||||
using ::wcscoll;
|
||||
using ::wcsncmp;
|
||||
using ::wcsxfrm;
|
||||
|
||||
#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
|
||||
|
||||
using ::wcschr;
|
||||
using ::wcspbrk;
|
||||
using ::wcsrchr;
|
||||
using ::wcsstr;
|
||||
using ::wmemchr;
|
||||
|
||||
#else
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
|
||||
|
||||
#endif
|
||||
|
||||
using ::wcscspn;
|
||||
using ::wcslen;
|
||||
using ::wcsspn;
|
||||
using ::wcstok;
|
||||
using ::wmemcmp;
|
||||
using ::wmemcpy;
|
||||
using ::wmemmove;
|
||||
using ::wmemset;
|
||||
using ::wcsftime;
|
||||
using ::btowc;
|
||||
using ::wctob;
|
||||
using ::mbsinit;
|
||||
using ::mbrlen;
|
||||
using ::mbrtowc;
|
||||
using ::wcrtomb;
|
||||
using ::mbsrtowcs;
|
||||
using ::wcsrtombs;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CWCHAR
|
213
external/bsd/libc++/dist/libcxx/include/cwctype
vendored
Normal file
213
external/bsd/libc++/dist/libcxx/include/cwctype
vendored
Normal file
|
@ -0,0 +1,213 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- cwctype ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CWCTYPE
|
||||
#define _LIBCPP_CWCTYPE
|
||||
|
||||
/*
|
||||
cwctype synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
WEOF
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
wint_t
|
||||
wctrans_t
|
||||
wctype_t
|
||||
|
||||
int iswalnum(wint_t wc);
|
||||
int iswalpha(wint_t wc);
|
||||
int iswblank(wint_t wc); // C99
|
||||
int iswcntrl(wint_t wc);
|
||||
int iswdigit(wint_t wc);
|
||||
int iswgraph(wint_t wc);
|
||||
int iswlower(wint_t wc);
|
||||
int iswprint(wint_t wc);
|
||||
int iswpunct(wint_t wc);
|
||||
int iswspace(wint_t wc);
|
||||
int iswupper(wint_t wc);
|
||||
int iswxdigit(wint_t wc);
|
||||
int iswctype(wint_t wc, wctype_t desc);
|
||||
wctype_t wctype(const char* property);
|
||||
wint_t towlower(wint_t wc);
|
||||
wint_t towupper(wint_t wc);
|
||||
wint_t towctrans(wint_t wc, wctrans_t desc);
|
||||
wctrans_t wctrans(const char* property);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cctype>
|
||||
#include <wctype.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::wint_t;
|
||||
using ::wctrans_t;
|
||||
using ::wctype_t;
|
||||
|
||||
#ifdef iswalnum
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalnum(wint_t __wc) {return iswalnum(__wc);}
|
||||
#undef iswalnum
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswalnum(wint_t __wc) {return __libcpp_iswalnum(__wc);}
|
||||
#else // iswalnum
|
||||
using ::iswalnum;
|
||||
#endif
|
||||
|
||||
#ifdef iswalpha
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalpha(wint_t __wc) {return iswalpha(__wc);}
|
||||
#undef iswalpha
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswalpha(wint_t __wc) {return __libcpp_iswalpha(__wc);}
|
||||
#else // iswalpha
|
||||
using ::iswalpha;
|
||||
#endif
|
||||
|
||||
#ifdef iswblank
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswblank(wint_t __wc) {return iswblank(__wc);}
|
||||
#undef iswblank
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswblank(wint_t __wc) {return __libcpp_iswblank(__wc);}
|
||||
#else // iswblank
|
||||
using ::iswblank;
|
||||
#endif
|
||||
|
||||
#ifdef iswcntrl
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswcntrl(wint_t __wc) {return iswcntrl(__wc);}
|
||||
#undef iswcntrl
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswcntrl(wint_t __wc) {return __libcpp_iswcntrl(__wc);}
|
||||
#else // iswcntrl
|
||||
using ::iswcntrl;
|
||||
#endif
|
||||
|
||||
#ifdef iswdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswdigit(wint_t __wc) {return iswdigit(__wc);}
|
||||
#undef iswdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswdigit(wint_t __wc) {return __libcpp_iswdigit(__wc);}
|
||||
#else // iswdigit
|
||||
using ::iswdigit;
|
||||
#endif
|
||||
|
||||
#ifdef iswgraph
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswgraph(wint_t __wc) {return iswgraph(__wc);}
|
||||
#undef iswgraph
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswgraph(wint_t __wc) {return __libcpp_iswgraph(__wc);}
|
||||
#else // iswgraph
|
||||
using ::iswgraph;
|
||||
#endif
|
||||
|
||||
#ifdef iswlower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswlower(wint_t __wc) {return iswlower(__wc);}
|
||||
#undef iswlower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswlower(wint_t __wc) {return __libcpp_iswlower(__wc);}
|
||||
#else // iswlower
|
||||
using ::iswlower;
|
||||
#endif
|
||||
|
||||
#ifdef iswprint
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswprint(wint_t __wc) {return iswprint(__wc);}
|
||||
#undef iswprint
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswprint(wint_t __wc) {return __libcpp_iswprint(__wc);}
|
||||
#else // iswprint
|
||||
using ::iswprint;
|
||||
#endif
|
||||
|
||||
#ifdef iswpunct
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswpunct(wint_t __wc) {return iswpunct(__wc);}
|
||||
#undef iswpunct
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswpunct(wint_t __wc) {return __libcpp_iswpunct(__wc);}
|
||||
#else // iswpunct
|
||||
using ::iswpunct;
|
||||
#endif
|
||||
|
||||
#ifdef iswspace
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswspace(wint_t __wc) {return iswspace(__wc);}
|
||||
#undef iswspace
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswspace(wint_t __wc) {return __libcpp_iswspace(__wc);}
|
||||
#else // iswspace
|
||||
using ::iswspace;
|
||||
#endif
|
||||
|
||||
#ifdef iswupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswupper(wint_t __wc) {return iswupper(__wc);}
|
||||
#undef iswupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswupper(wint_t __wc) {return __libcpp_iswupper(__wc);}
|
||||
#else // iswupper
|
||||
using ::iswupper;
|
||||
#endif
|
||||
|
||||
#ifdef iswxdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswxdigit(wint_t __wc) {return iswxdigit(__wc);}
|
||||
#undef iswxdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswxdigit(wint_t __wc) {return __libcpp_iswxdigit(__wc);}
|
||||
#else // iswxdigit
|
||||
using ::iswxdigit;
|
||||
#endif
|
||||
|
||||
#ifdef iswctype
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswctype(wint_t __w, wctype_t __d) {return iswctype(__w, __d);}
|
||||
#undef iswctype
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswctype(wint_t __w, wctype_t __d) {return __libcpp_iswctype(__w, __d);}
|
||||
#else // iswctype
|
||||
using ::iswctype;
|
||||
#endif
|
||||
|
||||
#ifdef wctype
|
||||
inline _LIBCPP_INLINE_VISIBILITY wctype_t __libcpp_wctype(const char* __p) {return wctype(__p);}
|
||||
#undef wctype
|
||||
inline _LIBCPP_INLINE_VISIBILITY wctype_t wctype(const char* __p) {return __libcpp_wctype(__p);}
|
||||
#else // wctype
|
||||
using ::wctype;
|
||||
#endif
|
||||
|
||||
#ifdef towlower
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towlower(wint_t __wc) {return towlower(__wc);}
|
||||
#undef towlower
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t towlower(wint_t __wc) {return __libcpp_towlower(__wc);}
|
||||
#else // towlower
|
||||
using ::towlower;
|
||||
#endif
|
||||
|
||||
#ifdef towupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towupper(wint_t __wc) {return towupper(__wc);}
|
||||
#undef towupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t towupper(wint_t __wc) {return __libcpp_towupper(__wc);}
|
||||
#else // towupper
|
||||
using ::towupper;
|
||||
#endif
|
||||
|
||||
#ifdef towctrans
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towctrans(wint_t __wc, wctype_t __d) {return towctrans(__wc, __d);}
|
||||
#undef towctrans
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t towctrans(wint_t __wc, wctype_t __d) {return __libcpp_towctrans(__wc, __d);}
|
||||
#else // towctrans
|
||||
using ::towctrans;
|
||||
#endif
|
||||
|
||||
#ifdef wctrans
|
||||
inline _LIBCPP_INLINE_VISIBILITY wctrans_t __libcpp_wctrans(const char* __p) {return wctrans(__p);}
|
||||
#undef wctrans
|
||||
inline _LIBCPP_INLINE_VISIBILITY wctrans_t wctrans(const char* __p) {return __libcpp_wctrans(__p);}
|
||||
#else // wctrans
|
||||
using ::wctrans;
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CWCTYPE
|
2873
external/bsd/libc++/dist/libcxx/include/deque
vendored
Normal file
2873
external/bsd/libc++/dist/libcxx/include/deque
vendored
Normal file
File diff suppressed because it is too large
Load diff
311
external/bsd/libc++/dist/libcxx/include/dynarray
vendored
Normal file
311
external/bsd/libc++/dist/libcxx/include/dynarray
vendored
Normal file
|
@ -0,0 +1,311 @@
|
|||
// -*- C++ -*-
|
||||
//===-------------------------- dynarray ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_DYNARRAY
|
||||
#define _LIBCPP_DYNARRAY
|
||||
|
||||
#include <__config>
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
/*
|
||||
dynarray synopsis
|
||||
|
||||
namespace std {
|
||||
|
||||
template< typename T >
|
||||
class dynarray
|
||||
{
|
||||
// types:
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef implementation-defined iterator;
|
||||
typedef implementation-defined const_iterator;
|
||||
typedef reverse_iterator<iterator> reverse_iterator;
|
||||
typedef reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
public:
|
||||
// construct/copy/destroy:
|
||||
explicit dynarray(size_type c);
|
||||
template <typename Alloc>
|
||||
dynarray(size_type c, const Alloc& alloc);
|
||||
dynarray(size_type c, const T& v);
|
||||
template <typename Alloc>
|
||||
dynarray(size_type c, const T& v, const Alloc& alloc);
|
||||
dynarray(const dynarray& d);
|
||||
template <typename Alloc>
|
||||
dynarray(const dynarray& d, const Alloc& alloc);
|
||||
dynarray(initializer_list<T>);
|
||||
template <typename Alloc>
|
||||
dynarray(initializer_list<T>, const Alloc& alloc);
|
||||
|
||||
dynarray& operator=(const dynarray&) = delete;
|
||||
~dynarray();
|
||||
|
||||
// iterators:
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// capacity:
|
||||
size_type size() const noexcept;
|
||||
size_type max_size() const noexcept;
|
||||
bool empty() const noexcept;
|
||||
|
||||
// element access:
|
||||
reference operator[](size_type n);
|
||||
const_reference operator[](size_type n) const;
|
||||
|
||||
reference front();
|
||||
const_reference front() const;
|
||||
reference back();
|
||||
const_reference back() const;
|
||||
|
||||
const_reference at(size_type n) const;
|
||||
reference at(size_type n);
|
||||
|
||||
// data access:
|
||||
T* data() noexcept;
|
||||
const T* data() const noexcept;
|
||||
|
||||
// mutating member functions:
|
||||
void fill(const T& v);
|
||||
};
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__functional_base>
|
||||
#include <iterator>
|
||||
#include <stdexcept>
|
||||
#include <initializer_list>
|
||||
#include <new>
|
||||
#include <algorithm>
|
||||
|
||||
#if defined(_LIBCPP_NO_EXCEPTIONS)
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY dynarray
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
typedef dynarray __self;
|
||||
typedef _Tp value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef value_type* iterator;
|
||||
typedef const value_type* const_iterator;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
private:
|
||||
size_t __size_;
|
||||
value_type * __base_;
|
||||
_LIBCPP_ALWAYS_INLINE dynarray () noexcept : __base_(nullptr), __size_(0) {}
|
||||
|
||||
static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count )
|
||||
{
|
||||
if ( numeric_limits<size_t>::max() / sizeof (value_type) <= count )
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw bad_array_length();
|
||||
#else
|
||||
assert(!"dynarray::allocation");
|
||||
#endif
|
||||
}
|
||||
return static_cast<value_type *> (::operator new (sizeof(value_type) * count));
|
||||
}
|
||||
|
||||
static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept
|
||||
{
|
||||
::operator delete (static_cast<void *> (__ptr));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit dynarray(size_type __c);
|
||||
dynarray(size_type __c, const value_type& __v);
|
||||
dynarray(const dynarray& __d);
|
||||
dynarray(initializer_list<value_type>);
|
||||
|
||||
// We're not implementing these right now.
|
||||
// Waiting for the resolution of LWG issue #2235
|
||||
// template <typename _Alloc>
|
||||
// dynarray(size_type __c, const _Alloc& __alloc);
|
||||
// template <typename _Alloc>
|
||||
// dynarray(size_type __c, const value_type& __v, const _Alloc& __alloc);
|
||||
// template <typename _Alloc>
|
||||
// dynarray(const dynarray& __d, const _Alloc& __alloc);
|
||||
// template <typename _Alloc>
|
||||
// dynarray(initializer_list<value_type>, const _Alloc& __alloc);
|
||||
|
||||
dynarray& operator=(const dynarray&) = delete;
|
||||
~dynarray();
|
||||
|
||||
// iterators:
|
||||
inline _LIBCPP_INLINE_VISIBILITY iterator begin() noexcept { return iterator(data()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_iterator begin() const noexcept { return const_iterator(data()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const noexcept { return const_iterator(data()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY iterator end() noexcept { return iterator(data() + __size_); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_iterator end() const noexcept { return const_iterator(data() + __size_); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_iterator cend() const noexcept { return const_iterator(data() + __size_); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); }
|
||||
|
||||
// capacity:
|
||||
inline _LIBCPP_INLINE_VISIBILITY size_type size() const noexcept { return __size_; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY size_type max_size() const noexcept { return __size_; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY bool empty() const noexcept { return __size_ == 0; }
|
||||
|
||||
// element access:
|
||||
inline _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) { return data()[__n]; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const { return data()[__n]; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY reference front() { return data()[0]; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reference front() const { return data()[0]; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY reference back() { return data()[__size_-1]; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reference back() const { return data()[__size_-1]; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reference at(size_type __n) const;
|
||||
inline _LIBCPP_INLINE_VISIBILITY reference at(size_type __n);
|
||||
|
||||
// data access:
|
||||
inline _LIBCPP_INLINE_VISIBILITY _Tp* data() noexcept { return __base_; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const _Tp* data() const noexcept { return __base_; }
|
||||
|
||||
// mutating member functions:
|
||||
inline _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __v) { fill_n(begin(), __size_, __v); }
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
dynarray<_Tp>::dynarray(size_type __c) : dynarray ()
|
||||
{
|
||||
__base_ = __allocate (__c);
|
||||
value_type *__data = data ();
|
||||
for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
|
||||
::new (__data) value_type;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
dynarray<_Tp>::dynarray(size_type __c, const value_type& __v) : dynarray ()
|
||||
{
|
||||
__base_ = __allocate (__c);
|
||||
value_type *__data = data ();
|
||||
for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
|
||||
::new (__data) value_type (__v);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
dynarray<_Tp>::dynarray(initializer_list<value_type> __il) : dynarray ()
|
||||
{
|
||||
size_t sz = __il.size();
|
||||
__base_ = __allocate (sz);
|
||||
value_type *__data = data ();
|
||||
auto src = __il.begin();
|
||||
for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
|
||||
::new (__data) value_type (*src);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
dynarray<_Tp>::dynarray(const dynarray& __d) : dynarray ()
|
||||
{
|
||||
size_t sz = __d.size();
|
||||
__base_ = __allocate (sz);
|
||||
value_type *__data = data ();
|
||||
auto src = __d.begin();
|
||||
for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
|
||||
::new (__data) value_type (*src);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
dynarray<_Tp>::~dynarray()
|
||||
{
|
||||
value_type *__data = data () + __size_;
|
||||
for ( size_t i = 0; i < __size_; ++i )
|
||||
(--__data)->value_type::~value_type();
|
||||
__deallocate ( __base_ );
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename dynarray<_Tp>::reference
|
||||
dynarray<_Tp>::at(size_type __n)
|
||||
{
|
||||
if (__n >= __size_)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw out_of_range("dynarray::at");
|
||||
#else
|
||||
assert(!"dynarray::at out_of_range");
|
||||
#endif
|
||||
}
|
||||
return data()[__n];
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename dynarray<_Tp>::const_reference
|
||||
dynarray<_Tp>::at(size_type __n) const
|
||||
{
|
||||
if (__n >= __size_)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw out_of_range("dynarray::at");
|
||||
#else
|
||||
assert(!"dynarray::at out_of_range");
|
||||
#endif
|
||||
}
|
||||
return data()[__n];
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<dynarray<_Tp>, _Alloc> : true_type {};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // if _LIBCPP_STD_VER > 11
|
||||
#endif // _LIBCPP_DYNARRAY
|
250
external/bsd/libc++/dist/libcxx/include/exception
vendored
Normal file
250
external/bsd/libc++/dist/libcxx/include/exception
vendored
Normal file
|
@ -0,0 +1,250 @@
|
|||
// -*- C++ -*-
|
||||
//===-------------------------- exception ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXCEPTION
|
||||
#define _LIBCPP_EXCEPTION
|
||||
|
||||
/*
|
||||
exception synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
class exception
|
||||
{
|
||||
public:
|
||||
exception() noexcept;
|
||||
exception(const exception&) noexcept;
|
||||
exception& operator=(const exception&) noexcept;
|
||||
virtual ~exception() noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
class bad_exception
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_exception() noexcept;
|
||||
bad_exception(const bad_exception&) noexcept;
|
||||
bad_exception& operator=(const bad_exception&) noexcept;
|
||||
virtual ~bad_exception() noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
typedef void (*unexpected_handler)();
|
||||
unexpected_handler set_unexpected(unexpected_handler f ) noexcept;
|
||||
unexpected_handler get_unexpected() noexcept;
|
||||
[[noreturn]] void unexpected();
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
terminate_handler set_terminate(terminate_handler f ) noexcept;
|
||||
terminate_handler get_terminate() noexcept;
|
||||
[[noreturn]] void terminate() noexcept;
|
||||
|
||||
bool uncaught_exception() noexcept;
|
||||
|
||||
typedef unspecified exception_ptr;
|
||||
|
||||
exception_ptr current_exception() noexcept;
|
||||
void rethrow_exception [[noreturn]] (exception_ptr p);
|
||||
template<class E> exception_ptr make_exception_ptr(E e) noexcept;
|
||||
|
||||
class nested_exception
|
||||
{
|
||||
public:
|
||||
nested_exception() noexcept;
|
||||
nested_exception(const nested_exception&) noexcept = default;
|
||||
nested_exception& operator=(const nested_exception&) noexcept = default;
|
||||
virtual ~nested_exception() = default;
|
||||
|
||||
// access functions
|
||||
[[noreturn]] void rethrow_nested() const;
|
||||
exception_ptr nested_ptr() const noexcept;
|
||||
};
|
||||
|
||||
template <class T> [[noreturn]] void throw_with_nested(T&& t);
|
||||
template <class E> void rethrow_if_nested(const E& e);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI exception
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {}
|
||||
virtual ~exception() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_exception
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {}
|
||||
virtual ~bad_exception() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
typedef void (*unexpected_handler)();
|
||||
_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected();
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT;
|
||||
|
||||
class _LIBCPP_TYPE_VIS exception_ptr;
|
||||
|
||||
_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
|
||||
|
||||
class _LIBCPP_TYPE_VIS exception_ptr
|
||||
{
|
||||
void* __ptr_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
|
||||
exception_ptr(const exception_ptr&) _NOEXCEPT;
|
||||
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
|
||||
~exception_ptr() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
|
||||
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||
{return __x.__ptr_ == __y.__ptr_;}
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||
{return !(__x == __y);}
|
||||
|
||||
friend _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
||||
friend _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
|
||||
};
|
||||
|
||||
template<class _Ep>
|
||||
exception_ptr
|
||||
make_exception_ptr(_Ep __e) _NOEXCEPT
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
throw __e;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return current_exception();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
|
||||
// nested_exception
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI nested_exception
|
||||
{
|
||||
exception_ptr __ptr_;
|
||||
public:
|
||||
nested_exception() _NOEXCEPT;
|
||||
// nested_exception(const nested_exception&) noexcept = default;
|
||||
// nested_exception& operator=(const nested_exception&) noexcept = default;
|
||||
virtual ~nested_exception() _NOEXCEPT;
|
||||
|
||||
// access functions
|
||||
_LIBCPP_NORETURN void rethrow_nested() const;
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __nested
|
||||
: public _Tp,
|
||||
public nested_exception
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
is_class<typename remove_reference<_Tp>::type>::value &&
|
||||
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
is_class<_Tp>::value && !is_base_of<nested_exception, _Tp>::value
|
||||
>::type* = 0)
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t));
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
!is_class<typename remove_reference<_Tp>::type>::value ||
|
||||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
!is_class<_Tp>::value || is_base_of<nested_exception, _Tp>::value
|
||||
>::type* = 0)
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw _VSTD::forward<_Tp>(__t);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _Ep& __e, typename enable_if<
|
||||
is_polymorphic<_Ep>::value
|
||||
>::type* = 0)
|
||||
{
|
||||
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
|
||||
if (__nep)
|
||||
__nep->rethrow_nested();
|
||||
}
|
||||
|
||||
template <class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _Ep&, typename enable_if<
|
||||
!is_polymorphic<_Ep>::value
|
||||
>::type* = 0)
|
||||
{
|
||||
}
|
||||
|
||||
} // std
|
||||
|
||||
#endif // _LIBCPP_EXCEPTION
|
314
external/bsd/libc++/dist/libcxx/include/experimental/dynarray
vendored
Normal file
314
external/bsd/libc++/dist/libcxx/include/experimental/dynarray
vendored
Normal file
|
@ -0,0 +1,314 @@
|
|||
// -*- C++ -*-
|
||||
//===-------------------------- dynarray ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_DYNARRAY
|
||||
#define _LIBCPP_DYNARRAY
|
||||
|
||||
#include <__config>
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
/*
|
||||
dynarray synopsis
|
||||
|
||||
namespace std { namespace experimental {
|
||||
|
||||
template< typename T >
|
||||
class dynarray
|
||||
{
|
||||
// types:
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef implementation-defined iterator;
|
||||
typedef implementation-defined const_iterator;
|
||||
typedef reverse_iterator<iterator> reverse_iterator;
|
||||
typedef reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
public:
|
||||
// construct/copy/destroy:
|
||||
explicit dynarray(size_type c);
|
||||
template <typename Alloc>
|
||||
dynarray(size_type c, const Alloc& alloc);
|
||||
dynarray(size_type c, const T& v);
|
||||
template <typename Alloc>
|
||||
dynarray(size_type c, const T& v, const Alloc& alloc);
|
||||
dynarray(const dynarray& d);
|
||||
template <typename Alloc>
|
||||
dynarray(const dynarray& d, const Alloc& alloc);
|
||||
dynarray(initializer_list<T>);
|
||||
template <typename Alloc>
|
||||
dynarray(initializer_list<T>, const Alloc& alloc);
|
||||
|
||||
dynarray& operator=(const dynarray&) = delete;
|
||||
~dynarray();
|
||||
|
||||
// iterators:
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// capacity:
|
||||
size_type size() const noexcept;
|
||||
size_type max_size() const noexcept;
|
||||
bool empty() const noexcept;
|
||||
|
||||
// element access:
|
||||
reference operator[](size_type n);
|
||||
const_reference operator[](size_type n) const;
|
||||
|
||||
reference front();
|
||||
const_reference front() const;
|
||||
reference back();
|
||||
const_reference back() const;
|
||||
|
||||
const_reference at(size_type n) const;
|
||||
reference at(size_type n);
|
||||
|
||||
// data access:
|
||||
T* data() noexcept;
|
||||
const T* data() const noexcept;
|
||||
|
||||
// mutating member functions:
|
||||
void fill(const T& v);
|
||||
};
|
||||
|
||||
}} // std::experimental
|
||||
|
||||
*/
|
||||
|
||||
#include <__functional_base>
|
||||
#include <iterator>
|
||||
#include <stdexcept>
|
||||
#include <initializer_list>
|
||||
#include <new>
|
||||
#include <algorithm>
|
||||
|
||||
#if defined(_LIBCPP_NO_EXCEPTIONS)
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std { namespace experimental { inline namespace __array_extensions_v1 {
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY dynarray
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
typedef dynarray __self;
|
||||
typedef _Tp value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef value_type* iterator;
|
||||
typedef const value_type* const_iterator;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
private:
|
||||
size_t __size_;
|
||||
value_type * __base_;
|
||||
_LIBCPP_ALWAYS_INLINE dynarray () noexcept : __base_(nullptr), __size_(0) {}
|
||||
|
||||
static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count )
|
||||
{
|
||||
if ( numeric_limits<size_t>::max() / sizeof (value_type) <= count )
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw bad_array_length();
|
||||
#else
|
||||
assert(!"dynarray::allocation");
|
||||
#endif
|
||||
}
|
||||
return static_cast<value_type *> (::operator new (sizeof(value_type) * count));
|
||||
}
|
||||
|
||||
static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept
|
||||
{
|
||||
::operator delete (static_cast<void *> (__ptr));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit dynarray(size_type __c);
|
||||
dynarray(size_type __c, const value_type& __v);
|
||||
dynarray(const dynarray& __d);
|
||||
dynarray(initializer_list<value_type>);
|
||||
|
||||
// We're not implementing these right now.
|
||||
// Waiting for the resolution of LWG issue #2235
|
||||
// template <typename _Alloc>
|
||||
// dynarray(size_type __c, const _Alloc& __alloc);
|
||||
// template <typename _Alloc>
|
||||
// dynarray(size_type __c, const value_type& __v, const _Alloc& __alloc);
|
||||
// template <typename _Alloc>
|
||||
// dynarray(const dynarray& __d, const _Alloc& __alloc);
|
||||
// template <typename _Alloc>
|
||||
// dynarray(initializer_list<value_type>, const _Alloc& __alloc);
|
||||
|
||||
dynarray& operator=(const dynarray&) = delete;
|
||||
~dynarray();
|
||||
|
||||
// iterators:
|
||||
inline _LIBCPP_INLINE_VISIBILITY iterator begin() noexcept { return iterator(data()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_iterator begin() const noexcept { return const_iterator(data()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const noexcept { return const_iterator(data()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY iterator end() noexcept { return iterator(data() + __size_); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_iterator end() const noexcept { return const_iterator(data() + __size_); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_iterator cend() const noexcept { return const_iterator(data() + __size_); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); }
|
||||
|
||||
// capacity:
|
||||
inline _LIBCPP_INLINE_VISIBILITY size_type size() const noexcept { return __size_; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY size_type max_size() const noexcept { return __size_; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY bool empty() const noexcept { return __size_ == 0; }
|
||||
|
||||
// element access:
|
||||
inline _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) { return data()[__n]; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const { return data()[__n]; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY reference front() { return data()[0]; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reference front() const { return data()[0]; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY reference back() { return data()[__size_-1]; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reference back() const { return data()[__size_-1]; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const_reference at(size_type __n) const;
|
||||
inline _LIBCPP_INLINE_VISIBILITY reference at(size_type __n);
|
||||
|
||||
// data access:
|
||||
inline _LIBCPP_INLINE_VISIBILITY _Tp* data() noexcept { return __base_; }
|
||||
inline _LIBCPP_INLINE_VISIBILITY const _Tp* data() const noexcept { return __base_; }
|
||||
|
||||
// mutating member functions:
|
||||
inline _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __v) { fill_n(begin(), __size_, __v); }
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
dynarray<_Tp>::dynarray(size_type __c) : dynarray ()
|
||||
{
|
||||
__base_ = __allocate (__c);
|
||||
value_type *__data = data ();
|
||||
for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
|
||||
::new (__data) value_type;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
dynarray<_Tp>::dynarray(size_type __c, const value_type& __v) : dynarray ()
|
||||
{
|
||||
__base_ = __allocate (__c);
|
||||
value_type *__data = data ();
|
||||
for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
|
||||
::new (__data) value_type (__v);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
dynarray<_Tp>::dynarray(initializer_list<value_type> __il) : dynarray ()
|
||||
{
|
||||
size_t sz = __il.size();
|
||||
__base_ = __allocate (sz);
|
||||
value_type *__data = data ();
|
||||
auto src = __il.begin();
|
||||
for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
|
||||
::new (__data) value_type (*src);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
dynarray<_Tp>::dynarray(const dynarray& __d) : dynarray ()
|
||||
{
|
||||
size_t sz = __d.size();
|
||||
__base_ = __allocate (sz);
|
||||
value_type *__data = data ();
|
||||
auto src = __d.begin();
|
||||
for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
|
||||
::new (__data) value_type (*src);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
dynarray<_Tp>::~dynarray()
|
||||
{
|
||||
value_type *__data = data () + __size_;
|
||||
for ( size_t i = 0; i < __size_; ++i )
|
||||
(--__data)->value_type::~value_type();
|
||||
__deallocate ( __base_ );
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename dynarray<_Tp>::reference
|
||||
dynarray<_Tp>::at(size_type __n)
|
||||
{
|
||||
if (__n >= __size_)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw out_of_range("dynarray::at");
|
||||
#else
|
||||
assert(!"dynarray::at out_of_range");
|
||||
#endif
|
||||
}
|
||||
return data()[__n];
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename dynarray<_Tp>::const_reference
|
||||
dynarray<_Tp>::at(size_type __n) const
|
||||
{
|
||||
if (__n >= __size_)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw out_of_range("dynarray::at");
|
||||
#else
|
||||
assert(!"dynarray::at out_of_range");
|
||||
#endif
|
||||
}
|
||||
return data()[__n];
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
template <class _Tp, class _Alloc>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {};
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // if _LIBCPP_STD_VER > 11
|
||||
#endif // _LIBCPP_DYNARRAY
|
699
external/bsd/libc++/dist/libcxx/include/experimental/optional
vendored
Normal file
699
external/bsd/libc++/dist/libcxx/include/experimental/optional
vendored
Normal file
|
@ -0,0 +1,699 @@
|
|||
// -*- C++ -*-
|
||||
//===-------------------------- optional ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_OPTIONAL
|
||||
#define _LIBCPP_OPTIONAL
|
||||
|
||||
/*
|
||||
optional synopsis
|
||||
|
||||
// C++1y
|
||||
|
||||
#include <initializer_list>
|
||||
|
||||
namespace std { namespace experimental {
|
||||
|
||||
// optional for object types
|
||||
template <class T>
|
||||
class optional
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
|
||||
// constructors
|
||||
constexpr optional() noexcept;
|
||||
constexpr optional(nullopt_t) noexcept;
|
||||
optional(const optional&);
|
||||
optional(optional&&) noexcept(is_nothrow_move_constructible<T>::value);
|
||||
constexpr optional(const T&);
|
||||
constexpr optional(T&&);
|
||||
template <class... Args> constexpr explicit optional(in_place_t, Args&&...);
|
||||
template <class U, class... Args>
|
||||
constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...);
|
||||
|
||||
// destructor
|
||||
~optional();
|
||||
|
||||
// assignment
|
||||
optional& operator=(nullopt_t) noexcept;
|
||||
optional& operator=(const optional&);
|
||||
optional& operator=(optional&&)
|
||||
noexcept(is_nothrow_move_assignable<T>::value &&
|
||||
is_nothrow_move_constructible<T>::value);
|
||||
template <class U> optional& operator=(U&&);
|
||||
template <class... Args> void emplace(Args&&...);
|
||||
template <class U, class... Args> void emplace(initializer_list<U>, Args&&...);
|
||||
|
||||
// swap
|
||||
void swap(optional&)
|
||||
noexcept(is_nothrow_move_constructible<T>::value &&
|
||||
noexcept(swap(declval<T&>(), declval<T&>())));
|
||||
|
||||
// observers
|
||||
constexpr T const* operator->() const;
|
||||
T* operator->();
|
||||
constexpr T const& operator*() const;
|
||||
T& operator*();
|
||||
constexpr explicit operator bool() const noexcept;
|
||||
constexpr T const& value() const;
|
||||
T& value();
|
||||
template <class U> constexpr T value_or(U&&) const&;
|
||||
template <class U> T value_or(U&&) &&;
|
||||
};
|
||||
|
||||
// In-place construction
|
||||
struct in_place_t{};
|
||||
constexpr in_place_t in_place{};
|
||||
|
||||
// Disengaged state indicator
|
||||
struct nullopt_t{see below};
|
||||
constexpr nullopt_t nullopt(unspecified);
|
||||
|
||||
// class bad_optional_access
|
||||
class bad_optional_access
|
||||
: public logic_error
|
||||
{
|
||||
public:
|
||||
explicit bad_optional_access(const string& what_arg);
|
||||
explicit bad_optional_access(const char* what_arg);
|
||||
};
|
||||
|
||||
// Relational operators
|
||||
template <class T> constexpr bool operator==(const optional<T>&, const optional<T>&);
|
||||
template <class T> constexpr bool operator< (const optional<T>&, const optional<T>&);
|
||||
|
||||
// Comparison with nullopt
|
||||
template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
|
||||
template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
|
||||
template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
|
||||
template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
|
||||
|
||||
// Comparison with T
|
||||
template <class T> constexpr bool operator==(const optional<T>&, const T&);
|
||||
template <class T> constexpr bool operator==(const T&, const optional<T>&);
|
||||
template <class T> constexpr bool operator<(const optional<T>&, const T&);
|
||||
template <class T> constexpr bool operator<(const T&, const optional<T>&);
|
||||
|
||||
// Specialized algorithms
|
||||
template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below);
|
||||
template <class T> constexpr optional<typename decay<T>::type> make_optional(T&&);
|
||||
|
||||
// hash support
|
||||
template <class T> struct hash;
|
||||
template <class T> struct hash<optional<T>>;
|
||||
|
||||
}} // std::experimental
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace std { namespace experimental {
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_optional_access
|
||||
: public logic_error
|
||||
{
|
||||
public:
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
_LIBCPP_INLINE_VISIBILITY explicit bad_optional_access(const string& __arg)
|
||||
: logic_error(__arg) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit bad_optional_access(const char* __arg)
|
||||
: logic_error(__arg) {}
|
||||
_LIBCPP_INLINE_VISIBILITY bad_optional_access(const bad_optional_access&) noexcept = default;
|
||||
_LIBCPP_INLINE_VISIBILITY bad_optional_access& operator=(const bad_optional_access&) noexcept = default;
|
||||
#else
|
||||
private:
|
||||
bad_optional_access(const bad_optional_access&);
|
||||
bad_optional_access& operator=(const bad_optional_access&);
|
||||
public:
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
// Get the key function ~bad_optional_access() into the dylib even if not compiling for C++1y
|
||||
virtual ~bad_optional_access() _NOEXCEPT;
|
||||
};
|
||||
|
||||
}} // std::experimental
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
#include <initializer_list>
|
||||
#include <type_traits>
|
||||
#include <new>
|
||||
#include <__functional_base>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
# include <__debug>
|
||||
#else
|
||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std { namespace experimental { inline namespace __library_fundamentals_v1 {
|
||||
|
||||
struct in_place_t {};
|
||||
constexpr in_place_t in_place{};
|
||||
|
||||
struct nullopt_t
|
||||
{
|
||||
explicit constexpr nullopt_t(int) noexcept {}
|
||||
};
|
||||
|
||||
constexpr nullopt_t nullopt{0};
|
||||
|
||||
template <class _Tp, bool = is_trivially_destructible<_Tp>::value>
|
||||
class __optional_storage
|
||||
{
|
||||
protected:
|
||||
typedef _Tp value_type;
|
||||
union
|
||||
{
|
||||
char __null_state_;
|
||||
value_type __val_;
|
||||
};
|
||||
bool __engaged_ = false;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__optional_storage()
|
||||
{
|
||||
if (__engaged_)
|
||||
__val_.~value_type();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage() noexcept
|
||||
: __null_state_('\0') {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__optional_storage(const __optional_storage& __x)
|
||||
: __engaged_(__x.__engaged_)
|
||||
{
|
||||
if (__engaged_)
|
||||
::new(_VSTD::addressof(__val_)) value_type(__x.__val_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__optional_storage(__optional_storage&& __x)
|
||||
noexcept(is_nothrow_move_constructible<value_type>::value)
|
||||
: __engaged_(__x.__engaged_)
|
||||
{
|
||||
if (__engaged_)
|
||||
::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage(const value_type& __v)
|
||||
: __val_(__v),
|
||||
__engaged_(true) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage(value_type&& __v)
|
||||
: __val_(_VSTD::move(__v)),
|
||||
__engaged_(true) {}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
explicit __optional_storage(in_place_t, _Args&&... __args)
|
||||
: __val_(_VSTD::forward<_Args>(__args)...),
|
||||
__engaged_(true) {}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class __optional_storage<_Tp, true>
|
||||
{
|
||||
protected:
|
||||
typedef _Tp value_type;
|
||||
union
|
||||
{
|
||||
char __null_state_;
|
||||
value_type __val_;
|
||||
};
|
||||
bool __engaged_ = false;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage() noexcept
|
||||
: __null_state_('\0') {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__optional_storage(const __optional_storage& __x)
|
||||
: __engaged_(__x.__engaged_)
|
||||
{
|
||||
if (__engaged_)
|
||||
::new(_VSTD::addressof(__val_)) value_type(__x.__val_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__optional_storage(__optional_storage&& __x)
|
||||
noexcept(is_nothrow_move_constructible<value_type>::value)
|
||||
: __engaged_(__x.__engaged_)
|
||||
{
|
||||
if (__engaged_)
|
||||
::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage(const value_type& __v)
|
||||
: __val_(__v),
|
||||
__engaged_(true) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage(value_type&& __v)
|
||||
: __val_(_VSTD::move(__v)),
|
||||
__engaged_(true) {}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
explicit __optional_storage(in_place_t, _Args&&... __args)
|
||||
: __val_(_VSTD::forward<_Args>(__args)...),
|
||||
__engaged_(true) {}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class optional
|
||||
: private __optional_storage<_Tp>
|
||||
{
|
||||
typedef __optional_storage<_Tp> __base;
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
|
||||
static_assert(!is_reference<value_type>::value,
|
||||
"Instantiation of optional with a reference type is ill-formed.");
|
||||
static_assert(!is_same<typename remove_cv<value_type>::type, in_place_t>::value,
|
||||
"Instantiation of optional with a in_place_t type is ill-formed.");
|
||||
static_assert(!is_same<typename remove_cv<value_type>::type, nullopt_t>::value,
|
||||
"Instantiation of optional with a nullopt_t type is ill-formed.");
|
||||
static_assert(is_object<value_type>::value,
|
||||
"Instantiation of optional with a non-object type is undefined behavior.");
|
||||
static_assert(is_nothrow_destructible<value_type>::value,
|
||||
"Instantiation of optional with an object type that is not noexcept destructible is undefined behavior.");
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {}
|
||||
_LIBCPP_INLINE_VISIBILITY optional(const optional&) = default;
|
||||
_LIBCPP_INLINE_VISIBILITY optional(optional&&) = default;
|
||||
_LIBCPP_INLINE_VISIBILITY ~optional() = default;
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr optional(const value_type& __v)
|
||||
: __base(__v) {}
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr optional(value_type&& __v)
|
||||
: __base(_VSTD::move(__v)) {}
|
||||
|
||||
template <class... _Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<value_type, _Args...>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
explicit optional(in_place_t, _Args&&... __args)
|
||||
: __base(in_place, _VSTD::forward<_Args>(__args)...) {}
|
||||
|
||||
template <class _Up, class... _Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
|
||||
: __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
optional& operator=(nullopt_t) noexcept
|
||||
{
|
||||
if (this->__engaged_)
|
||||
{
|
||||
this->__val_.~value_type();
|
||||
this->__engaged_ = false;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
optional&
|
||||
operator=(const optional& __opt)
|
||||
{
|
||||
if (this->__engaged_ == __opt.__engaged_)
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_ = __opt.__val_;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_.~value_type();
|
||||
else
|
||||
::new(_VSTD::addressof(this->__val_)) value_type(__opt.__val_);
|
||||
this->__engaged_ = __opt.__engaged_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
optional&
|
||||
operator=(optional&& __opt)
|
||||
noexcept(is_nothrow_move_assignable<value_type>::value &&
|
||||
is_nothrow_move_constructible<value_type>::value)
|
||||
{
|
||||
if (this->__engaged_ == __opt.__engaged_)
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_ = _VSTD::move(__opt.__val_);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_.~value_type();
|
||||
else
|
||||
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::move(__opt.__val_));
|
||||
this->__engaged_ = __opt.__engaged_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _Up,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_same<typename remove_reference<_Up>::type, value_type>::value &&
|
||||
is_constructible<value_type, _Up>::value &&
|
||||
is_assignable<value_type&, _Up>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
optional&
|
||||
operator=(_Up&& __v)
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_ = _VSTD::forward<_Up>(__v);
|
||||
else
|
||||
{
|
||||
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Up>(__v));
|
||||
this->__engaged_ = true;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class... _Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<value_type, _Args...>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
*this = nullopt;
|
||||
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...);
|
||||
this->__engaged_ = true;
|
||||
}
|
||||
|
||||
template <class _Up, class... _Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
emplace(initializer_list<_Up> __il, _Args&&... __args)
|
||||
{
|
||||
*this = nullopt;
|
||||
::new(_VSTD::addressof(this->__val_)) value_type(__il, _VSTD::forward<_Args>(__args)...);
|
||||
this->__engaged_ = true;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(optional& __opt)
|
||||
noexcept(is_nothrow_move_constructible<value_type>::value &&
|
||||
__is_nothrow_swappable<value_type>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
if (this->__engaged_ == __opt.__engaged_)
|
||||
{
|
||||
if (this->__engaged_)
|
||||
swap(this->__val_, __opt.__val_);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->__engaged_)
|
||||
{
|
||||
::new(_VSTD::addressof(__opt.__val_)) value_type(_VSTD::move(this->__val_));
|
||||
this->__val_.~value_type();
|
||||
}
|
||||
else
|
||||
{
|
||||
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::move(__opt.__val_));
|
||||
__opt.__val_.~value_type();
|
||||
}
|
||||
swap(this->__engaged_, __opt.__engaged_);
|
||||
}
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
value_type const*
|
||||
operator->() const
|
||||
{
|
||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
|
||||
return __operator_arrow(__has_operator_addressof<value_type>{});
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type*
|
||||
operator->()
|
||||
{
|
||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
|
||||
return _VSTD::addressof(this->__val_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
const value_type&
|
||||
operator*() const
|
||||
{
|
||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
|
||||
return this->__val_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type&
|
||||
operator*()
|
||||
{
|
||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
|
||||
return this->__val_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr explicit operator bool() const noexcept {return this->__engaged_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr value_type const& value() const
|
||||
{
|
||||
if (!this->__engaged_)
|
||||
throw bad_optional_access("optional<T>::value: not engaged");
|
||||
return this->__val_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type& value()
|
||||
{
|
||||
if (!this->__engaged_)
|
||||
throw bad_optional_access("optional<T>::value: not engaged");
|
||||
return this->__val_;
|
||||
}
|
||||
|
||||
template <class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr value_type value_or(_Up&& __v) const&
|
||||
{
|
||||
static_assert(is_copy_constructible<value_type>::value,
|
||||
"optional<T>::value_or: T must be copy constructible");
|
||||
static_assert(is_convertible<_Up, value_type>::value,
|
||||
"optional<T>::value_or: U must be convertible to T");
|
||||
return this->__engaged_ ? this->__val_ :
|
||||
static_cast<value_type>(_VSTD::forward<_Up>(__v));
|
||||
}
|
||||
|
||||
template <class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type value_or(_Up&& __v) &&
|
||||
{
|
||||
static_assert(is_move_constructible<value_type>::value,
|
||||
"optional<T>::value_or: T must be move constructible");
|
||||
static_assert(is_convertible<_Up, value_type>::value,
|
||||
"optional<T>::value_or: U must be convertible to T");
|
||||
return this->__engaged_ ? _VSTD::move(this->__val_) :
|
||||
static_cast<value_type>(_VSTD::forward<_Up>(__v));
|
||||
}
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type const*
|
||||
__operator_arrow(true_type) const
|
||||
{
|
||||
return _VSTD::addressof(this->__val_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
value_type const*
|
||||
__operator_arrow(false_type) const
|
||||
{
|
||||
return &this->__val_;
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
{
|
||||
if (static_cast<bool>(__x) != static_cast<bool>(__y))
|
||||
return false;
|
||||
if (!static_cast<bool>(__x))
|
||||
return true;
|
||||
return *__x == *__y;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
{
|
||||
if (!static_cast<bool>(__y))
|
||||
return false;
|
||||
if (!static_cast<bool>(__x))
|
||||
return true;
|
||||
return less<_Tp>{}(*__x, *__y);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(const optional<_Tp>& __x, nullopt_t) noexcept
|
||||
{
|
||||
return !static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||
{
|
||||
return !static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(const optional<_Tp>&, nullopt_t) noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||
{
|
||||
return static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(const optional<_Tp>& __x, const _Tp& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? *__x == __v : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(const _Tp& __v, const optional<_Tp>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? *__x == __v : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(const optional<_Tp>& __x, const _Tp& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? less<_Tp>{}(*__x, __v) : true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(const _Tp& __v, const optional<_Tp>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? less<_Tp>{}(__v, *__x) : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
optional<typename decay<_Tp>::type>
|
||||
make_optional(_Tp&& __v)
|
||||
{
|
||||
return optional<typename decay<_Tp>::type>(_VSTD::forward<_Tp>(__v));
|
||||
}
|
||||
|
||||
}}} // namespace std::experimental::__library_fundamentals_v1
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::optional<_Tp> >
|
||||
{
|
||||
typedef std::experimental::optional<_Tp> argument_type;
|
||||
typedef size_t result_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result_type operator()(const argument_type& __opt) const _NOEXCEPT
|
||||
{
|
||||
return static_cast<bool>(__opt) ? hash<_Tp>()(*__opt) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
|
||||
#endif // _LIBCPP_ARRAY
|
46
external/bsd/libc++/dist/libcxx/include/ext/__hash
vendored
Normal file
46
external/bsd/libc++/dist/libcxx/include/ext/__hash
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
// -*- C++ -*-
|
||||
//===------------------------- hash_set ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXT_HASH
|
||||
#define _LIBCPP_EXT_HASH
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
namespace __gnu_cxx {
|
||||
using namespace std;
|
||||
|
||||
template <typename _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash : public std::hash<_Tp>
|
||||
{ };
|
||||
|
||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<const char*>
|
||||
: public unary_function<const char*, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const char *__c) const _NOEXCEPT
|
||||
{
|
||||
return __do_string_hash(__c, __c + strlen(__c));
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<char *>
|
||||
: public unary_function<char*, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char *__c) const _NOEXCEPT
|
||||
{
|
||||
return __do_string_hash<const char *>(__c, __c + strlen(__c));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_EXT_HASH
|
1007
external/bsd/libc++/dist/libcxx/include/ext/hash_map
vendored
Normal file
1007
external/bsd/libc++/dist/libcxx/include/ext/hash_map
vendored
Normal file
File diff suppressed because it is too large
Load diff
661
external/bsd/libc++/dist/libcxx/include/ext/hash_set
vendored
Normal file
661
external/bsd/libc++/dist/libcxx/include/ext/hash_set
vendored
Normal file
|
@ -0,0 +1,661 @@
|
|||
// -*- C++ -*-
|
||||
//===------------------------- hash_set ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_HASH_SET
|
||||
#define _LIBCPP_HASH_SET
|
||||
|
||||
/*
|
||||
|
||||
hash_set synopsis
|
||||
|
||||
namespace __gnu_cxx
|
||||
{
|
||||
|
||||
template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
|
||||
class Alloc = allocator<Value>>
|
||||
class hash_set
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef Value key_type;
|
||||
typedef key_type value_type;
|
||||
typedef Hash hasher;
|
||||
typedef Pred key_equal;
|
||||
typedef Alloc allocator_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef typename allocator_traits<allocator_type>::pointer pointer;
|
||||
typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
|
||||
typedef typename allocator_traits<allocator_type>::size_type size_type;
|
||||
typedef typename allocator_traits<allocator_type>::difference_type difference_type;
|
||||
|
||||
typedef /unspecified/ iterator;
|
||||
typedef /unspecified/ const_iterator;
|
||||
|
||||
explicit hash_set(size_type n = 193, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
template <class InputIterator>
|
||||
hash_set(InputIterator f, InputIterator l,
|
||||
size_type n = 193, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
hash_set(const hash_set&);
|
||||
~hash_set();
|
||||
hash_set& operator=(const hash_set&);
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
pair<iterator, bool> insert(const value_type& obj);
|
||||
template <class InputIterator>
|
||||
void insert(InputIterator first, InputIterator last);
|
||||
|
||||
void erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
void erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
|
||||
void swap(hash_set&);
|
||||
|
||||
hasher hash_funct() const;
|
||||
key_equal key_eq() const;
|
||||
|
||||
iterator find(const key_type& k);
|
||||
const_iterator find(const key_type& k) const;
|
||||
size_type count(const key_type& k) const;
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
|
||||
size_type bucket_count() const;
|
||||
size_type max_bucket_count() const;
|
||||
|
||||
size_type elems_in_bucket(size_type n) const;
|
||||
|
||||
void resize(size_type n);
|
||||
};
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
void swap(hash_set<Value, Hash, Pred, Alloc>& x,
|
||||
hash_set<Value, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
operator==(const hash_set<Value, Hash, Pred, Alloc>& x,
|
||||
const hash_set<Value, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
operator!=(const hash_set<Value, Hash, Pred, Alloc>& x,
|
||||
const hash_set<Value, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
|
||||
class Alloc = allocator<Value>>
|
||||
class hash_multiset
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef Value key_type;
|
||||
typedef key_type value_type;
|
||||
typedef Hash hasher;
|
||||
typedef Pred key_equal;
|
||||
typedef Alloc allocator_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef typename allocator_traits<allocator_type>::pointer pointer;
|
||||
typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
|
||||
typedef typename allocator_traits<allocator_type>::size_type size_type;
|
||||
typedef typename allocator_traits<allocator_type>::difference_type difference_type;
|
||||
|
||||
typedef /unspecified/ iterator;
|
||||
typedef /unspecified/ const_iterator;
|
||||
|
||||
explicit hash_multiset(size_type n = 193, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
template <class InputIterator>
|
||||
hash_multiset(InputIterator f, InputIterator l,
|
||||
size_type n = 193, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
hash_multiset(const hash_multiset&);
|
||||
~hash_multiset();
|
||||
hash_multiset& operator=(const hash_multiset&);
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
iterator insert(const value_type& obj);
|
||||
template <class InputIterator>
|
||||
void insert(InputIterator first, InputIterator last);
|
||||
|
||||
void erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
void erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
|
||||
void swap(hash_multiset&);
|
||||
|
||||
hasher hash_funct() const;
|
||||
key_equal key_eq() const;
|
||||
|
||||
iterator find(const key_type& k);
|
||||
const_iterator find(const key_type& k) const;
|
||||
size_type count(const key_type& k) const;
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
|
||||
size_type bucket_count() const;
|
||||
size_type max_bucket_count() const;
|
||||
|
||||
size_type elems_in_bucket(size_type n) const;
|
||||
|
||||
void resize(size_type n);
|
||||
};
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
void swap(hash_multiset<Value, Hash, Pred, Alloc>& x,
|
||||
hash_multiset<Value, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
operator==(const hash_multiset<Value, Hash, Pred, Alloc>& x,
|
||||
const hash_multiset<Value, Hash, Pred, Alloc>& y);
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
operator!=(const hash_multiset<Value, Hash, Pred, Alloc>& x,
|
||||
const hash_multiset<Value, Hash, Pred, Alloc>& y);
|
||||
} // __gnu_cxx
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__hash_table>
|
||||
#include <functional>
|
||||
#include <ext/__hash>
|
||||
|
||||
#if __DEPRECATED
|
||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||
_LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
|
||||
#else
|
||||
# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace __gnu_cxx {
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
class _Alloc = allocator<_Value> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY hash_set
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef _Value key_type;
|
||||
typedef key_type value_type;
|
||||
typedef _Hash hasher;
|
||||
typedef _Pred key_equal;
|
||||
typedef _Alloc allocator_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
private:
|
||||
typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
|
||||
|
||||
__table __table_;
|
||||
|
||||
public:
|
||||
typedef typename __table::pointer pointer;
|
||||
typedef typename __table::const_pointer const_pointer;
|
||||
typedef typename __table::size_type size_type;
|
||||
typedef typename __table::difference_type difference_type;
|
||||
|
||||
typedef typename __table::const_iterator iterator;
|
||||
typedef typename __table::const_iterator const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hash_set() {__table_.rehash(193);}
|
||||
explicit hash_set(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
template <class _InputIterator>
|
||||
hash_set(_InputIterator __first, _InputIterator __last);
|
||||
template <class _InputIterator>
|
||||
hash_set(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
template <class _InputIterator>
|
||||
hash_set(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
hash_set(const hash_set& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(const value_type& __x)
|
||||
{return __table_.__insert_unique(__x);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first, __last);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_set& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const {return __table_.hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const {return __table_.key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
};
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
__table_.rehash(193);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
|
||||
_InputIterator __first, _InputIterator __last, size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
|
||||
_InputIterator __first, _InputIterator __last, size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
|
||||
const hash_set& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
__table_.rehash(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
__table_.__insert_unique(*__first);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
bool
|
||||
operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
if (__x.size() != __y.size())
|
||||
return false;
|
||||
typedef typename hash_set<_Value, _Hash, _Pred, _Alloc>::const_iterator
|
||||
const_iterator;
|
||||
for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
|
||||
__i != __ex; ++__i)
|
||||
{
|
||||
const_iterator __j = __y.find(*__i);
|
||||
if (__j == __ey || !(*__i == *__j))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
class _Alloc = allocator<_Value> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY hash_multiset
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef _Value key_type;
|
||||
typedef key_type value_type;
|
||||
typedef _Hash hasher;
|
||||
typedef _Pred key_equal;
|
||||
typedef _Alloc allocator_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
private:
|
||||
typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
|
||||
|
||||
__table __table_;
|
||||
|
||||
public:
|
||||
typedef typename __table::pointer pointer;
|
||||
typedef typename __table::const_pointer const_pointer;
|
||||
typedef typename __table::size_type size_type;
|
||||
typedef typename __table::difference_type difference_type;
|
||||
|
||||
typedef typename __table::const_iterator iterator;
|
||||
typedef typename __table::const_iterator const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hash_multiset() {__table_.rehash(193);}
|
||||
explicit hash_multiset(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
hash_multiset(size_type __n, const hasher& __hf,
|
||||
const key_equal& __eql, const allocator_type& __a);
|
||||
template <class _InputIterator>
|
||||
hash_multiset(_InputIterator __first, _InputIterator __last);
|
||||
template <class _InputIterator>
|
||||
hash_multiset(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
template <class _InputIterator>
|
||||
hash_multiset(_InputIterator __first, _InputIterator __last,
|
||||
size_type __n , const hasher& __hf,
|
||||
const key_equal& __eql, const allocator_type& __a);
|
||||
hash_multiset(const hash_multiset& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first, __last);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_multiset& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const {return __table_.hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const {return __table_.key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
};
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
__table_.rehash(193);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
_InputIterator __first, _InputIterator __last, size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
_InputIterator __first, _InputIterator __last, size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
__table_.rehash(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
const hash_multiset& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
__table_.rehash(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
__table_.__insert_multi(*__first);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
bool
|
||||
operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
if (__x.size() != __y.size())
|
||||
return false;
|
||||
typedef typename hash_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
|
||||
const_iterator;
|
||||
typedef pair<const_iterator, const_iterator> _EqRng;
|
||||
for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
|
||||
{
|
||||
_EqRng __xeq = __x.equal_range(*__i);
|
||||
_EqRng __yeq = __y.equal_range(*__i);
|
||||
if (_VSTD::distance(__xeq.first, __xeq.second) !=
|
||||
_VSTD::distance(__yeq.first, __yeq.second) ||
|
||||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
return false;
|
||||
__i = __xeq.second;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
} // __gnu_cxx
|
||||
|
||||
#endif // _LIBCPP_HASH_SET
|
1663
external/bsd/libc++/dist/libcxx/include/forward_list
vendored
Normal file
1663
external/bsd/libc++/dist/libcxx/include/forward_list
vendored
Normal file
File diff suppressed because it is too large
Load diff
1431
external/bsd/libc++/dist/libcxx/include/fstream
vendored
Normal file
1431
external/bsd/libc++/dist/libcxx/include/fstream
vendored
Normal file
File diff suppressed because it is too large
Load diff
2418
external/bsd/libc++/dist/libcxx/include/functional
vendored
Normal file
2418
external/bsd/libc++/dist/libcxx/include/functional
vendored
Normal file
File diff suppressed because it is too large
Load diff
2615
external/bsd/libc++/dist/libcxx/include/future
vendored
Normal file
2615
external/bsd/libc++/dist/libcxx/include/future
vendored
Normal file
File diff suppressed because it is too large
Load diff
118
external/bsd/libc++/dist/libcxx/include/initializer_list
vendored
Normal file
118
external/bsd/libc++/dist/libcxx/include/initializer_list
vendored
Normal file
|
@ -0,0 +1,118 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------- initializer_list -----------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_INITIALIZER_LIST
|
||||
#define _LIBCPP_INITIALIZER_LIST
|
||||
|
||||
/*
|
||||
initializer_list synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template<class E>
|
||||
class initializer_list
|
||||
{
|
||||
public:
|
||||
typedef E value_type;
|
||||
typedef const E& reference;
|
||||
typedef const E& const_reference;
|
||||
typedef size_t size_type;
|
||||
|
||||
typedef const E* iterator;
|
||||
typedef const E* const_iterator;
|
||||
|
||||
initializer_list() noexcept; // constexpr in C++14
|
||||
|
||||
size_t size() const noexcept; // constexpr in C++14
|
||||
const E* begin() const noexcept; // constexpr in C++14
|
||||
const E* end() const noexcept; // constexpr in C++14
|
||||
};
|
||||
|
||||
template<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++14
|
||||
template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++14
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not versioned
|
||||
{
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template<class _Ep>
|
||||
class _LIBCPP_TYPE_VIS_ONLY initializer_list
|
||||
{
|
||||
const _Ep* __begin_;
|
||||
size_t __size_;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
|
||||
: __begin_(__b),
|
||||
__size_(__s)
|
||||
{}
|
||||
public:
|
||||
typedef _Ep value_type;
|
||||
typedef const _Ep& reference;
|
||||
typedef const _Ep& const_reference;
|
||||
typedef size_t size_type;
|
||||
|
||||
typedef const _Ep* iterator;
|
||||
typedef const _Ep* const_iterator;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
size_t size() const _NOEXCEPT {return __size_;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Ep* begin() const _NOEXCEPT {return __begin_;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
|
||||
};
|
||||
|
||||
template<class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Ep*
|
||||
begin(initializer_list<_Ep> __il) _NOEXCEPT
|
||||
{
|
||||
return __il.begin();
|
||||
}
|
||||
|
||||
template<class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Ep*
|
||||
end(initializer_list<_Ep> __il) _NOEXCEPT
|
||||
{
|
||||
return __il.end();
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
} // std
|
||||
|
||||
#endif // _LIBCPP_INITIALIZER_LIST
|
653
external/bsd/libc++/dist/libcxx/include/iomanip
vendored
Normal file
653
external/bsd/libc++/dist/libcxx/include/iomanip
vendored
Normal file
|
@ -0,0 +1,653 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- iomanip ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_IOMANIP
|
||||
#define _LIBCPP_IOMANIP
|
||||
|
||||
/*
|
||||
iomanip synopsis
|
||||
|
||||
namespace std {
|
||||
|
||||
// types T1, T2, ... are unspecified implementation types
|
||||
T1 resetiosflags(ios_base::fmtflags mask);
|
||||
T2 setiosflags (ios_base::fmtflags mask);
|
||||
T3 setbase(int base);
|
||||
template<charT> T4 setfill(charT c);
|
||||
T5 setprecision(int n);
|
||||
T6 setw(int n);
|
||||
template <class moneyT> T7 get_money(moneyT& mon, bool intl = false);
|
||||
template <class charT, class moneyT> T8 put_money(const moneyT& mon, bool intl = false);
|
||||
template <class charT> T9 get_time(struct tm* tmb, const charT* fmt);
|
||||
template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
|
||||
|
||||
template <class charT>
|
||||
T11 quoted(const charT* s, charT delim=charT('"'), charT escape=charT('\\')); // C++14
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
T12 quoted(const basic_string<charT, traits, Allocator>& s,
|
||||
charT delim=charT('"'), charT escape=charT('\\')); // C++14
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
T13 quoted(basic_string<charT, traits, Allocator>& s,
|
||||
charT delim=charT('"'), charT escape=charT('\\')); // C++14
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <istream>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// resetiosflags
|
||||
|
||||
class __iom_t1
|
||||
{
|
||||
ios_base::fmtflags __mask_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x)
|
||||
{
|
||||
__is.unsetf(__x.__mask_);
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x)
|
||||
{
|
||||
__os.unsetf(__x.__mask_);
|
||||
return __os;
|
||||
}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t1
|
||||
resetiosflags(ios_base::fmtflags __mask)
|
||||
{
|
||||
return __iom_t1(__mask);
|
||||
}
|
||||
|
||||
// setiosflags
|
||||
|
||||
class __iom_t2
|
||||
{
|
||||
ios_base::fmtflags __mask_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x)
|
||||
{
|
||||
__is.setf(__x.__mask_);
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x)
|
||||
{
|
||||
__os.setf(__x.__mask_);
|
||||
return __os;
|
||||
}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t2
|
||||
setiosflags(ios_base::fmtflags __mask)
|
||||
{
|
||||
return __iom_t2(__mask);
|
||||
}
|
||||
|
||||
// setbase
|
||||
|
||||
class __iom_t3
|
||||
{
|
||||
int __base_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t3(int __b) : __base_(__b) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x)
|
||||
{
|
||||
__is.setf(__x.__base_ == 8 ? ios_base::oct :
|
||||
__x.__base_ == 10 ? ios_base::dec :
|
||||
__x.__base_ == 16 ? ios_base::hex :
|
||||
ios_base::fmtflags(0), ios_base::basefield);
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x)
|
||||
{
|
||||
__os.setf(__x.__base_ == 8 ? ios_base::oct :
|
||||
__x.__base_ == 10 ? ios_base::dec :
|
||||
__x.__base_ == 16 ? ios_base::hex :
|
||||
ios_base::fmtflags(0), ios_base::basefield);
|
||||
return __os;
|
||||
}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t3
|
||||
setbase(int __base)
|
||||
{
|
||||
return __iom_t3(__base);
|
||||
}
|
||||
|
||||
// setfill
|
||||
|
||||
template<class _CharT>
|
||||
class __iom_t4
|
||||
{
|
||||
_CharT __fill_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t4(_CharT __c) : __fill_(__c) {}
|
||||
|
||||
template <class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x)
|
||||
{
|
||||
__os.fill(__x.__fill_);
|
||||
return __os;
|
||||
}
|
||||
};
|
||||
|
||||
template<class _CharT>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t4<_CharT>
|
||||
setfill(_CharT __c)
|
||||
{
|
||||
return __iom_t4<_CharT>(__c);
|
||||
}
|
||||
|
||||
// setprecision
|
||||
|
||||
class __iom_t5
|
||||
{
|
||||
int __n_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t5(int __n) : __n_(__n) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x)
|
||||
{
|
||||
__is.precision(__x.__n_);
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x)
|
||||
{
|
||||
__os.precision(__x.__n_);
|
||||
return __os;
|
||||
}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t5
|
||||
setprecision(int __n)
|
||||
{
|
||||
return __iom_t5(__n);
|
||||
}
|
||||
|
||||
// setw
|
||||
|
||||
class __iom_t6
|
||||
{
|
||||
int __n_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t6(int __n) : __n_(__n) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x)
|
||||
{
|
||||
__is.width(__x.__n_);
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x)
|
||||
{
|
||||
__os.width(__x.__n_);
|
||||
return __os;
|
||||
}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t6
|
||||
setw(int __n)
|
||||
{
|
||||
return __iom_t6(__n);
|
||||
}
|
||||
|
||||
// get_money
|
||||
|
||||
template <class _MoneyT> class __iom_t7;
|
||||
|
||||
template <class _CharT, class _Traits, class _MoneyT>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x);
|
||||
|
||||
template <class _MoneyT>
|
||||
class __iom_t7
|
||||
{
|
||||
_MoneyT& __mon_;
|
||||
bool __intl_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t7(_MoneyT& __mon, bool __intl)
|
||||
: __mon_(__mon), __intl_(__intl) {}
|
||||
|
||||
template <class _CharT, class _Traits, class _Mp>
|
||||
friend
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _MoneyT>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
typedef money_get<_CharT, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
const _Fp& __mf = use_facet<_Fp>(__is.getloc());
|
||||
__mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
|
||||
__is.setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__is.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _MoneyT>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t7<_MoneyT>
|
||||
get_money(_MoneyT& __mon, bool __intl = false)
|
||||
{
|
||||
return __iom_t7<_MoneyT>(__mon, __intl);
|
||||
}
|
||||
|
||||
// put_money
|
||||
|
||||
template <class _MoneyT> class __iom_t8;
|
||||
|
||||
template <class _CharT, class _Traits, class _MoneyT>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x);
|
||||
|
||||
template <class _MoneyT>
|
||||
class __iom_t8
|
||||
{
|
||||
const _MoneyT& __mon_;
|
||||
bool __intl_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t8(const _MoneyT& __mon, bool __intl)
|
||||
: __mon_(__mon), __intl_(__intl) {}
|
||||
|
||||
template <class _CharT, class _Traits, class _Mp>
|
||||
friend
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _MoneyT>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||
typedef money_put<_CharT, _Op> _Fp;
|
||||
const _Fp& __mf = use_facet<_Fp>(__os.getloc());
|
||||
if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
|
||||
__os.setstate(ios_base::badbit);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
template <class _MoneyT>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t8<_MoneyT>
|
||||
put_money(const _MoneyT& __mon, bool __intl = false)
|
||||
{
|
||||
return __iom_t8<_MoneyT>(__mon, __intl);
|
||||
}
|
||||
|
||||
// get_time
|
||||
|
||||
template <class _CharT> class __iom_t9;
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x);
|
||||
|
||||
template <class _CharT>
|
||||
class __iom_t9
|
||||
{
|
||||
tm* __tm_;
|
||||
const _CharT* __fmt_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t9(tm* __tm, const _CharT* __fmt)
|
||||
: __tm_(__tm), __fmt_(__fmt) {}
|
||||
|
||||
template <class _Cp, class _Traits>
|
||||
friend
|
||||
basic_istream<_Cp, _Traits>&
|
||||
operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
typedef time_get<_CharT, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
const _Fp& __tf = use_facet<_Fp>(__is.getloc());
|
||||
__tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_,
|
||||
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
|
||||
__is.setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__is.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t9<_CharT>
|
||||
get_time(tm* __tm, const _CharT* __fmt)
|
||||
{
|
||||
return __iom_t9<_CharT>(__tm, __fmt);
|
||||
}
|
||||
|
||||
// put_time
|
||||
|
||||
template <class _CharT> class __iom_t10;
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x);
|
||||
|
||||
template <class _CharT>
|
||||
class __iom_t10
|
||||
{
|
||||
const tm* __tm_;
|
||||
const _CharT* __fmt_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t10(const tm* __tm, const _CharT* __fmt)
|
||||
: __tm_(__tm), __fmt_(__fmt) {}
|
||||
|
||||
template <class _Cp, class _Traits>
|
||||
friend
|
||||
basic_ostream<_Cp, _Traits>&
|
||||
operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||
typedef time_put<_CharT, _Op> _Fp;
|
||||
const _Fp& __tf = use_facet<_Fp>(__os.getloc());
|
||||
if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_,
|
||||
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
|
||||
__os.setstate(ios_base::badbit);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t10<_CharT>
|
||||
put_time(const tm* __tm, const _CharT* __fmt)
|
||||
{
|
||||
return __iom_t10<_CharT>(__tm, __fmt);
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
template <class _CharT, class _Traits, class _ForwardIterator>
|
||||
std::basic_ostream<_CharT, _Traits> &
|
||||
__quoted_output ( basic_ostream<_CharT, _Traits> &__os,
|
||||
_ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )
|
||||
{
|
||||
__os << __delim;
|
||||
for ( ; __first != __last; ++ __first )
|
||||
{
|
||||
if (_Traits::eq (*__first, __escape) || _Traits::eq (*__first, __delim))
|
||||
__os << __escape;
|
||||
__os << *__first;
|
||||
}
|
||||
__os << __delim;
|
||||
return __os;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _String>
|
||||
basic_istream<_CharT, _Traits> &
|
||||
__quoted_input ( basic_istream<_CharT, _Traits> &__is, _String & __string, _CharT __delim, _CharT __escape )
|
||||
{
|
||||
__string.clear ();
|
||||
_CharT __c;
|
||||
__is >> __c;
|
||||
if ( __is.fail ())
|
||||
return __is;
|
||||
|
||||
if (!_Traits::eq (__c, __delim)) // no delimiter, read the whole string
|
||||
{
|
||||
__is.unget ();
|
||||
__is >> __string;
|
||||
return __is;
|
||||
}
|
||||
|
||||
__save_flags<_CharT, _Traits> sf(__is);
|
||||
noskipws (__is);
|
||||
while (true)
|
||||
{
|
||||
__is >> __c;
|
||||
if ( __is.fail ())
|
||||
break;
|
||||
if (_Traits::eq (__c, __escape))
|
||||
{
|
||||
__is >> __c;
|
||||
if ( __is.fail ())
|
||||
break;
|
||||
}
|
||||
else if (_Traits::eq (__c, __delim))
|
||||
break;
|
||||
__string.push_back ( __c );
|
||||
}
|
||||
return __is;
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT, class _Iter, class _Traits=char_traits<_CharT>>
|
||||
struct __quoted_output_proxy
|
||||
{
|
||||
_Iter __first;
|
||||
_Iter __last;
|
||||
_CharT __delim;
|
||||
_CharT __escape;
|
||||
|
||||
__quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e)
|
||||
: __first(__f), __last(__l), __delim(__d), __escape(__e) {}
|
||||
// This would be a nice place for a string_ref
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _Iter>
|
||||
basic_ostream<_CharT, _Traits>& operator<<(
|
||||
basic_ostream<_CharT, _Traits>& __os,
|
||||
const __quoted_output_proxy<_CharT, _Iter, _Traits> & __proxy)
|
||||
{
|
||||
return __quoted_output (__os, __proxy.__first, __proxy.__last, __proxy.__delim, __proxy.__escape);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
struct __quoted_proxy
|
||||
{
|
||||
basic_string<_CharT, _Traits, _Allocator> &__string;
|
||||
_CharT __delim;
|
||||
_CharT __escape;
|
||||
|
||||
__quoted_proxy(basic_string<_CharT, _Traits, _Allocator> &__s, _CharT __d, _CharT __e)
|
||||
: __string(__s), __delim(__d), __escape(__e) {}
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>& operator<<(
|
||||
basic_ostream<_CharT, _Traits>& __os,
|
||||
const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
|
||||
{
|
||||
return __quoted_output (__os, __proxy.__string.cbegin (), __proxy.__string.cend (), __proxy.__delim, __proxy.__escape);
|
||||
}
|
||||
|
||||
// extractor for non-const basic_string& proxies
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>& operator>>(
|
||||
basic_istream<_CharT, _Traits>& __is,
|
||||
const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
|
||||
{
|
||||
return __quoted_input ( __is, __proxy.__string, __proxy.__delim, __proxy.__escape );
|
||||
}
|
||||
|
||||
|
||||
template <class _CharT>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__quoted_output_proxy<_CharT, const _CharT *>
|
||||
quoted ( const _CharT *__s, _CharT __delim = _CharT('"'), _CharT __escape =_CharT('\\'))
|
||||
{
|
||||
const _CharT *__end = __s;
|
||||
while ( *__end ) ++__end;
|
||||
return __quoted_output_proxy<_CharT, const _CharT *> ( __s, __end, __delim, __escape );
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__quoted_output_proxy<_CharT, typename basic_string <_CharT, _Traits, _Allocator>::const_iterator>
|
||||
quoted ( const basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
|
||||
{
|
||||
return __quoted_output_proxy<_CharT,
|
||||
typename basic_string <_CharT, _Traits, _Allocator>::const_iterator>
|
||||
( __s.cbegin(), __s.cend (), __delim, __escape );
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
__quoted_proxy<_CharT, _Traits, _Allocator>
|
||||
quoted ( basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
|
||||
{
|
||||
return __quoted_proxy<_CharT, _Traits, _Allocator>( __s, __delim, __escape );
|
||||
}
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_IOMANIP
|
1023
external/bsd/libc++/dist/libcxx/include/ios
vendored
Normal file
1023
external/bsd/libc++/dist/libcxx/include/ios
vendored
Normal file
File diff suppressed because it is too large
Load diff
194
external/bsd/libc++/dist/libcxx/include/iosfwd
vendored
Normal file
194
external/bsd/libc++/dist/libcxx/include/iosfwd
vendored
Normal file
|
@ -0,0 +1,194 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- iosfwd -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_IOSFWD
|
||||
#define _LIBCPP_IOSFWD
|
||||
|
||||
/*
|
||||
iosfwd synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template<class charT> struct char_traits;
|
||||
template<class T> class allocator;
|
||||
|
||||
class ios_base;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_ios;
|
||||
|
||||
template <class charT, class traits = char_traits<charT> > class basic_streambuf;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_istream;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_ostream;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_iostream;
|
||||
|
||||
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
|
||||
class basic_stringbuf;
|
||||
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
|
||||
class basic_istringstream;
|
||||
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
|
||||
class basic_ostringstream;
|
||||
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
|
||||
class basic_stringstream;
|
||||
|
||||
template <class charT, class traits = char_traits<charT> > class basic_filebuf;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_ifstream;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_ofstream;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_fstream;
|
||||
|
||||
template <class charT, class traits = char_traits<charT> > class istreambuf_iterator;
|
||||
template <class charT, class traits = char_traits<charT> > class ostreambuf_iterator;
|
||||
|
||||
typedef basic_ios<char> ios;
|
||||
typedef basic_ios<wchar_t> wios;
|
||||
|
||||
typedef basic_streambuf<char> streambuf;
|
||||
typedef basic_istream<char> istream;
|
||||
typedef basic_ostream<char> ostream;
|
||||
typedef basic_iostream<char> iostream;
|
||||
|
||||
typedef basic_stringbuf<char> stringbuf;
|
||||
typedef basic_istringstream<char> istringstream;
|
||||
typedef basic_ostringstream<char> ostringstream;
|
||||
typedef basic_stringstream<char> stringstream;
|
||||
|
||||
typedef basic_filebuf<char> filebuf;
|
||||
typedef basic_ifstream<char> ifstream;
|
||||
typedef basic_ofstream<char> ofstream;
|
||||
typedef basic_fstream<char> fstream;
|
||||
|
||||
typedef basic_streambuf<wchar_t> wstreambuf;
|
||||
typedef basic_istream<wchar_t> wistream;
|
||||
typedef basic_ostream<wchar_t> wostream;
|
||||
typedef basic_iostream<wchar_t> wiostream;
|
||||
|
||||
typedef basic_stringbuf<wchar_t> wstringbuf;
|
||||
typedef basic_istringstream<wchar_t> wistringstream;
|
||||
typedef basic_ostringstream<wchar_t> wostringstream;
|
||||
typedef basic_stringstream<wchar_t> wstringstream;
|
||||
|
||||
typedef basic_filebuf<wchar_t> wfilebuf;
|
||||
typedef basic_ifstream<wchar_t> wifstream;
|
||||
typedef basic_ofstream<wchar_t> wofstream;
|
||||
typedef basic_fstream<wchar_t> wfstream;
|
||||
|
||||
template <class state> class fpos;
|
||||
typedef fpos<char_traits<char>::state_type> streampos;
|
||||
typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <wchar.h> // for mbstate_t
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_TYPE_VIS ios_base;
|
||||
|
||||
template<class _CharT> struct _LIBCPP_TYPE_VIS_ONLY char_traits;
|
||||
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY allocator;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ios;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_streambuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_istream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ostream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_iostream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_stringbuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_istringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ostringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_stringstream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_filebuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ifstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ofstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_fstream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY istreambuf_iterator;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY ostreambuf_iterator;
|
||||
|
||||
typedef basic_ios<char> ios;
|
||||
typedef basic_ios<wchar_t> wios;
|
||||
|
||||
typedef basic_streambuf<char> streambuf;
|
||||
typedef basic_istream<char> istream;
|
||||
typedef basic_ostream<char> ostream;
|
||||
typedef basic_iostream<char> iostream;
|
||||
|
||||
typedef basic_stringbuf<char> stringbuf;
|
||||
typedef basic_istringstream<char> istringstream;
|
||||
typedef basic_ostringstream<char> ostringstream;
|
||||
typedef basic_stringstream<char> stringstream;
|
||||
|
||||
typedef basic_filebuf<char> filebuf;
|
||||
typedef basic_ifstream<char> ifstream;
|
||||
typedef basic_ofstream<char> ofstream;
|
||||
typedef basic_fstream<char> fstream;
|
||||
|
||||
typedef basic_streambuf<wchar_t> wstreambuf;
|
||||
typedef basic_istream<wchar_t> wistream;
|
||||
typedef basic_ostream<wchar_t> wostream;
|
||||
typedef basic_iostream<wchar_t> wiostream;
|
||||
|
||||
typedef basic_stringbuf<wchar_t> wstringbuf;
|
||||
typedef basic_istringstream<wchar_t> wistringstream;
|
||||
typedef basic_ostringstream<wchar_t> wostringstream;
|
||||
typedef basic_stringstream<wchar_t> wstringstream;
|
||||
|
||||
typedef basic_filebuf<wchar_t> wfilebuf;
|
||||
typedef basic_ifstream<wchar_t> wifstream;
|
||||
typedef basic_ofstream<wchar_t> wofstream;
|
||||
typedef basic_fstream<wchar_t> wfstream;
|
||||
|
||||
template <class _State> class _LIBCPP_TYPE_VIS_ONLY fpos;
|
||||
typedef fpos<mbstate_t> streampos;
|
||||
typedef fpos<mbstate_t> wstreampos;
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef fpos<mbstate_t> u16streampos;
|
||||
typedef fpos<mbstate_t> u32streampos;
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
typedef long long streamoff; // for char_traits in <string>
|
||||
|
||||
template <class _CharT, // for <stdexcept>
|
||||
class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_string;
|
||||
typedef basic_string<char, char_traits<char>, allocator<char> > string;
|
||||
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_IOSFWD
|
60
external/bsd/libc++/dist/libcxx/include/iostream
vendored
Normal file
60
external/bsd/libc++/dist/libcxx/include/iostream
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- iostream ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_IOSTREAM
|
||||
#define _LIBCPP_IOSTREAM
|
||||
|
||||
/*
|
||||
iostream synopsis
|
||||
|
||||
#include <ios>
|
||||
#include <streambuf>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
||||
namespace std {
|
||||
|
||||
extern istream cin;
|
||||
extern ostream cout;
|
||||
extern ostream cerr;
|
||||
extern ostream clog;
|
||||
extern wistream wcin;
|
||||
extern wostream wcout;
|
||||
extern wostream wcerr;
|
||||
extern wostream wclog;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <ios>
|
||||
#include <streambuf>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
extern _LIBCPP_FUNC_VIS istream cin;
|
||||
extern _LIBCPP_FUNC_VIS ostream cout;
|
||||
extern _LIBCPP_FUNC_VIS ostream cerr;
|
||||
extern _LIBCPP_FUNC_VIS ostream clog;
|
||||
extern _LIBCPP_FUNC_VIS wistream wcin;
|
||||
extern _LIBCPP_FUNC_VIS wostream wcout;
|
||||
extern _LIBCPP_FUNC_VIS wostream wcerr;
|
||||
extern _LIBCPP_FUNC_VIS wostream wclog;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_IOSTREAM
|
1716
external/bsd/libc++/dist/libcxx/include/istream
vendored
Normal file
1716
external/bsd/libc++/dist/libcxx/include/istream
vendored
Normal file
File diff suppressed because it is too large
Load diff
1568
external/bsd/libc++/dist/libcxx/include/iterator
vendored
Normal file
1568
external/bsd/libc++/dist/libcxx/include/iterator
vendored
Normal file
File diff suppressed because it is too large
Load diff
813
external/bsd/libc++/dist/libcxx/include/limits
vendored
Normal file
813
external/bsd/libc++/dist/libcxx/include/limits
vendored
Normal file
|
@ -0,0 +1,813 @@
|
|||
// -*- C++ -*-
|
||||
//===---------------------------- limits ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_LIMITS
|
||||
#define _LIBCPP_LIMITS
|
||||
|
||||
/*
|
||||
limits synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template<class T>
|
||||
class numeric_limits
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = false;
|
||||
static constexpr T min() noexcept;
|
||||
static constexpr T max() noexcept;
|
||||
static constexpr T lowest() noexcept;
|
||||
|
||||
static constexpr int digits = 0;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
static constexpr bool is_signed = false;
|
||||
static constexpr bool is_integer = false;
|
||||
static constexpr bool is_exact = false;
|
||||
static constexpr int radix = 0;
|
||||
static constexpr T epsilon() noexcept;
|
||||
static constexpr T round_error() noexcept;
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr T infinity() noexcept;
|
||||
static constexpr T quiet_NaN() noexcept;
|
||||
static constexpr T signaling_NaN() noexcept;
|
||||
static constexpr T denorm_min() noexcept;
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = false;
|
||||
static constexpr bool is_modulo = false;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
enum float_round_style
|
||||
{
|
||||
round_indeterminate = -1,
|
||||
round_toward_zero = 0,
|
||||
round_to_nearest = 1,
|
||||
round_toward_infinity = 2,
|
||||
round_toward_neg_infinity = 3
|
||||
};
|
||||
|
||||
enum float_denorm_style
|
||||
{
|
||||
denorm_indeterminate = -1,
|
||||
denorm_absent = 0,
|
||||
denorm_present = 1
|
||||
};
|
||||
|
||||
template<> class numeric_limits<cv bool>;
|
||||
|
||||
template<> class numeric_limits<cv char>;
|
||||
template<> class numeric_limits<cv signed char>;
|
||||
template<> class numeric_limits<cv unsigned char>;
|
||||
template<> class numeric_limits<cv wchar_t>;
|
||||
template<> class numeric_limits<cv char16_t>;
|
||||
template<> class numeric_limits<cv char32_t>;
|
||||
|
||||
template<> class numeric_limits<cv short>;
|
||||
template<> class numeric_limits<cv int>;
|
||||
template<> class numeric_limits<cv long>;
|
||||
template<> class numeric_limits<cv long long>;
|
||||
template<> class numeric_limits<cv unsigned short>;
|
||||
template<> class numeric_limits<cv unsigned int>;
|
||||
template<> class numeric_limits<cv unsigned long>;
|
||||
template<> class numeric_limits<cv unsigned long long>;
|
||||
|
||||
template<> class numeric_limits<cv float>;
|
||||
template<> class numeric_limits<cv double>;
|
||||
template<> class numeric_limits<cv long double>;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
#include "support/win32/limits_win32.h"
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
#if defined(__IBMCPP__)
|
||||
#include "support/ibm/limits.h"
|
||||
#endif // __IBMCPP__
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
enum float_round_style
|
||||
{
|
||||
round_indeterminate = -1,
|
||||
round_toward_zero = 0,
|
||||
round_to_nearest = 1,
|
||||
round_toward_infinity = 2,
|
||||
round_toward_neg_infinity = 3
|
||||
};
|
||||
|
||||
enum float_denorm_style
|
||||
{
|
||||
denorm_indeterminate = -1,
|
||||
denorm_absent = 0,
|
||||
denorm_present = 1
|
||||
};
|
||||
|
||||
template <class _Tp, bool = is_arithmetic<_Tp>::value>
|
||||
class __libcpp_numeric_limits
|
||||
{
|
||||
protected:
|
||||
typedef _Tp type;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_specialized = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return type();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int digits = 0;
|
||||
static _LIBCPP_CONSTEXPR const int digits10 = 0;
|
||||
static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
|
||||
static _LIBCPP_CONSTEXPR const bool is_signed = false;
|
||||
static _LIBCPP_CONSTEXPR const bool is_integer = false;
|
||||
static _LIBCPP_CONSTEXPR const bool is_exact = false;
|
||||
static _LIBCPP_CONSTEXPR const int radix = 0;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent = 0;
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent = 0;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool has_infinity = false;
|
||||
static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
|
||||
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
|
||||
static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
|
||||
static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
|
||||
static _LIBCPP_CONSTEXPR const bool is_bounded = false;
|
||||
static _LIBCPP_CONSTEXPR const bool is_modulo = false;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool traps = false;
|
||||
static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
|
||||
static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <class _Tp, int digits, bool is_signed>
|
||||
struct __libcpp_compute_min
|
||||
{
|
||||
static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << digits);
|
||||
};
|
||||
|
||||
template <class _Tp, int digits>
|
||||
struct __libcpp_compute_min<_Tp, digits, false>
|
||||
{
|
||||
static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0);
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class __libcpp_numeric_limits<_Tp, true>
|
||||
{
|
||||
protected:
|
||||
typedef _Tp type;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_specialized = true;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0);
|
||||
static _LIBCPP_CONSTEXPR const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed);
|
||||
static _LIBCPP_CONSTEXPR const int digits10 = digits * 3 / 10;
|
||||
static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
|
||||
static _LIBCPP_CONSTEXPR const type __min = __libcpp_compute_min<type, digits, is_signed>::value;
|
||||
static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_integer = true;
|
||||
static _LIBCPP_CONSTEXPR const bool is_exact = true;
|
||||
static _LIBCPP_CONSTEXPR const int radix = 2;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent = 0;
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent = 0;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool has_infinity = false;
|
||||
static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
|
||||
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
|
||||
static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
|
||||
static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
|
||||
static _LIBCPP_CONSTEXPR const bool is_bounded = true;
|
||||
static _LIBCPP_CONSTEXPR const bool is_modulo = true;
|
||||
|
||||
#if __i386__ || __x86_64__
|
||||
static _LIBCPP_CONSTEXPR const bool traps = true;
|
||||
#else
|
||||
static _LIBCPP_CONSTEXPR const bool traps = false;
|
||||
#endif
|
||||
static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
|
||||
static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class __libcpp_numeric_limits<bool, true>
|
||||
{
|
||||
protected:
|
||||
typedef bool type;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_specialized = true;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_signed = false;
|
||||
static _LIBCPP_CONSTEXPR const int digits = 1;
|
||||
static _LIBCPP_CONSTEXPR const int digits10 = 0;
|
||||
static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
|
||||
static _LIBCPP_CONSTEXPR const type __min = false;
|
||||
static _LIBCPP_CONSTEXPR const type __max = true;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_integer = true;
|
||||
static _LIBCPP_CONSTEXPR const bool is_exact = true;
|
||||
static _LIBCPP_CONSTEXPR const int radix = 2;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent = 0;
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent = 0;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool has_infinity = false;
|
||||
static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
|
||||
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
|
||||
static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
|
||||
static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
|
||||
static _LIBCPP_CONSTEXPR const bool is_bounded = true;
|
||||
static _LIBCPP_CONSTEXPR const bool is_modulo = false;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool traps = false;
|
||||
static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
|
||||
static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class __libcpp_numeric_limits<float, true>
|
||||
{
|
||||
protected:
|
||||
typedef float type;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_specialized = true;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_signed = true;
|
||||
static _LIBCPP_CONSTEXPR const int digits = __FLT_MANT_DIG__;
|
||||
static _LIBCPP_CONSTEXPR const int digits10 = __FLT_DIG__;
|
||||
static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103)/100000;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __FLT_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __FLT_MAX__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_integer = false;
|
||||
static _LIBCPP_CONSTEXPR const bool is_exact = false;
|
||||
static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __FLT_EPSILON__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5F;}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent = __FLT_MIN_EXP__;
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent10 = __FLT_MIN_10_EXP__;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent = __FLT_MAX_EXP__;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent10 = __FLT_MAX_10_EXP__;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool has_infinity = true;
|
||||
static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
|
||||
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
|
||||
static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
|
||||
static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_valf();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanf("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansf("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
|
||||
static _LIBCPP_CONSTEXPR const bool is_bounded = true;
|
||||
static _LIBCPP_CONSTEXPR const bool is_modulo = false;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool traps = false;
|
||||
static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
|
||||
static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
|
||||
};
|
||||
|
||||
template <>
|
||||
class __libcpp_numeric_limits<double, true>
|
||||
{
|
||||
protected:
|
||||
typedef double type;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_specialized = true;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_signed = true;
|
||||
static _LIBCPP_CONSTEXPR const int digits = __DBL_MANT_DIG__;
|
||||
static _LIBCPP_CONSTEXPR const int digits10 = __DBL_DIG__;
|
||||
static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103)/100000;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __DBL_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __DBL_MAX__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_integer = false;
|
||||
static _LIBCPP_CONSTEXPR const bool is_exact = false;
|
||||
static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __DBL_EPSILON__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent = __DBL_MIN_EXP__;
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent10 = __DBL_MIN_10_EXP__;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent = __DBL_MAX_EXP__;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent10 = __DBL_MAX_10_EXP__;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool has_infinity = true;
|
||||
static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
|
||||
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
|
||||
static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
|
||||
static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_val();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nan("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nans("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
|
||||
static _LIBCPP_CONSTEXPR const bool is_bounded = true;
|
||||
static _LIBCPP_CONSTEXPR const bool is_modulo = false;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool traps = false;
|
||||
static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
|
||||
static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
|
||||
};
|
||||
|
||||
template <>
|
||||
class __libcpp_numeric_limits<long double, true>
|
||||
{
|
||||
protected:
|
||||
typedef long double type;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_specialized = true;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_signed = true;
|
||||
static _LIBCPP_CONSTEXPR const int digits = __LDBL_MANT_DIG__;
|
||||
static _LIBCPP_CONSTEXPR const int digits10 = __LDBL_DIG__;
|
||||
static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103)/100000;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __LDBL_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __LDBL_MAX__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_integer = false;
|
||||
static _LIBCPP_CONSTEXPR const bool is_exact = false;
|
||||
static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__;
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent = __LDBL_MAX_EXP__;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent10 = __LDBL_MAX_10_EXP__;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool has_infinity = true;
|
||||
static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
|
||||
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
|
||||
static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
|
||||
static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_vall();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanl("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
|
||||
|
||||
#if (defined(__ppc__) || defined(__ppc64__))
|
||||
static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
|
||||
#else
|
||||
static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
|
||||
#endif
|
||||
static _LIBCPP_CONSTEXPR const bool is_bounded = true;
|
||||
static _LIBCPP_CONSTEXPR const bool is_modulo = false;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool traps = false;
|
||||
static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
|
||||
static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY numeric_limits
|
||||
: private __libcpp_numeric_limits<typename remove_cv<_Tp>::type>
|
||||
{
|
||||
typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base;
|
||||
typedef typename __base::type type;
|
||||
public:
|
||||
static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int digits = __base::digits;
|
||||
static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
|
||||
static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
|
||||
static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
|
||||
static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
|
||||
static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
|
||||
static _LIBCPP_CONSTEXPR const int radix = __base::radix;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
|
||||
static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
|
||||
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
|
||||
static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
|
||||
static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
|
||||
static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
|
||||
static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
|
||||
static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
|
||||
static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_specialized;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_digits10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_signed;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_integer;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_exact;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::radix;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_infinity;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_quiet_NaN;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_signaling_NaN;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<_Tp>::has_denorm;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_denorm_loss;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_iec559;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_bounded;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_modulo;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::traps;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::tinyness_before;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style;
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY numeric_limits<const _Tp>
|
||||
: private numeric_limits<_Tp>
|
||||
{
|
||||
typedef numeric_limits<_Tp> __base;
|
||||
typedef _Tp type;
|
||||
public:
|
||||
static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int digits = __base::digits;
|
||||
static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
|
||||
static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
|
||||
static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
|
||||
static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
|
||||
static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
|
||||
static _LIBCPP_CONSTEXPR const int radix = __base::radix;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
|
||||
static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
|
||||
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
|
||||
static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
|
||||
static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
|
||||
static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
|
||||
static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
|
||||
static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
|
||||
static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_specialized;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_digits10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_signed;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_integer;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_exact;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::radix;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_infinity;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_quiet_NaN;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_signaling_NaN;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const _Tp>::has_denorm;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_denorm_loss;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_iec559;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_bounded;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_modulo;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::traps;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::tinyness_before;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const float_round_style numeric_limits<const _Tp>::round_style;
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY numeric_limits<volatile _Tp>
|
||||
: private numeric_limits<_Tp>
|
||||
{
|
||||
typedef numeric_limits<_Tp> __base;
|
||||
typedef _Tp type;
|
||||
public:
|
||||
static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int digits = __base::digits;
|
||||
static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
|
||||
static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
|
||||
static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
|
||||
static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
|
||||
static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
|
||||
static _LIBCPP_CONSTEXPR const int radix = __base::radix;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
|
||||
static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
|
||||
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
|
||||
static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
|
||||
static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
|
||||
static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
|
||||
static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
|
||||
static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
|
||||
static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_specialized;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_digits10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_signed;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_integer;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_exact;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::radix;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_infinity;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_quiet_NaN;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_signaling_NaN;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<volatile _Tp>::has_denorm;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_denorm_loss;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_iec559;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_bounded;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_modulo;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::traps;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::tinyness_before;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const float_round_style numeric_limits<volatile _Tp>::round_style;
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY numeric_limits<const volatile _Tp>
|
||||
: private numeric_limits<_Tp>
|
||||
{
|
||||
typedef numeric_limits<_Tp> __base;
|
||||
typedef _Tp type;
|
||||
public:
|
||||
static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int digits = __base::digits;
|
||||
static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
|
||||
static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
|
||||
static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
|
||||
static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
|
||||
static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
|
||||
static _LIBCPP_CONSTEXPR const int radix = __base::radix;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
|
||||
static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
|
||||
static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
|
||||
static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
|
||||
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
|
||||
static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
|
||||
static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
|
||||
static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
|
||||
static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
|
||||
static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
|
||||
static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_specialized;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits10;
|
||||
template <class _Tp>
|
||||
const int numeric_limits<const volatile _Tp>::max_digits10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_signed;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_integer;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_exact;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::radix;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent10;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_infinity;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_quiet_NaN;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_signaling_NaN;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const volatile _Tp>::has_denorm;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_denorm_loss;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_iec559;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_bounded;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_modulo;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::traps;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::tinyness_before;
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR const float_round_style numeric_limits<const volatile _Tp>::round_style;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_LIMITS
|
2355
external/bsd/libc++/dist/libcxx/include/list
vendored
Normal file
2355
external/bsd/libc++/dist/libcxx/include/list
vendored
Normal file
File diff suppressed because it is too large
Load diff
4465
external/bsd/libc++/dist/libcxx/include/locale
vendored
Normal file
4465
external/bsd/libc++/dist/libcxx/include/locale
vendored
Normal file
File diff suppressed because it is too large
Load diff
2045
external/bsd/libc++/dist/libcxx/include/map
vendored
Normal file
2045
external/bsd/libc++/dist/libcxx/include/map
vendored
Normal file
File diff suppressed because it is too large
Load diff
5429
external/bsd/libc++/dist/libcxx/include/memory
vendored
Normal file
5429
external/bsd/libc++/dist/libcxx/include/memory
vendored
Normal file
File diff suppressed because it is too large
Load diff
566
external/bsd/libc++/dist/libcxx/include/mutex
vendored
Normal file
566
external/bsd/libc++/dist/libcxx/include/mutex
vendored
Normal file
|
@ -0,0 +1,566 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- mutex ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_MUTEX
|
||||
#define _LIBCPP_MUTEX
|
||||
|
||||
/*
|
||||
mutex synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
class mutex
|
||||
{
|
||||
public:
|
||||
constexpr mutex() noexcept;
|
||||
~mutex();
|
||||
|
||||
mutex(const mutex&) = delete;
|
||||
mutex& operator=(const mutex&) = delete;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
native_handle_type native_handle();
|
||||
};
|
||||
|
||||
class recursive_mutex
|
||||
{
|
||||
public:
|
||||
recursive_mutex();
|
||||
~recursive_mutex();
|
||||
|
||||
recursive_mutex(const recursive_mutex&) = delete;
|
||||
recursive_mutex& operator=(const recursive_mutex&) = delete;
|
||||
|
||||
void lock();
|
||||
bool try_lock() noexcept;
|
||||
void unlock();
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
native_handle_type native_handle();
|
||||
};
|
||||
|
||||
class timed_mutex
|
||||
{
|
||||
public:
|
||||
timed_mutex();
|
||||
~timed_mutex();
|
||||
|
||||
timed_mutex(const timed_mutex&) = delete;
|
||||
timed_mutex& operator=(const timed_mutex&) = delete;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
template <class Rep, class Period>
|
||||
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
||||
void unlock();
|
||||
};
|
||||
|
||||
class recursive_timed_mutex
|
||||
{
|
||||
public:
|
||||
recursive_timed_mutex();
|
||||
~recursive_timed_mutex();
|
||||
|
||||
recursive_timed_mutex(const recursive_timed_mutex&) = delete;
|
||||
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
|
||||
|
||||
void lock();
|
||||
bool try_lock() noexcept;
|
||||
template <class Rep, class Period>
|
||||
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
||||
void unlock();
|
||||
};
|
||||
|
||||
struct defer_lock_t {};
|
||||
struct try_to_lock_t {};
|
||||
struct adopt_lock_t {};
|
||||
|
||||
constexpr defer_lock_t defer_lock{};
|
||||
constexpr try_to_lock_t try_to_lock{};
|
||||
constexpr adopt_lock_t adopt_lock{};
|
||||
|
||||
template <class Mutex>
|
||||
class lock_guard
|
||||
{
|
||||
public:
|
||||
typedef Mutex mutex_type;
|
||||
|
||||
explicit lock_guard(mutex_type& m);
|
||||
lock_guard(mutex_type& m, adopt_lock_t);
|
||||
~lock_guard();
|
||||
|
||||
lock_guard(lock_guard const&) = delete;
|
||||
lock_guard& operator=(lock_guard const&) = delete;
|
||||
};
|
||||
|
||||
template <class Mutex>
|
||||
class unique_lock
|
||||
{
|
||||
public:
|
||||
typedef Mutex mutex_type;
|
||||
unique_lock() noexcept;
|
||||
explicit unique_lock(mutex_type& m);
|
||||
unique_lock(mutex_type& m, defer_lock_t) noexcept;
|
||||
unique_lock(mutex_type& m, try_to_lock_t);
|
||||
unique_lock(mutex_type& m, adopt_lock_t);
|
||||
template <class Clock, class Duration>
|
||||
unique_lock(mutex_type& m, const chrono::time_point<Clock, Duration>& abs_time);
|
||||
template <class Rep, class Period>
|
||||
unique_lock(mutex_type& m, const chrono::duration<Rep, Period>& rel_time);
|
||||
~unique_lock();
|
||||
|
||||
unique_lock(unique_lock const&) = delete;
|
||||
unique_lock& operator=(unique_lock const&) = delete;
|
||||
|
||||
unique_lock(unique_lock&& u) noexcept;
|
||||
unique_lock& operator=(unique_lock&& u) noexcept;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
|
||||
template <class Rep, class Period>
|
||||
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
||||
|
||||
void unlock();
|
||||
|
||||
void swap(unique_lock& u) noexcept;
|
||||
mutex_type* release() noexcept;
|
||||
|
||||
bool owns_lock() const noexcept;
|
||||
explicit operator bool () const noexcept;
|
||||
mutex_type* mutex() const noexcept;
|
||||
};
|
||||
|
||||
template <class Mutex>
|
||||
void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y) noexcept;
|
||||
|
||||
template <class L1, class L2, class... L3>
|
||||
int try_lock(L1&, L2&, L3&...);
|
||||
template <class L1, class L2, class... L3>
|
||||
void lock(L1&, L2&, L3&...);
|
||||
|
||||
struct once_flag
|
||||
{
|
||||
constexpr once_flag() noexcept;
|
||||
|
||||
once_flag(const once_flag&) = delete;
|
||||
once_flag& operator=(const once_flag&) = delete;
|
||||
};
|
||||
|
||||
template<class Callable, class ...Args>
|
||||
void call_once(once_flag& flag, Callable&& func, Args&&... args);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__mutex_base>
|
||||
#include <functional>
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#include <tuple>
|
||||
#endif
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_TYPE_VIS recursive_mutex
|
||||
{
|
||||
pthread_mutex_t __m_;
|
||||
|
||||
public:
|
||||
recursive_mutex();
|
||||
~recursive_mutex();
|
||||
|
||||
private:
|
||||
recursive_mutex(const recursive_mutex&); // = delete;
|
||||
recursive_mutex& operator=(const recursive_mutex&); // = delete;
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock() _NOEXCEPT;
|
||||
void unlock() _NOEXCEPT;
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
native_handle_type native_handle() {return &__m_;}
|
||||
};
|
||||
|
||||
class _LIBCPP_TYPE_VIS timed_mutex
|
||||
{
|
||||
mutex __m_;
|
||||
condition_variable __cv_;
|
||||
bool __locked_;
|
||||
public:
|
||||
timed_mutex();
|
||||
~timed_mutex();
|
||||
|
||||
private:
|
||||
timed_mutex(const timed_mutex&); // = delete;
|
||||
timed_mutex& operator=(const timed_mutex&); // = delete;
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock() _NOEXCEPT;
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
||||
template <class _Clock, class _Duration>
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
void unlock() _NOEXCEPT;
|
||||
};
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
bool
|
||||
timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
unique_lock<mutex> __lk(__m_);
|
||||
bool no_timeout = _Clock::now() < __t;
|
||||
while (no_timeout && __locked_)
|
||||
no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
|
||||
if (!__locked_)
|
||||
{
|
||||
__locked_ = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
class _LIBCPP_TYPE_VIS recursive_timed_mutex
|
||||
{
|
||||
mutex __m_;
|
||||
condition_variable __cv_;
|
||||
size_t __count_;
|
||||
pthread_t __id_;
|
||||
public:
|
||||
recursive_timed_mutex();
|
||||
~recursive_timed_mutex();
|
||||
|
||||
private:
|
||||
recursive_timed_mutex(const recursive_timed_mutex&); // = delete;
|
||||
recursive_timed_mutex& operator=(const recursive_timed_mutex&); // = delete;
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock() _NOEXCEPT;
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
||||
template <class _Clock, class _Duration>
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
void unlock() _NOEXCEPT;
|
||||
};
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
bool
|
||||
recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
pthread_t __id = pthread_self();
|
||||
unique_lock<mutex> lk(__m_);
|
||||
if (pthread_equal(__id, __id_))
|
||||
{
|
||||
if (__count_ == numeric_limits<size_t>::max())
|
||||
return false;
|
||||
++__count_;
|
||||
return true;
|
||||
}
|
||||
bool no_timeout = _Clock::now() < __t;
|
||||
while (no_timeout && __count_ != 0)
|
||||
no_timeout = __cv_.wait_until(lk, __t) == cv_status::no_timeout;
|
||||
if (__count_ == 0)
|
||||
{
|
||||
__count_ = 1;
|
||||
__id_ = __id;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class _L0, class _L1>
|
||||
int
|
||||
try_lock(_L0& __l0, _L1& __l1)
|
||||
{
|
||||
unique_lock<_L0> __u0(__l0, try_to_lock);
|
||||
if (__u0.owns_lock())
|
||||
{
|
||||
if (__l1.try_lock())
|
||||
{
|
||||
__u0.release();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _L0, class _L1, class _L2, class... _L3>
|
||||
int
|
||||
try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
|
||||
{
|
||||
int __r = 0;
|
||||
unique_lock<_L0> __u0(__l0, try_to_lock);
|
||||
if (__u0.owns_lock())
|
||||
{
|
||||
__r = try_lock(__l1, __l2, __l3...);
|
||||
if (__r == -1)
|
||||
__u0.release();
|
||||
else
|
||||
++__r;
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _L0, class _L1>
|
||||
void
|
||||
lock(_L0& __l0, _L1& __l1)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
{
|
||||
unique_lock<_L0> __u0(__l0);
|
||||
if (__l1.try_lock())
|
||||
{
|
||||
__u0.release();
|
||||
break;
|
||||
}
|
||||
}
|
||||
sched_yield();
|
||||
{
|
||||
unique_lock<_L1> __u1(__l1);
|
||||
if (__l0.try_lock())
|
||||
{
|
||||
__u1.release();
|
||||
break;
|
||||
}
|
||||
}
|
||||
sched_yield();
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _L0, class _L1, class _L2, class ..._L3>
|
||||
void
|
||||
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
switch (__i)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
unique_lock<_L0> __u0(__l0);
|
||||
__i = try_lock(__l1, __l2, __l3...);
|
||||
if (__i == -1)
|
||||
{
|
||||
__u0.release();
|
||||
return;
|
||||
}
|
||||
}
|
||||
++__i;
|
||||
sched_yield();
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
unique_lock<_L1> __u1(__l1);
|
||||
__i = try_lock(__l2, __l3..., __l0);
|
||||
if (__i == -1)
|
||||
{
|
||||
__u1.release();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (__i == sizeof...(_L3) + 1)
|
||||
__i = 0;
|
||||
else
|
||||
__i += 2;
|
||||
sched_yield();
|
||||
break;
|
||||
default:
|
||||
__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class _L0, class _L1, class _L2, class ..._L3>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
|
||||
{
|
||||
__lock_first(0, __l0, __l1, __l2, __l3...);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
struct _LIBCPP_TYPE_VIS once_flag;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void call_once(once_flag&, _Callable&&, _Args&&...);
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void call_once(once_flag&, _Callable);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
struct _LIBCPP_TYPE_VIS_ONLY once_flag
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
once_flag() _NOEXCEPT : __state_(0) {}
|
||||
|
||||
private:
|
||||
once_flag(const once_flag&); // = delete;
|
||||
once_flag& operator=(const once_flag&); // = delete;
|
||||
|
||||
unsigned long __state_;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template<class _Callable, class... _Args>
|
||||
friend
|
||||
void call_once(once_flag&, _Callable&&, _Args&&...);
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
template<class _Callable>
|
||||
friend
|
||||
void call_once(once_flag&, _Callable);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Fp>
|
||||
class __call_once_param
|
||||
{
|
||||
_Fp __f_;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()()
|
||||
{
|
||||
typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
|
||||
__execute(_Index());
|
||||
}
|
||||
|
||||
private:
|
||||
template <size_t ..._Indices>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __execute(__tuple_indices<_Indices...>)
|
||||
{
|
||||
__invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <class _Fp>
|
||||
class __call_once_param
|
||||
{
|
||||
_Fp __f_;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()()
|
||||
{
|
||||
__f_();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template <class _Fp>
|
||||
void
|
||||
__call_once_proxy(void* __vp)
|
||||
{
|
||||
__call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp);
|
||||
(*__p)();
|
||||
}
|
||||
|
||||
_LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*));
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable, class... _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
|
||||
{
|
||||
if (__flag.__state_ != ~0ul)
|
||||
{
|
||||
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _Gp;
|
||||
__call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)),
|
||||
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>);
|
||||
}
|
||||
}
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
call_once(once_flag& __flag, _Callable __func)
|
||||
{
|
||||
if (__flag.__state_ != ~0ul)
|
||||
{
|
||||
__call_once_param<_Callable> __p(__func);
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_MUTEX
|
150
external/bsd/libc++/dist/libcxx/include/new
vendored
Normal file
150
external/bsd/libc++/dist/libcxx/include/new
vendored
Normal file
|
@ -0,0 +1,150 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------- new ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_NEW
|
||||
#define _LIBCPP_NEW
|
||||
|
||||
/*
|
||||
new synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
class bad_alloc
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_alloc() noexcept;
|
||||
bad_alloc(const bad_alloc&) noexcept;
|
||||
bad_alloc& operator=(const bad_alloc&) noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
class bad_array_length : public bad_alloc // C++14
|
||||
{
|
||||
public:
|
||||
bad_array_length() noexcept;
|
||||
};
|
||||
|
||||
class bad_array_new_length : public bad_alloc
|
||||
{
|
||||
public:
|
||||
bad_array_new_length() noexcept;
|
||||
};
|
||||
|
||||
struct nothrow_t {};
|
||||
extern const nothrow_t nothrow;
|
||||
typedef void (*new_handler)();
|
||||
new_handler set_new_handler(new_handler new_p) noexcept;
|
||||
new_handler get_new_handler() noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
void* operator new(std::size_t size); // replaceable
|
||||
void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable
|
||||
void operator delete(void* ptr) noexcept; // replaceable
|
||||
void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable
|
||||
|
||||
void* operator new[](std::size_t size); // replaceable
|
||||
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable
|
||||
void operator delete[](void* ptr) noexcept; // replaceable
|
||||
void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable
|
||||
|
||||
void* operator new (std::size_t size, void* ptr) noexcept;
|
||||
void* operator new[](std::size_t size, void* ptr) noexcept;
|
||||
void operator delete (void* ptr, void*) noexcept;
|
||||
void operator delete[](void* ptr, void*) noexcept;
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <exception>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_alloc
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_alloc() _NOEXCEPT;
|
||||
virtual ~bad_alloc() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_array_new_length
|
||||
: public bad_alloc
|
||||
{
|
||||
public:
|
||||
bad_array_new_length() _NOEXCEPT;
|
||||
virtual ~bad_array_new_length() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
#if defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_array_length
|
||||
: public bad_alloc
|
||||
{
|
||||
public:
|
||||
bad_array_length() _NOEXCEPT;
|
||||
virtual ~bad_array_length() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
#define _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
|
||||
|
||||
#endif // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
|
||||
|
||||
_LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
|
||||
|
||||
struct _LIBCPP_TYPE_VIS nothrow_t {};
|
||||
extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
|
||||
typedef void (*new_handler)();
|
||||
_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
|
||||
|
||||
} // std
|
||||
|
||||
#if defined(_WIN32) && !defined(cxx_EXPORTS)
|
||||
# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS_ONLY
|
||||
#else
|
||||
# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS
|
||||
#endif
|
||||
|
||||
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
;
|
||||
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p) _NOEXCEPT;
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
;
|
||||
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p) _NOEXCEPT;
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
|
||||
inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
|
||||
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
|
||||
inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {}
|
||||
|
||||
#endif // _LIBCPP_NEW
|
197
external/bsd/libc++/dist/libcxx/include/numeric
vendored
Normal file
197
external/bsd/libc++/dist/libcxx/include/numeric
vendored
Normal file
|
@ -0,0 +1,197 @@
|
|||
// -*- C++ -*-
|
||||
//===---------------------------- numeric ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_NUMERIC
|
||||
#define _LIBCPP_NUMERIC
|
||||
|
||||
/*
|
||||
numeric synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template <class InputIterator, class T>
|
||||
T
|
||||
accumulate(InputIterator first, InputIterator last, T init);
|
||||
|
||||
template <class InputIterator, class T, class BinaryOperation>
|
||||
T
|
||||
accumulate(InputIterator first, InputIterator last, T init, BinaryOperation binary_op);
|
||||
|
||||
template <class InputIterator1, class InputIterator2, class T>
|
||||
T
|
||||
inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init);
|
||||
|
||||
template <class InputIterator1, class InputIterator2, class T, class BinaryOperation1, class BinaryOperation2>
|
||||
T
|
||||
inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
|
||||
T init, BinaryOperation1 binary_op1, BinaryOperation2 binary_op2);
|
||||
|
||||
template <class InputIterator, class OutputIterator>
|
||||
OutputIterator
|
||||
partial_sum(InputIterator first, InputIterator last, OutputIterator result);
|
||||
|
||||
template <class InputIterator, class OutputIterator, class BinaryOperation>
|
||||
OutputIterator
|
||||
partial_sum(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op);
|
||||
|
||||
template <class InputIterator, class OutputIterator>
|
||||
OutputIterator
|
||||
adjacent_difference(InputIterator first, InputIterator last, OutputIterator result);
|
||||
|
||||
template <class InputIterator, class OutputIterator, class BinaryOperation>
|
||||
OutputIterator
|
||||
adjacent_difference(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op);
|
||||
|
||||
template <class ForwardIterator, class T>
|
||||
void iota(ForwardIterator first, ForwardIterator last, T value);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <iterator>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
__init = __init + *__first;
|
||||
return __init;
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _Tp, class _BinaryOperation>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
__init = __binary_op(__init, *__first);
|
||||
return __init;
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init)
|
||||
{
|
||||
for (; __first1 != __last1; ++__first1, ++__first2)
|
||||
__init = __init + *__first1 * *__first2;
|
||||
return __init;
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
|
||||
_Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2)
|
||||
{
|
||||
for (; __first1 != __last1; ++__first1, ++__first2)
|
||||
__init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
|
||||
return __init;
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t(*__first);
|
||||
*__result = __t;
|
||||
for (++__first, ++__result; __first != __last; ++__first, ++__result)
|
||||
{
|
||||
__t = __t + *__first;
|
||||
*__result = __t;
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
|
||||
_BinaryOperation __binary_op)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t(*__first);
|
||||
*__result = __t;
|
||||
for (++__first, ++__result; __first != __last; ++__first, ++__result)
|
||||
{
|
||||
__t = __binary_op(__t, *__first);
|
||||
*__result = __t;
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t1(*__first);
|
||||
*__result = __t1;
|
||||
for (++__first, ++__result; __first != __last; ++__first, ++__result)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
|
||||
*__result = __t2 - __t1;
|
||||
__t1 = _VSTD::move(__t2);
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
|
||||
_BinaryOperation __binary_op)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t1(*__first);
|
||||
*__result = __t1;
|
||||
for (++__first, ++__result; __first != __last; ++__first, ++__result)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
|
||||
*__result = __binary_op(__t2, __t1);
|
||||
__t1 = _VSTD::move(__t2);
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
|
||||
{
|
||||
for (; __first != __last; ++__first, ++__value_)
|
||||
*__first = __value_;
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_NUMERIC
|
697
external/bsd/libc++/dist/libcxx/include/optional
vendored
Normal file
697
external/bsd/libc++/dist/libcxx/include/optional
vendored
Normal file
|
@ -0,0 +1,697 @@
|
|||
// -*- C++ -*-
|
||||
//===-------------------------- optional ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_OPTIONAL
|
||||
#define _LIBCPP_OPTIONAL
|
||||
|
||||
/*
|
||||
optional synopsis
|
||||
|
||||
// C++1y
|
||||
|
||||
#include <initializer_list>
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
// optional for object types
|
||||
template <class T>
|
||||
class optional
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
|
||||
// constructors
|
||||
constexpr optional() noexcept;
|
||||
constexpr optional(nullopt_t) noexcept;
|
||||
optional(const optional&);
|
||||
optional(optional&&) noexcept(is_nothrow_move_constructible<T>::value);
|
||||
constexpr optional(const T&);
|
||||
constexpr optional(T&&);
|
||||
template <class... Args> constexpr explicit optional(in_place_t, Args&&...);
|
||||
template <class U, class... Args>
|
||||
constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...);
|
||||
|
||||
// destructor
|
||||
~optional();
|
||||
|
||||
// assignment
|
||||
optional& operator=(nullopt_t) noexcept;
|
||||
optional& operator=(const optional&);
|
||||
optional& operator=(optional&&)
|
||||
noexcept(is_nothrow_move_assignable<T>::value &&
|
||||
is_nothrow_move_constructible<T>::value);
|
||||
template <class U> optional& operator=(U&&);
|
||||
template <class... Args> void emplace(Args&&...);
|
||||
template <class U, class... Args> void emplace(initializer_list<U>, Args&&...);
|
||||
|
||||
// swap
|
||||
void swap(optional&)
|
||||
noexcept(is_nothrow_move_constructible<T>::value &&
|
||||
noexcept(swap(declval<T&>(), declval<T&>())));
|
||||
|
||||
// observers
|
||||
constexpr T const* operator->() const;
|
||||
T* operator->();
|
||||
constexpr T const& operator*() const;
|
||||
T& operator*();
|
||||
constexpr explicit operator bool() const noexcept;
|
||||
constexpr T const& value() const;
|
||||
T& value();
|
||||
template <class U> constexpr T value_or(U&&) const&;
|
||||
template <class U> T value_or(U&&) &&;
|
||||
};
|
||||
|
||||
// In-place construction
|
||||
struct in_place_t{};
|
||||
constexpr in_place_t in_place{};
|
||||
|
||||
// Disengaged state indicator
|
||||
struct nullopt_t{see below};
|
||||
constexpr nullopt_t nullopt(unspecified);
|
||||
|
||||
// class bad_optional_access
|
||||
class bad_optional_access
|
||||
: public logic_error
|
||||
{
|
||||
public:
|
||||
explicit bad_optional_access(const string& what_arg);
|
||||
explicit bad_optional_access(const char* what_arg);
|
||||
};
|
||||
|
||||
// Relational operators
|
||||
template <class T> constexpr bool operator==(const optional<T>&, const optional<T>&);
|
||||
template <class T> constexpr bool operator< (const optional<T>&, const optional<T>&);
|
||||
|
||||
// Comparison with nullopt
|
||||
template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
|
||||
template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
|
||||
template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
|
||||
template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
|
||||
|
||||
// Comparison with T
|
||||
template <class T> constexpr bool operator==(const optional<T>&, const T&);
|
||||
template <class T> constexpr bool operator==(const T&, const optional<T>&);
|
||||
template <class T> constexpr bool operator<(const optional<T>&, const T&);
|
||||
template <class T> constexpr bool operator<(const T&, const optional<T>&);
|
||||
|
||||
// Specialized algorithms
|
||||
template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below);
|
||||
template <class T> constexpr optional<typename decay<T>::type> make_optional(T&&);
|
||||
|
||||
// hash support
|
||||
template <class T> struct hash;
|
||||
template <class T> struct hash<optional<T>>;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_optional_access
|
||||
: public logic_error
|
||||
{
|
||||
public:
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
_LIBCPP_INLINE_VISIBILITY explicit bad_optional_access(const string& __arg)
|
||||
: logic_error(__arg) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit bad_optional_access(const char* __arg)
|
||||
: logic_error(__arg) {}
|
||||
_LIBCPP_INLINE_VISIBILITY bad_optional_access(const bad_optional_access&) noexcept = default;
|
||||
_LIBCPP_INLINE_VISIBILITY bad_optional_access& operator=(const bad_optional_access&) noexcept = default;
|
||||
#else
|
||||
private:
|
||||
bad_optional_access(const bad_optional_access&);
|
||||
bad_optional_access& operator=(const bad_optional_access&);
|
||||
public:
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
// Get the key function ~bad_optional_access() into the dylib even if not compiling for C++1y
|
||||
virtual ~bad_optional_access() _NOEXCEPT;
|
||||
};
|
||||
|
||||
} // std
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
#include <initializer_list>
|
||||
#include <type_traits>
|
||||
#include <new>
|
||||
#include <__functional_base>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
# include <__debug>
|
||||
#else
|
||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
struct in_place_t {};
|
||||
constexpr in_place_t in_place{};
|
||||
|
||||
struct nullopt_t
|
||||
{
|
||||
explicit constexpr nullopt_t(int) noexcept {}
|
||||
};
|
||||
|
||||
constexpr nullopt_t nullopt{0};
|
||||
|
||||
template <class _Tp, bool = is_trivially_destructible<_Tp>::value>
|
||||
class __optional_storage
|
||||
{
|
||||
protected:
|
||||
typedef _Tp value_type;
|
||||
union
|
||||
{
|
||||
char __null_state_;
|
||||
value_type __val_;
|
||||
};
|
||||
bool __engaged_ = false;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__optional_storage()
|
||||
{
|
||||
if (__engaged_)
|
||||
__val_.~value_type();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage() noexcept
|
||||
: __null_state_('\0') {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__optional_storage(const __optional_storage& __x)
|
||||
: __engaged_(__x.__engaged_)
|
||||
{
|
||||
if (__engaged_)
|
||||
::new(_VSTD::addressof(__val_)) value_type(__x.__val_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__optional_storage(__optional_storage&& __x)
|
||||
noexcept(is_nothrow_move_constructible<value_type>::value)
|
||||
: __engaged_(__x.__engaged_)
|
||||
{
|
||||
if (__engaged_)
|
||||
::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage(const value_type& __v)
|
||||
: __val_(__v),
|
||||
__engaged_(true) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage(value_type&& __v)
|
||||
: __val_(_VSTD::move(__v)),
|
||||
__engaged_(true) {}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
explicit __optional_storage(in_place_t, _Args&&... __args)
|
||||
: __val_(_VSTD::forward<_Args>(__args)...),
|
||||
__engaged_(true) {}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class __optional_storage<_Tp, true>
|
||||
{
|
||||
protected:
|
||||
typedef _Tp value_type;
|
||||
union
|
||||
{
|
||||
char __null_state_;
|
||||
value_type __val_;
|
||||
};
|
||||
bool __engaged_ = false;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage() noexcept
|
||||
: __null_state_('\0') {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__optional_storage(const __optional_storage& __x)
|
||||
: __engaged_(__x.__engaged_)
|
||||
{
|
||||
if (__engaged_)
|
||||
::new(_VSTD::addressof(__val_)) value_type(__x.__val_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__optional_storage(__optional_storage&& __x)
|
||||
noexcept(is_nothrow_move_constructible<value_type>::value)
|
||||
: __engaged_(__x.__engaged_)
|
||||
{
|
||||
if (__engaged_)
|
||||
::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage(const value_type& __v)
|
||||
: __val_(__v),
|
||||
__engaged_(true) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage(value_type&& __v)
|
||||
: __val_(_VSTD::move(__v)),
|
||||
__engaged_(true) {}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
explicit __optional_storage(in_place_t, _Args&&... __args)
|
||||
: __val_(_VSTD::forward<_Args>(__args)...),
|
||||
__engaged_(true) {}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class optional
|
||||
: private __optional_storage<_Tp>
|
||||
{
|
||||
typedef __optional_storage<_Tp> __base;
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
|
||||
static_assert(!is_reference<value_type>::value,
|
||||
"Instantiation of optional with a reference type is ill-formed.");
|
||||
static_assert(!is_same<typename remove_cv<value_type>::type, in_place_t>::value,
|
||||
"Instantiation of optional with a in_place_t type is ill-formed.");
|
||||
static_assert(!is_same<typename remove_cv<value_type>::type, nullopt_t>::value,
|
||||
"Instantiation of optional with a nullopt_t type is ill-formed.");
|
||||
static_assert(is_object<value_type>::value,
|
||||
"Instantiation of optional with a non-object type is undefined behavior.");
|
||||
static_assert(is_nothrow_destructible<value_type>::value,
|
||||
"Instantiation of optional with an object type that is not noexcept destructible is undefined behavior.");
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {}
|
||||
_LIBCPP_INLINE_VISIBILITY optional(const optional&) = default;
|
||||
_LIBCPP_INLINE_VISIBILITY optional(optional&&) = default;
|
||||
_LIBCPP_INLINE_VISIBILITY ~optional() = default;
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr optional(const value_type& __v)
|
||||
: __base(__v) {}
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr optional(value_type&& __v)
|
||||
: __base(_VSTD::move(__v)) {}
|
||||
|
||||
template <class... _Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<value_type, _Args...>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
explicit optional(in_place_t, _Args&&... __args)
|
||||
: __base(in_place, _VSTD::forward<_Args>(__args)...) {}
|
||||
|
||||
template <class _Up, class... _Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
|
||||
: __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
optional& operator=(nullopt_t) noexcept
|
||||
{
|
||||
if (this->__engaged_)
|
||||
{
|
||||
this->__val_.~value_type();
|
||||
this->__engaged_ = false;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
optional&
|
||||
operator=(const optional& __opt)
|
||||
{
|
||||
if (this->__engaged_ == __opt.__engaged_)
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_ = __opt.__val_;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_.~value_type();
|
||||
else
|
||||
::new(_VSTD::addressof(this->__val_)) value_type(__opt.__val_);
|
||||
this->__engaged_ = __opt.__engaged_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
optional&
|
||||
operator=(optional&& __opt)
|
||||
noexcept(is_nothrow_move_assignable<value_type>::value &&
|
||||
is_nothrow_move_constructible<value_type>::value)
|
||||
{
|
||||
if (this->__engaged_ == __opt.__engaged_)
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_ = _VSTD::move(__opt.__val_);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_.~value_type();
|
||||
else
|
||||
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::move(__opt.__val_));
|
||||
this->__engaged_ = __opt.__engaged_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _Up,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_same<typename remove_reference<_Up>::type, value_type>::value &&
|
||||
is_constructible<value_type, _Up>::value &&
|
||||
is_assignable<value_type&, _Up>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
optional&
|
||||
operator=(_Up&& __v)
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_ = _VSTD::forward<_Up>(__v);
|
||||
else
|
||||
{
|
||||
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Up>(__v));
|
||||
this->__engaged_ = true;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class... _Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<value_type, _Args...>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
*this = nullopt;
|
||||
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...);
|
||||
this->__engaged_ = true;
|
||||
}
|
||||
|
||||
template <class _Up, class... _Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
emplace(initializer_list<_Up> __il, _Args&&... __args)
|
||||
{
|
||||
*this = nullopt;
|
||||
::new(_VSTD::addressof(this->__val_)) value_type(__il, _VSTD::forward<_Args>(__args)...);
|
||||
this->__engaged_ = true;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(optional& __opt)
|
||||
noexcept(is_nothrow_move_constructible<value_type>::value &&
|
||||
__is_nothrow_swappable<value_type>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
if (this->__engaged_ == __opt.__engaged_)
|
||||
{
|
||||
if (this->__engaged_)
|
||||
swap(this->__val_, __opt.__val_);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->__engaged_)
|
||||
{
|
||||
::new(_VSTD::addressof(__opt.__val_)) value_type(_VSTD::move(this->__val_));
|
||||
this->__val_.~value_type();
|
||||
}
|
||||
else
|
||||
{
|
||||
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::move(__opt.__val_));
|
||||
__opt.__val_.~value_type();
|
||||
}
|
||||
swap(this->__engaged_, __opt.__engaged_);
|
||||
}
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
value_type const*
|
||||
operator->() const
|
||||
{
|
||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
|
||||
return __operator_arrow(__has_operator_addressof<value_type>{});
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type*
|
||||
operator->()
|
||||
{
|
||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
|
||||
return _VSTD::addressof(this->__val_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
const value_type&
|
||||
operator*() const
|
||||
{
|
||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
|
||||
return this->__val_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type&
|
||||
operator*()
|
||||
{
|
||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
|
||||
return this->__val_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr explicit operator bool() const noexcept {return this->__engaged_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr value_type const& value() const
|
||||
{
|
||||
if (!this->__engaged_)
|
||||
throw bad_optional_access("optional<T>::value: not engaged");
|
||||
return this->__val_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type& value()
|
||||
{
|
||||
if (!this->__engaged_)
|
||||
throw bad_optional_access("optional<T>::value: not engaged");
|
||||
return this->__val_;
|
||||
}
|
||||
|
||||
template <class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr value_type value_or(_Up&& __v) const&
|
||||
{
|
||||
static_assert(is_copy_constructible<value_type>::value,
|
||||
"optional<T>::value_or: T must be copy constructible");
|
||||
static_assert(is_convertible<_Up, value_type>::value,
|
||||
"optional<T>::value_or: U must be convertible to T");
|
||||
return this->__engaged_ ? this->__val_ :
|
||||
static_cast<value_type>(_VSTD::forward<_Up>(__v));
|
||||
}
|
||||
|
||||
template <class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type value_or(_Up&& __v) &&
|
||||
{
|
||||
static_assert(is_move_constructible<value_type>::value,
|
||||
"optional<T>::value_or: T must be move constructible");
|
||||
static_assert(is_convertible<_Up, value_type>::value,
|
||||
"optional<T>::value_or: U must be convertible to T");
|
||||
return this->__engaged_ ? _VSTD::move(this->__val_) :
|
||||
static_cast<value_type>(_VSTD::forward<_Up>(__v));
|
||||
}
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type const*
|
||||
__operator_arrow(true_type) const
|
||||
{
|
||||
return _VSTD::addressof(this->__val_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
value_type const*
|
||||
__operator_arrow(false_type) const
|
||||
{
|
||||
return &this->__val_;
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
{
|
||||
if (static_cast<bool>(__x) != static_cast<bool>(__y))
|
||||
return false;
|
||||
if (!static_cast<bool>(__x))
|
||||
return true;
|
||||
return *__x == *__y;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
{
|
||||
if (!static_cast<bool>(__y))
|
||||
return false;
|
||||
if (!static_cast<bool>(__x))
|
||||
return true;
|
||||
return less<_Tp>{}(*__x, *__y);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(const optional<_Tp>& __x, nullopt_t) noexcept
|
||||
{
|
||||
return !static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||
{
|
||||
return !static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(const optional<_Tp>&, nullopt_t) noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||
{
|
||||
return static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(const optional<_Tp>& __x, const _Tp& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? *__x == __v : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(const _Tp& __v, const optional<_Tp>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? *__x == __v : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(const optional<_Tp>& __x, const _Tp& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? less<_Tp>{}(*__x, __v) : true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(const _Tp& __v, const optional<_Tp>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? less<_Tp>{}(__v, *__x) : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
optional<typename decay<_Tp>::type>
|
||||
make_optional(_Tp&& __v)
|
||||
{
|
||||
return optional<typename decay<_Tp>::type>(_VSTD::forward<_Tp>(__v));
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY hash<optional<_Tp> >
|
||||
{
|
||||
typedef optional<_Tp> argument_type;
|
||||
typedef size_t result_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result_type operator()(const argument_type& __opt) const _NOEXCEPT
|
||||
{
|
||||
return static_cast<bool>(__opt) ? hash<_Tp>()(*__opt) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
|
||||
#endif // _LIBCPP_ARRAY
|
1295
external/bsd/libc++/dist/libcxx/include/ostream
vendored
Normal file
1295
external/bsd/libc++/dist/libcxx/include/ostream
vendored
Normal file
File diff suppressed because it is too large
Load diff
717
external/bsd/libc++/dist/libcxx/include/queue
vendored
Normal file
717
external/bsd/libc++/dist/libcxx/include/queue
vendored
Normal file
|
@ -0,0 +1,717 @@
|
|||
// -*- C++ -*-
|
||||
//===--------------------------- queue ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_QUEUE
|
||||
#define _LIBCPP_QUEUE
|
||||
|
||||
/*
|
||||
queue synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template <class T, class Container = deque<T>>
|
||||
class queue
|
||||
{
|
||||
public:
|
||||
typedef Container container_type;
|
||||
typedef typename container_type::value_type value_type;
|
||||
typedef typename container_type::reference reference;
|
||||
typedef typename container_type::const_reference const_reference;
|
||||
typedef typename container_type::size_type size_type;
|
||||
|
||||
protected:
|
||||
container_type c;
|
||||
|
||||
public:
|
||||
queue() = default;
|
||||
~queue() = default;
|
||||
|
||||
queue(const queue& q) = default;
|
||||
queue(queue&& q) = default;
|
||||
|
||||
queue& operator=(const queue& q) = default;
|
||||
queue& operator=(queue&& q) = default;
|
||||
|
||||
explicit queue(const container_type& c);
|
||||
explicit queue(container_type&& c)
|
||||
template <class Alloc>
|
||||
explicit queue(const Alloc& a);
|
||||
template <class Alloc>
|
||||
queue(const container_type& c, const Alloc& a);
|
||||
template <class Alloc>
|
||||
queue(container_type&& c, const Alloc& a);
|
||||
template <class Alloc>
|
||||
queue(const queue& q, const Alloc& a);
|
||||
template <class Alloc>
|
||||
queue(queue&& q, const Alloc& a);
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
|
||||
reference front();
|
||||
const_reference front() const;
|
||||
reference back();
|
||||
const_reference back() const;
|
||||
|
||||
void push(const value_type& v);
|
||||
void push(value_type&& v);
|
||||
template <class... Args> void emplace(Args&&... args);
|
||||
void pop();
|
||||
|
||||
void swap(queue& q) noexcept(noexcept(swap(c, q.c)));
|
||||
};
|
||||
|
||||
template <class T, class Container>
|
||||
bool operator==(const queue<T, Container>& x,const queue<T, Container>& y);
|
||||
|
||||
template <class T, class Container>
|
||||
bool operator< (const queue<T, Container>& x,const queue<T, Container>& y);
|
||||
|
||||
template <class T, class Container>
|
||||
bool operator!=(const queue<T, Container>& x,const queue<T, Container>& y);
|
||||
|
||||
template <class T, class Container>
|
||||
bool operator> (const queue<T, Container>& x,const queue<T, Container>& y);
|
||||
|
||||
template <class T, class Container>
|
||||
bool operator>=(const queue<T, Container>& x,const queue<T, Container>& y);
|
||||
|
||||
template <class T, class Container>
|
||||
bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y);
|
||||
|
||||
template <class T, class Container>
|
||||
void swap(queue<T, Container>& x, queue<T, Container>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class T, class Container = vector<T>,
|
||||
class Compare = less<typename Container::value_type>>
|
||||
class priority_queue
|
||||
{
|
||||
public:
|
||||
typedef Container container_type;
|
||||
typedef typename container_type::value_type value_type;
|
||||
typedef typename container_type::reference reference;
|
||||
typedef typename container_type::const_reference const_reference;
|
||||
typedef typename container_type::size_type size_type;
|
||||
|
||||
protected:
|
||||
container_type c;
|
||||
Compare comp;
|
||||
|
||||
public:
|
||||
priority_queue() = default;
|
||||
~priority_queue() = default;
|
||||
|
||||
priority_queue(const priority_queue& q) = default;
|
||||
priority_queue(priority_queue&& q) = default;
|
||||
|
||||
priority_queue& operator=(const priority_queue& q) = default;
|
||||
priority_queue& operator=(priority_queue&& q) = default;
|
||||
|
||||
explicit priority_queue(const Compare& comp);
|
||||
priority_queue(const Compare& comp, const container_type& c);
|
||||
explicit priority_queue(const Compare& comp, container_type&& c);
|
||||
template <class InputIterator>
|
||||
priority_queue(InputIterator first, InputIterator last,
|
||||
const Compare& comp = Compare());
|
||||
template <class InputIterator>
|
||||
priority_queue(InputIterator first, InputIterator last,
|
||||
const Compare& comp, const container_type& c);
|
||||
template <class InputIterator>
|
||||
priority_queue(InputIterator first, InputIterator last,
|
||||
const Compare& comp, container_type&& c);
|
||||
template <class Alloc>
|
||||
explicit priority_queue(const Alloc& a);
|
||||
template <class Alloc>
|
||||
priority_queue(const Compare& comp, const Alloc& a);
|
||||
template <class Alloc>
|
||||
priority_queue(const Compare& comp, const container_type& c,
|
||||
const Alloc& a);
|
||||
template <class Alloc>
|
||||
priority_queue(const Compare& comp, container_type&& c,
|
||||
const Alloc& a);
|
||||
template <class Alloc>
|
||||
priority_queue(const priority_queue& q, const Alloc& a);
|
||||
template <class Alloc>
|
||||
priority_queue(priority_queue&& q, const Alloc& a);
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
const_reference top() const;
|
||||
|
||||
void push(const value_type& v);
|
||||
void push(value_type&& v);
|
||||
template <class... Args> void emplace(Args&&... args);
|
||||
void pop();
|
||||
|
||||
void swap(priority_queue& q)
|
||||
noexcept(noexcept(swap(c, q.c)) && noexcept(swap(comp.q.comp)));
|
||||
};
|
||||
|
||||
template <class T, class Container, class Compare>
|
||||
void swap(priority_queue<T, Container, Compare>& x,
|
||||
priority_queue<T, Container, Compare>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS_ONLY queue;
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container = deque<_Tp> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY queue
|
||||
{
|
||||
public:
|
||||
typedef _Container container_type;
|
||||
typedef typename container_type::value_type value_type;
|
||||
typedef typename container_type::reference reference;
|
||||
typedef typename container_type::const_reference const_reference;
|
||||
typedef typename container_type::size_type size_type;
|
||||
|
||||
protected:
|
||||
container_type c;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
|
||||
: c() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(const queue& __q) : c(__q.c) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(queue&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
|
||||
: c(_VSTD::move(__q.c)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue& operator=(const queue& __q) {c = __q.c; return *this;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue& operator=(queue&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
|
||||
{c = _VSTD::move(__q.c); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit queue(const container_type& __c) : c(__c) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit queue(const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(const queue& __q, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__q.c, __a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(const container_type& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__c, __a) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(container_type&& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_VSTD::move(__c), __a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(queue&& __q, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_VSTD::move(__q.c), __a) {}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return c.empty();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return c.size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference front() {return c.front();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference front() const {return c.front();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference back() {return c.back();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference back() const {return c.back();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(const value_type& __v) {c.push_back(__v);}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(_Args&&... __args)
|
||||
{c.emplace_back(_VSTD::forward<_Args>(__args)...);}
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void pop() {c.pop_front();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(queue& __q)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(c, __q.c);
|
||||
}
|
||||
|
||||
template <class _T1, class _C1>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
|
||||
|
||||
template <class _T1, class _C1>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
|
||||
};
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
return __x.c == __y.c;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
return __x.c < __y.c;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Alloc>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<queue<_Tp, _Container>, _Alloc>
|
||||
: public uses_allocator<_Container, _Alloc>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, class _Container = vector<_Tp>,
|
||||
class _Compare = less<typename _Container::value_type> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY priority_queue
|
||||
{
|
||||
public:
|
||||
typedef _Container container_type;
|
||||
typedef _Compare value_compare;
|
||||
typedef typename container_type::value_type value_type;
|
||||
typedef typename container_type::reference reference;
|
||||
typedef typename container_type::const_reference const_reference;
|
||||
typedef typename container_type::size_type size_type;
|
||||
|
||||
protected:
|
||||
container_type c;
|
||||
value_compare comp;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value &&
|
||||
is_nothrow_default_constructible<value_compare>::value)
|
||||
: c(), comp() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue(priority_queue&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
|
||||
is_nothrow_move_constructible<value_compare>::value)
|
||||
: c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue& operator=(const priority_queue& __q)
|
||||
{c = __q.c; comp = __q.comp; return *this;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue& operator=(priority_queue&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
|
||||
is_nothrow_move_assignable<value_compare>::value)
|
||||
{c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit priority_queue(const value_compare& __comp)
|
||||
: c(), comp(__comp) {}
|
||||
priority_queue(const value_compare& __comp, const container_type& __c);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
explicit priority_queue(const value_compare& __comp, container_type&& __c);
|
||||
#endif
|
||||
template <class _InputIter>
|
||||
priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp = value_compare());
|
||||
template <class _InputIter>
|
||||
priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp, const container_type& __c);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _InputIter>
|
||||
priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp, container_type&& __c);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
explicit priority_queue(const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0);
|
||||
template <class _Alloc>
|
||||
priority_queue(const value_compare& __comp, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0);
|
||||
template <class _Alloc>
|
||||
priority_queue(const value_compare& __comp, const container_type& __c,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0);
|
||||
template <class _Alloc>
|
||||
priority_queue(const priority_queue& __q, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
priority_queue(const value_compare& __comp, container_type&& __c,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0);
|
||||
template <class _Alloc>
|
||||
priority_queue(priority_queue&& __q, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return c.empty();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return c.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference top() const {return c.front();}
|
||||
|
||||
void push(const value_type& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void push(value_type&& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args> void emplace(_Args&&... __args);
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void pop();
|
||||
|
||||
void swap(priority_queue& __q)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
|
||||
__is_nothrow_swappable<value_compare>::value);
|
||||
};
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp,
|
||||
const container_type& __c)
|
||||
: c(__c),
|
||||
comp(__comp)
|
||||
{
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
container_type&& __c)
|
||||
: c(_VSTD::move(__c)),
|
||||
comp(__comp)
|
||||
{
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _InputIter>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp)
|
||||
: c(__f, __l),
|
||||
comp(__comp)
|
||||
{
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _InputIter>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp,
|
||||
const container_type& __c)
|
||||
: c(__c),
|
||||
comp(__comp)
|
||||
{
|
||||
c.insert(c.end(), __f, __l);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _InputIter>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp,
|
||||
container_type&& __c)
|
||||
: c(_VSTD::move(__c)),
|
||||
comp(__comp)
|
||||
{
|
||||
c.insert(c.end(), __f, __l);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type*)
|
||||
: c(__a)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type*)
|
||||
: c(__a),
|
||||
comp(__comp)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
const container_type& __c,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type*)
|
||||
: c(__c, __a),
|
||||
comp(__comp)
|
||||
{
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type*)
|
||||
: c(__q.c, __a),
|
||||
comp(__q.comp)
|
||||
{
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
container_type&& __c,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type*)
|
||||
: c(_VSTD::move(__c), __a),
|
||||
comp(__comp)
|
||||
{
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type*)
|
||||
: c(_VSTD::move(__q.c), __a),
|
||||
comp(_VSTD::move(__q.comp))
|
||||
{
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
|
||||
{
|
||||
c.push_back(__v);
|
||||
_VSTD::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
|
||||
{
|
||||
c.push_back(_VSTD::move(__v));
|
||||
_VSTD::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class... _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
|
||||
{
|
||||
c.emplace_back(_VSTD::forward<_Args>(__args)...);
|
||||
_VSTD::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::pop()
|
||||
{
|
||||
_VSTD::pop_heap(c.begin(), c.end(), comp);
|
||||
c.pop_back();
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
|
||||
__is_nothrow_swappable<value_compare>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(c, __q.c);
|
||||
swap(comp, __q.comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(priority_queue<_Tp, _Container, _Compare>& __x,
|
||||
priority_queue<_Tp, _Container, _Compare>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare, class _Alloc>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
|
||||
: public uses_allocator<_Container, _Alloc>
|
||||
{
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_QUEUE
|
6725
external/bsd/libc++/dist/libcxx/include/random
vendored
Normal file
6725
external/bsd/libc++/dist/libcxx/include/random
vendored
Normal file
File diff suppressed because it is too large
Load diff
487
external/bsd/libc++/dist/libcxx/include/ratio
vendored
Normal file
487
external/bsd/libc++/dist/libcxx/include/ratio
vendored
Normal file
|
@ -0,0 +1,487 @@
|
|||
// -*- C++ -*-
|
||||
//===---------------------------- ratio -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_RATIO
|
||||
#define _LIBCPP_RATIO
|
||||
|
||||
/*
|
||||
ratio synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template <intmax_t N, intmax_t D = 1>
|
||||
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> 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;
|
||||
template <class R1, class R2> struct ratio_not_equal;
|
||||
template <class R1, class R2> struct ratio_less;
|
||||
template <class R1, class R2> struct ratio_less_equal;
|
||||
template <class R1, class R2> struct ratio_greater;
|
||||
template <class R1, class R2> struct ratio_greater_equal;
|
||||
|
||||
// convenience SI typedefs
|
||||
typedef ratio<1, 1000000000000000000000000> yocto; // not supported
|
||||
typedef ratio<1, 1000000000000000000000> zepto; // not supported
|
||||
typedef ratio<1, 1000000000000000000> atto;
|
||||
typedef ratio<1, 1000000000000000> femto;
|
||||
typedef ratio<1, 1000000000000> pico;
|
||||
typedef ratio<1, 1000000000> nano;
|
||||
typedef ratio<1, 1000000> micro;
|
||||
typedef ratio<1, 1000> milli;
|
||||
typedef ratio<1, 100> centi;
|
||||
typedef ratio<1, 10> deci;
|
||||
typedef ratio< 10, 1> deca;
|
||||
typedef ratio< 100, 1> hecto;
|
||||
typedef ratio< 1000, 1> kilo;
|
||||
typedef ratio< 1000000, 1> mega;
|
||||
typedef ratio< 1000000000, 1> giga;
|
||||
typedef ratio< 1000000000000, 1> tera;
|
||||
typedef ratio< 1000000000000000, 1> peta;
|
||||
typedef ratio< 1000000000000000000, 1> exa;
|
||||
typedef ratio< 1000000000000000000000, 1> zetta; // not supported
|
||||
typedef ratio<1000000000000000000000000, 1> yotta; // not supported
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cstdint>
|
||||
#include <climits>
|
||||
#include <type_traits>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// __static_gcd
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp>
|
||||
struct __static_gcd
|
||||
{
|
||||
static const intmax_t value = __static_gcd<_Yp, _Xp % _Yp>::value;
|
||||
};
|
||||
|
||||
template <intmax_t _Xp>
|
||||
struct __static_gcd<_Xp, 0>
|
||||
{
|
||||
static const intmax_t value = _Xp;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct __static_gcd<0, 0>
|
||||
{
|
||||
static const intmax_t value = 1;
|
||||
};
|
||||
|
||||
// __static_lcm
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp>
|
||||
struct __static_lcm
|
||||
{
|
||||
static const intmax_t value = _Xp / __static_gcd<_Xp, _Yp>::value * _Yp;
|
||||
};
|
||||
|
||||
template <intmax_t _Xp>
|
||||
struct __static_abs
|
||||
{
|
||||
static const intmax_t value = _Xp < 0 ? -_Xp : _Xp;
|
||||
};
|
||||
|
||||
template <intmax_t _Xp>
|
||||
struct __static_sign
|
||||
{
|
||||
static const intmax_t value = _Xp == 0 ? 0 : (_Xp < 0 ? -1 : 1);
|
||||
};
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp, intmax_t = __static_sign<_Yp>::value>
|
||||
class __ll_add;
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp>
|
||||
class __ll_add<_Xp, _Yp, 1>
|
||||
{
|
||||
static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
|
||||
static const intmax_t max = -min;
|
||||
|
||||
static_assert(_Xp <= max - _Yp, "overflow in __ll_add");
|
||||
public:
|
||||
static const intmax_t value = _Xp + _Yp;
|
||||
};
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp>
|
||||
class __ll_add<_Xp, _Yp, 0>
|
||||
{
|
||||
public:
|
||||
static const intmax_t value = _Xp;
|
||||
};
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp>
|
||||
class __ll_add<_Xp, _Yp, -1>
|
||||
{
|
||||
static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
|
||||
static const intmax_t max = -min;
|
||||
|
||||
static_assert(min - _Yp <= _Xp, "overflow in __ll_add");
|
||||
public:
|
||||
static const intmax_t value = _Xp + _Yp;
|
||||
};
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp, intmax_t = __static_sign<_Yp>::value>
|
||||
class __ll_sub;
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp>
|
||||
class __ll_sub<_Xp, _Yp, 1>
|
||||
{
|
||||
static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
|
||||
static const intmax_t max = -min;
|
||||
|
||||
static_assert(min + _Yp <= _Xp, "overflow in __ll_sub");
|
||||
public:
|
||||
static const intmax_t value = _Xp - _Yp;
|
||||
};
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp>
|
||||
class __ll_sub<_Xp, _Yp, 0>
|
||||
{
|
||||
public:
|
||||
static const intmax_t value = _Xp;
|
||||
};
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp>
|
||||
class __ll_sub<_Xp, _Yp, -1>
|
||||
{
|
||||
static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
|
||||
static const intmax_t max = -min;
|
||||
|
||||
static_assert(_Xp <= max + _Yp, "overflow in __ll_sub");
|
||||
public:
|
||||
static const intmax_t value = _Xp - _Yp;
|
||||
};
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp>
|
||||
class __ll_mul
|
||||
{
|
||||
static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
|
||||
static const intmax_t min = nan + 1;
|
||||
static const intmax_t max = -min;
|
||||
static const intmax_t __a_x = __static_abs<_Xp>::value;
|
||||
static const intmax_t __a_y = __static_abs<_Yp>::value;
|
||||
|
||||
static_assert(_Xp != nan && _Yp != nan && __a_x <= max / __a_y, "overflow in __ll_mul");
|
||||
public:
|
||||
static const intmax_t value = _Xp * _Yp;
|
||||
};
|
||||
|
||||
template <intmax_t _Yp>
|
||||
class __ll_mul<0, _Yp>
|
||||
{
|
||||
public:
|
||||
static const intmax_t value = 0;
|
||||
};
|
||||
|
||||
template <intmax_t _Xp>
|
||||
class __ll_mul<_Xp, 0>
|
||||
{
|
||||
public:
|
||||
static const intmax_t value = 0;
|
||||
};
|
||||
|
||||
template <>
|
||||
class __ll_mul<0, 0>
|
||||
{
|
||||
public:
|
||||
static const intmax_t value = 0;
|
||||
};
|
||||
|
||||
// Not actually used but left here in case needed in future maintenance
|
||||
template <intmax_t _Xp, intmax_t _Yp>
|
||||
class __ll_div
|
||||
{
|
||||
static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
|
||||
static const intmax_t min = nan + 1;
|
||||
static const intmax_t max = -min;
|
||||
|
||||
static_assert(_Xp != nan && _Yp != nan && _Yp != 0, "overflow in __ll_div");
|
||||
public:
|
||||
static const intmax_t value = _Xp / _Yp;
|
||||
};
|
||||
|
||||
template <intmax_t _Num, intmax_t _Den = 1>
|
||||
class _LIBCPP_TYPE_VIS_ONLY ratio
|
||||
{
|
||||
static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
|
||||
static_assert(_Den != 0, "ratio divide by 0");
|
||||
static_assert(__static_abs<_Den>::value > 0, "ratio denominator is out of range");
|
||||
static const intmax_t __na = __static_abs<_Num>::value;
|
||||
static const intmax_t __da = __static_abs<_Den>::value;
|
||||
static const intmax_t __s = __static_sign<_Num>::value * __static_sign<_Den>::value;
|
||||
static const intmax_t __gcd = __static_gcd<__na, __da>::value;
|
||||
public:
|
||||
static const intmax_t num = __s * __na / __gcd;
|
||||
static const intmax_t den = __da / __gcd;
|
||||
|
||||
typedef ratio<num, den> type;
|
||||
};
|
||||
|
||||
template <intmax_t _Num, intmax_t _Den> const intmax_t ratio<_Num, _Den>::num;
|
||||
template <intmax_t _Num, intmax_t _Den> const intmax_t ratio<_Num, _Den>::den;
|
||||
|
||||
template <class _Tp> struct __is_ratio : false_type {};
|
||||
template <intmax_t _Num, intmax_t _Den> struct __is_ratio<ratio<_Num, _Den> > : true_type {};
|
||||
|
||||
typedef ratio<1LL, 1000000000000000000LL> atto;
|
||||
typedef ratio<1LL, 1000000000000000LL> femto;
|
||||
typedef ratio<1LL, 1000000000000LL> pico;
|
||||
typedef ratio<1LL, 1000000000LL> nano;
|
||||
typedef ratio<1LL, 1000000LL> micro;
|
||||
typedef ratio<1LL, 1000LL> milli;
|
||||
typedef ratio<1LL, 100LL> centi;
|
||||
typedef ratio<1LL, 10LL> deci;
|
||||
typedef ratio< 10LL, 1LL> deca;
|
||||
typedef ratio< 100LL, 1LL> hecto;
|
||||
typedef ratio< 1000LL, 1LL> kilo;
|
||||
typedef ratio< 1000000LL, 1LL> mega;
|
||||
typedef ratio< 1000000000LL, 1LL> giga;
|
||||
typedef ratio< 1000000000000LL, 1LL> tera;
|
||||
typedef ratio< 1000000000000000LL, 1LL> peta;
|
||||
typedef ratio<1000000000000000000LL, 1LL> exa;
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_multiply
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value;
|
||||
static const intmax_t __gcd_d1_n2 = __static_gcd<_R1::den, _R2::num>::value;
|
||||
public:
|
||||
typedef typename ratio
|
||||
<
|
||||
__ll_mul<_R1::num / __gcd_n1_d2, _R2::num / __gcd_d1_n2>::value,
|
||||
__ll_mul<_R2::den / __gcd_n1_d2, _R1::den / __gcd_d1_n2>::value
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2> using ratio_multiply
|
||||
= typename __ratio_multiply<_R1, _R2>::type;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_multiply
|
||||
: public __ratio_multiply<_R1, _R2>::type {};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_divide
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||
static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
|
||||
public:
|
||||
typedef typename ratio
|
||||
<
|
||||
__ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
|
||||
__ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2> using ratio_divide
|
||||
= typename __ratio_divide<_R1, _R2>::type;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_divide
|
||||
: public __ratio_divide<_R1, _R2>::type {};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_add
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||
static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
|
||||
public:
|
||||
typedef typename ratio_multiply
|
||||
<
|
||||
ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
|
||||
ratio
|
||||
<
|
||||
__ll_add
|
||||
<
|
||||
__ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
|
||||
__ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value
|
||||
>::value,
|
||||
_R2::den
|
||||
>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2> using ratio_add
|
||||
= typename __ratio_add<_R1, _R2>::type;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_add
|
||||
: public __ratio_add<_R1, _R2>::type {};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_subtract
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||
static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
|
||||
public:
|
||||
typedef typename ratio_multiply
|
||||
<
|
||||
ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
|
||||
ratio
|
||||
<
|
||||
__ll_sub
|
||||
<
|
||||
__ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
|
||||
__ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value
|
||||
>::value,
|
||||
_R2::den
|
||||
>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2> using ratio_subtract
|
||||
= typename __ratio_subtract<_R1, _R2>::type;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_subtract
|
||||
: public __ratio_subtract<_R1, _R2>::type {};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
// ratio_equal
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_equal
|
||||
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_not_equal
|
||||
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
|
||||
|
||||
// ratio_less
|
||||
|
||||
template <class _R1, class _R2, bool _Odd = false,
|
||||
intmax_t _Q1 = _R1::num / _R1::den, intmax_t _M1 = _R1::num % _R1::den,
|
||||
intmax_t _Q2 = _R2::num / _R2::den, intmax_t _M2 = _R2::num % _R2::den>
|
||||
struct __ratio_less1
|
||||
{
|
||||
static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Qp>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0>
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2>
|
||||
{
|
||||
static const bool value = !_Odd;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0>
|
||||
{
|
||||
static const bool value = _Odd;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1,
|
||||
intmax_t _M2>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2>
|
||||
{
|
||||
static const bool value = __ratio_less1<ratio<_R1::den, _M1>,
|
||||
ratio<_R2::den, _M2>, !_Odd>::value;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2, intmax_t _S1 = __static_sign<_R1::num>::value,
|
||||
intmax_t _S2 = __static_sign<_R2::num>::value>
|
||||
struct __ratio_less
|
||||
{
|
||||
static const bool value = _S1 < _S2;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_less<_R1, _R2, 1LL, 1LL>
|
||||
{
|
||||
static const bool value = __ratio_less1<_R1, _R2>::value;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_less<_R1, _R2, -1LL, -1LL>
|
||||
{
|
||||
static const bool value = __ratio_less1<ratio<-_R2::num, _R2::den>, ratio<-_R1::num, _R1::den> >::value;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_less
|
||||
: public integral_constant<bool, __ratio_less<_R1, _R2>::value> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_less_equal
|
||||
: public integral_constant<bool, !ratio_less<_R2, _R1>::value> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_greater
|
||||
: public integral_constant<bool, ratio_less<_R2, _R1>::value> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_greater_equal
|
||||
: public integral_constant<bool, !ratio_less<_R1, _R2>::value> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_gcd
|
||||
{
|
||||
typedef ratio<__static_gcd<_R1::num, _R2::num>::value,
|
||||
__static_lcm<_R1::den, _R2::den>::value> type;
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_RATIO
|
6487
external/bsd/libc++/dist/libcxx/include/regex
vendored
Normal file
6487
external/bsd/libc++/dist/libcxx/include/regex
vendored
Normal file
File diff suppressed because it is too large
Load diff
578
external/bsd/libc++/dist/libcxx/include/scoped_allocator
vendored
Normal file
578
external/bsd/libc++/dist/libcxx/include/scoped_allocator
vendored
Normal file
|
@ -0,0 +1,578 @@
|
|||
// -*- C++ -*-
|
||||
//===-------------------------- scoped_allocator --------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SCOPED_ALLOCATOR
|
||||
#define _LIBCPP_SCOPED_ALLOCATOR
|
||||
|
||||
/*
|
||||
scoped_allocator synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template <class OuterAlloc, class... InnerAllocs>
|
||||
class scoped_allocator_adaptor : public OuterAlloc
|
||||
{
|
||||
typedef allocator_traits<OuterAlloc> OuterTraits; // exposition only
|
||||
scoped_allocator_adaptor<InnerAllocs...> inner; // exposition only
|
||||
public:
|
||||
|
||||
typedef OuterAlloc outer_allocator_type;
|
||||
typedef see below inner_allocator_type;
|
||||
|
||||
typedef typename OuterTraits::value_type value_type;
|
||||
typedef typename OuterTraits::size_type size_type;
|
||||
typedef typename OuterTraits::difference_type difference_type;
|
||||
typedef typename OuterTraits::pointer pointer;
|
||||
typedef typename OuterTraits::const_pointer const_pointer;
|
||||
typedef typename OuterTraits::void_pointer void_pointer;
|
||||
typedef typename OuterTraits::const_void_pointer const_void_pointer;
|
||||
|
||||
typedef see below propagate_on_container_copy_assignment;
|
||||
typedef see below propagate_on_container_move_assignment;
|
||||
typedef see below propagate_on_container_swap;
|
||||
|
||||
template <class Tp>
|
||||
struct rebind
|
||||
{
|
||||
typedef scoped_allocator_adaptor<
|
||||
OuterTraits::template rebind_alloc<Tp>, InnerAllocs...> other;
|
||||
};
|
||||
|
||||
scoped_allocator_adaptor();
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor(OuterA2&& outerAlloc,
|
||||
const InnerAllocs&... innerAllocs) noexcept;
|
||||
scoped_allocator_adaptor(const scoped_allocator_adaptor& other) noexcept;
|
||||
scoped_allocator_adaptor(scoped_allocator_adaptor&& other) noexcept;
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other) noexcept;
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
|
||||
|
||||
~scoped_allocator_adaptor();
|
||||
|
||||
inner_allocator_type& inner_allocator() noexcept;
|
||||
const inner_allocator_type& inner_allocator() const noexcept;
|
||||
|
||||
outer_allocator_type& outer_allocator() noexcept;
|
||||
const outer_allocator_type& outer_allocator() const noexcept;
|
||||
|
||||
pointer allocate(size_type n);
|
||||
pointer allocate(size_type n, const_void_pointer hint);
|
||||
void deallocate(pointer p, size_type n) noexcept;
|
||||
|
||||
size_type max_size() const;
|
||||
template <class T, class... Args> void construct(T* p, Args&& args);
|
||||
template <class T1, class T2, class... Args1, class... Args2>
|
||||
void construct(pair<T1, T2>* p, piecewise_construct t, tuple<Args1...> x,
|
||||
tuple<Args2...> y);
|
||||
template <class T1, class T2>
|
||||
void construct(pair<T1, T2>* p);
|
||||
template <class T1, class T2, class U, class V>
|
||||
void construct(pair<T1, T2>* p, U&& x, V&& y);
|
||||
template <class T1, class T2, class U, class V>
|
||||
void construct(pair<T1, T2>* p, const pair<U, V>& x);
|
||||
template <class T1, class T2, class U, class V>
|
||||
void construct(pair<T1, T2>* p, pair<U, V>&& x);
|
||||
template <class T> void destroy(T* p);
|
||||
|
||||
template <class T> void destroy(T* p) noexcept;
|
||||
|
||||
scoped_allocator_adaptor select_on_container_copy_construction() const noexcept;
|
||||
};
|
||||
|
||||
template <class OuterA1, class OuterA2, class... InnerAllocs>
|
||||
bool
|
||||
operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
|
||||
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
|
||||
|
||||
template <class OuterA1, class OuterA2, class... InnerAllocs>
|
||||
bool
|
||||
operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
|
||||
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <memory>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
|
||||
|
||||
// scoped_allocator_adaptor
|
||||
|
||||
template <class ..._Allocs>
|
||||
class scoped_allocator_adaptor;
|
||||
|
||||
template <class ..._Allocs> struct __get_poc_copy_assignment;
|
||||
|
||||
template <class _A0>
|
||||
struct __get_poc_copy_assignment<_A0>
|
||||
{
|
||||
static const bool value = allocator_traits<_A0>::
|
||||
propagate_on_container_copy_assignment::value;
|
||||
};
|
||||
|
||||
template <class _A0, class ..._Allocs>
|
||||
struct __get_poc_copy_assignment<_A0, _Allocs...>
|
||||
{
|
||||
static const bool value =
|
||||
allocator_traits<_A0>::propagate_on_container_copy_assignment::value ||
|
||||
__get_poc_copy_assignment<_Allocs...>::value;
|
||||
};
|
||||
|
||||
template <class ..._Allocs> struct __get_poc_move_assignment;
|
||||
|
||||
template <class _A0>
|
||||
struct __get_poc_move_assignment<_A0>
|
||||
{
|
||||
static const bool value = allocator_traits<_A0>::
|
||||
propagate_on_container_move_assignment::value;
|
||||
};
|
||||
|
||||
template <class _A0, class ..._Allocs>
|
||||
struct __get_poc_move_assignment<_A0, _Allocs...>
|
||||
{
|
||||
static const bool value =
|
||||
allocator_traits<_A0>::propagate_on_container_move_assignment::value ||
|
||||
__get_poc_move_assignment<_Allocs...>::value;
|
||||
};
|
||||
|
||||
template <class ..._Allocs> struct __get_poc_swap;
|
||||
|
||||
template <class _A0>
|
||||
struct __get_poc_swap<_A0>
|
||||
{
|
||||
static const bool value = allocator_traits<_A0>::
|
||||
propagate_on_container_swap::value;
|
||||
};
|
||||
|
||||
template <class _A0, class ..._Allocs>
|
||||
struct __get_poc_swap<_A0, _Allocs...>
|
||||
{
|
||||
static const bool value =
|
||||
allocator_traits<_A0>::propagate_on_container_swap::value ||
|
||||
__get_poc_swap<_Allocs...>::value;
|
||||
};
|
||||
|
||||
template <class ..._Allocs>
|
||||
class __scoped_allocator_storage;
|
||||
|
||||
template <class _OuterAlloc, class... _InnerAllocs>
|
||||
class __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
|
||||
: public _OuterAlloc
|
||||
{
|
||||
typedef _OuterAlloc outer_allocator_type;
|
||||
protected:
|
||||
typedef scoped_allocator_adaptor<_InnerAllocs...> inner_allocator_type;
|
||||
|
||||
private:
|
||||
inner_allocator_type __inner_;
|
||||
|
||||
protected:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage() _NOEXCEPT {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(_OuterA2&& __outerAlloc,
|
||||
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)),
|
||||
__inner_(__innerAllocs...) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, const _OuterA2&>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
|
||||
: outer_allocator_type(__other.outer_allocator()),
|
||||
__inner_(__other.inner_allocator()) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::move(__other.outer_allocator())),
|
||||
__inner_(_VSTD::move(__other.inner_allocator())) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(_OuterA2&& __o,
|
||||
const inner_allocator_type& __i) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::forward<_OuterA2>(__o)),
|
||||
__inner_(__i)
|
||||
{
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inner_allocator_type& inner_allocator() _NOEXCEPT {return __inner_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const inner_allocator_type& inner_allocator() const _NOEXCEPT {return __inner_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
outer_allocator_type& outer_allocator() _NOEXCEPT
|
||||
{return static_cast<outer_allocator_type&>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const outer_allocator_type& outer_allocator() const _NOEXCEPT
|
||||
{return static_cast<const outer_allocator_type&>(*this);}
|
||||
|
||||
scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
select_on_container_copy_construction() const _NOEXCEPT
|
||||
{
|
||||
return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
|
||||
(
|
||||
allocator_traits<outer_allocator_type>::
|
||||
select_on_container_copy_construction(outer_allocator()),
|
||||
allocator_traits<inner_allocator_type>::
|
||||
select_on_container_copy_construction(inner_allocator())
|
||||
);
|
||||
}
|
||||
|
||||
template <class...> friend class __scoped_allocator_storage;
|
||||
};
|
||||
|
||||
template <class _OuterAlloc>
|
||||
class __scoped_allocator_storage<_OuterAlloc>
|
||||
: public _OuterAlloc
|
||||
{
|
||||
typedef _OuterAlloc outer_allocator_type;
|
||||
protected:
|
||||
typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage() _NOEXCEPT {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(_OuterA2&& __outerAlloc) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, const _OuterA2&>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
|
||||
: outer_allocator_type(__other.outer_allocator()) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
__scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::move(__other.outer_allocator())) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inner_allocator_type& inner_allocator() _NOEXCEPT
|
||||
{return static_cast<inner_allocator_type&>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const inner_allocator_type& inner_allocator() const _NOEXCEPT
|
||||
{return static_cast<const inner_allocator_type&>(*this);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
outer_allocator_type& outer_allocator() _NOEXCEPT
|
||||
{return static_cast<outer_allocator_type&>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const outer_allocator_type& outer_allocator() const _NOEXCEPT
|
||||
{return static_cast<const outer_allocator_type&>(*this);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor<outer_allocator_type>
|
||||
select_on_container_copy_construction() const _NOEXCEPT
|
||||
{return scoped_allocator_adaptor<outer_allocator_type>(
|
||||
allocator_traits<outer_allocator_type>::
|
||||
select_on_container_copy_construction(outer_allocator())
|
||||
);}
|
||||
|
||||
__scoped_allocator_storage(const outer_allocator_type& __o,
|
||||
const inner_allocator_type& __i) _NOEXCEPT;
|
||||
|
||||
template <class...> friend class __scoped_allocator_storage;
|
||||
};
|
||||
|
||||
// __outermost
|
||||
|
||||
template <class _Alloc>
|
||||
decltype(declval<_Alloc>().outer_allocator(), true_type())
|
||||
__has_outer_allocator_test(_Alloc&& __a);
|
||||
|
||||
template <class _Alloc>
|
||||
false_type
|
||||
__has_outer_allocator_test(const volatile _Alloc& __a);
|
||||
|
||||
template <class _Alloc>
|
||||
struct __has_outer_allocator
|
||||
: public common_type
|
||||
<
|
||||
decltype(__has_outer_allocator_test(declval<_Alloc&>()))
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Alloc, bool = __has_outer_allocator<_Alloc>::value>
|
||||
struct __outermost
|
||||
{
|
||||
typedef _Alloc type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
type& operator()(type& __a) const _NOEXCEPT {return __a;}
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
struct __outermost<_Alloc, true>
|
||||
{
|
||||
typedef typename remove_reference
|
||||
<
|
||||
decltype(_VSTD::declval<_Alloc>().outer_allocator())
|
||||
>::type _OuterAlloc;
|
||||
typedef typename __outermost<_OuterAlloc>::type type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
type& operator()(_Alloc& __a) const _NOEXCEPT
|
||||
{return __outermost<_OuterAlloc>()(__a.outer_allocator());}
|
||||
};
|
||||
|
||||
template <class _OuterAlloc, class... _InnerAllocs>
|
||||
class _LIBCPP_TYPE_VIS_ONLY scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
|
||||
: public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
|
||||
{
|
||||
typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
|
||||
typedef allocator_traits<_OuterAlloc> _OuterTraits;
|
||||
public:
|
||||
typedef _OuterAlloc outer_allocator_type;
|
||||
typedef typename base::inner_allocator_type inner_allocator_type;
|
||||
typedef typename _OuterTraits::size_type size_type;
|
||||
typedef typename _OuterTraits::difference_type difference_type;
|
||||
typedef typename _OuterTraits::pointer pointer;
|
||||
typedef typename _OuterTraits::const_pointer const_pointer;
|
||||
typedef typename _OuterTraits::void_pointer void_pointer;
|
||||
typedef typename _OuterTraits::const_void_pointer const_void_pointer;
|
||||
|
||||
typedef integral_constant
|
||||
<
|
||||
bool,
|
||||
__get_poc_copy_assignment<outer_allocator_type,
|
||||
_InnerAllocs...>::value
|
||||
> propagate_on_container_copy_assignment;
|
||||
typedef integral_constant
|
||||
<
|
||||
bool,
|
||||
__get_poc_move_assignment<outer_allocator_type,
|
||||
_InnerAllocs...>::value
|
||||
> propagate_on_container_move_assignment;
|
||||
typedef integral_constant
|
||||
<
|
||||
bool,
|
||||
__get_poc_swap<outer_allocator_type, _InnerAllocs...>::value
|
||||
> propagate_on_container_swap;
|
||||
|
||||
template <class _Tp>
|
||||
struct rebind
|
||||
{
|
||||
typedef scoped_allocator_adaptor
|
||||
<
|
||||
typename _OuterTraits::template rebind_alloc<_Tp>, _InnerAllocs...
|
||||
> other;
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor() _NOEXCEPT {}
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(_OuterA2&& __outerAlloc,
|
||||
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
|
||||
: base(_VSTD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
|
||||
// scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, const _OuterA2&>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(
|
||||
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
|
||||
: base(__other) {}
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(
|
||||
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
|
||||
: base(_VSTD::move(__other)) {}
|
||||
|
||||
// ~scoped_allocator_adaptor() = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inner_allocator_type& inner_allocator() _NOEXCEPT
|
||||
{return base::inner_allocator();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const inner_allocator_type& inner_allocator() const _NOEXCEPT
|
||||
{return base::inner_allocator();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
outer_allocator_type& outer_allocator() _NOEXCEPT
|
||||
{return base::outer_allocator();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const outer_allocator_type& outer_allocator() const _NOEXCEPT
|
||||
{return base::outer_allocator();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer allocate(size_type __n)
|
||||
{return allocator_traits<outer_allocator_type>::
|
||||
allocate(outer_allocator(), __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer allocate(size_type __n, const_void_pointer __hint)
|
||||
{return allocator_traits<outer_allocator_type>::
|
||||
allocate(outer_allocator(), __n, __hint);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void deallocate(pointer __p, size_type __n) _NOEXCEPT
|
||||
{allocator_traits<outer_allocator_type>::
|
||||
deallocate(outer_allocator(), __p, __n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const
|
||||
{return allocator_traits<outer_allocator_type>::max_size(outer_allocator());}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void construct(_Tp* __p, _Args&& ...__args)
|
||||
{__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(),
|
||||
__p, _VSTD::forward<_Args>(__args)...);}
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void destroy(_Tp* __p)
|
||||
{
|
||||
typedef __outermost<outer_allocator_type> _OM;
|
||||
allocator_traits<typename _OM::type>::
|
||||
destroy(_OM()(outer_allocator()), __p);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT
|
||||
{return base::select_on_container_copy_construction();}
|
||||
|
||||
private:
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(_OuterA2&& __o,
|
||||
const inner_allocator_type& __i) _NOEXCEPT
|
||||
: base(_VSTD::forward<_OuterA2>(__o), __i) {}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __construct(integral_constant<int, 0>, _Tp* __p, _Args&& ...__args)
|
||||
{
|
||||
typedef __outermost<outer_allocator_type> _OM;
|
||||
allocator_traits<typename _OM::type>::construct
|
||||
(
|
||||
_OM()(outer_allocator()),
|
||||
__p,
|
||||
_VSTD::forward<_Args>(__args)...
|
||||
);
|
||||
}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __construct(integral_constant<int, 1>, _Tp* __p, _Args&& ...__args)
|
||||
{
|
||||
typedef __outermost<outer_allocator_type> _OM;
|
||||
allocator_traits<typename _OM::type>::construct
|
||||
(
|
||||
_OM()(outer_allocator()),
|
||||
__p,
|
||||
allocator_arg,
|
||||
inner_allocator(),
|
||||
_VSTD::forward<_Args>(__args)...
|
||||
);
|
||||
}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __construct(integral_constant<int, 2>, _Tp* __p, _Args&& ...__args)
|
||||
{
|
||||
typedef __outermost<outer_allocator_type> _OM;
|
||||
allocator_traits<typename _OM::type>::construct
|
||||
(
|
||||
_OM()(outer_allocator()),
|
||||
__p,
|
||||
_VSTD::forward<_Args>(__args)...,
|
||||
inner_allocator()
|
||||
);
|
||||
}
|
||||
|
||||
template <class...> friend class __scoped_allocator_storage;
|
||||
};
|
||||
|
||||
template <class _OuterA1, class _OuterA2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
|
||||
const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT
|
||||
{
|
||||
return __a.outer_allocator() == __b.outer_allocator();
|
||||
}
|
||||
|
||||
template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
|
||||
const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT
|
||||
{
|
||||
return __a.outer_allocator() == __b.outer_allocator() &&
|
||||
__a.inner_allocator() == __b.inner_allocator();
|
||||
}
|
||||
|
||||
template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
|
||||
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT
|
||||
{
|
||||
return !(__a == __b);
|
||||
}
|
||||
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_SCOPED_ALLOCATOR
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue