Compare commits

..

53 Commits

Author SHA1 Message Date
Nick Kledzik
e06f0c4111 more Apple build system tweaks
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/tags/libcpp-23.1@132818 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-09 23:30:26 +00:00
Nick Kledzik
2bdb250fe8 libcpp-23.1
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/tags/libcpp-23.1@132810 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-09 22:18:19 +00:00
Nick Kledzik
b7842d1bad libcpp-23
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/tags/libcpp-23@131997 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-24 20:29:16 +00:00
Nick Kledzik
8feadca3fa support another Apple build environment
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131996 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-24 20:27:31 +00:00
Nick Kledzik
1122fec973 on Darwin re-export C++0x type infos
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131995 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-24 20:26:04 +00:00
Howard Hinnant
20542c0b94 http://llvm.org/bugs/show_bug.cgi?id=9399 fixed by Ryuta Suzuki
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131961 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-24 12:54:00 +00:00
Howard Hinnant
ef54251a84 Fix const correctness bug in bind involving reference_wrapper found by Jonathan Sauer
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-22 15:07:43 +00:00
Howard Hinnant
e003ce4899 __invokable and __invoke_of now check for incomplete types and issue a compile-time diagnostic if they are used with incomplete types for anything except a return type. Note that both arguments *and* parameters are checked for completeness.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131818 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-22 00:09:02 +00:00
Howard Hinnant
bd89e4b0dd This is a simplified (and superior) implementation of __invoke, __invokable and __invoke_of. It is superior in that __invoke now handles reference qualified member functions whereas the previous implementation did not. And it simply has less infrastructure in its implementation. I'm still learning how to program in C++11 (and probably will be for a long time). This change does not impact the behavior we're seeing in http://llvm.org/bugs/show_bug.cgi?id=9975
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131761 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-20 22:02:53 +00:00
Howard Hinnant
0148a838d0 Simplied bind using __invoke. In the process, found and fixed a couple of bugs. C++11 only.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131667 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-19 19:41:47 +00:00
Howard Hinnant
57cff290a4 I had a giant misunderstanding of what 'synchronizes with' meant in [futures.async]/p5. This invalidated the current design of async in <future>. This is a new design, based on my new understanding, which has been confirmed on the lwg mailing list. The summary is that ~future() (and ~shared_future()) will block when they are created from within async, and the thread hasn't finished yet. As part of this work I created two new type traits: __invokable<F, Args...>::value and __invoke_of<F, Args...>::type. These are what result_of<F(Args...)> wanted to be when it grew up, but never will be. __invoke_of is carefully crafted so that it can serve as its own enable_if (type doesn't exist if the signature isn't invokable). All of this work is C++11 only.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131639 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-19 15:05:04 +00:00
Howard Hinnant
3dd965bdf9 This commit was accidental. Reverting.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131514 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-18 00:47:00 +00:00
Howard Hinnant
932209b344 A bunch of future tests got invalidated with the latest updates to thread. Fixed the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131509 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 23:32:48 +00:00
Howard Hinnant
fead2e2de9 Fix ambiguity in operator== of scoped_allocator_adaptor.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131485 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 20:41:18 +00:00
Howard Hinnant
6b9826b2dc Fixed bug in recently introduced bind move constructor
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131484 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 20:27:51 +00:00
Howard Hinnant
6cbf9f9b25 Fix and beef up test bug for move_if_noexcept
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131483 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 20:10:42 +00:00
Howard Hinnant
97ecd64913 Clean up a bunch of warnings in the tests, 3 of which actually turned out to be test bugs.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131479 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 19:12:55 +00:00
Howard Hinnant
ad935d583d Brought call_once variadic call up to current spec, which allows move-only functors and move-only arguments, but disallows functors with non-const lvalue reference parameters.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131414 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 19:05:11 +00:00
Howard Hinnant
656bdc3667 Brought thread variadic constructor up to current spec, which allows move-only functors and move-only arguments, but disallows functors with non-const lvalue reference parameters.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131413 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 18:40:35 +00:00
Howard Hinnant
ed22f562e5 Supply missing std::qualifier to call.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131410 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 16:20:59 +00:00
Howard Hinnant
941138f8c9 Spit 5th bullet __invoke into function pointers and everything else because result_of doesn't deal with function pointers.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131409 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 16:20:21 +00:00
Howard Hinnant
496934a803 Supply missing move ctor in __bind_r, though this one will eventually be defaulted
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131408 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 16:19:01 +00:00
Howard Hinnant
37c53b6221 Redesign of result_of to handle reference-qualified member functions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131407 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 16:17:21 +00:00
Howard Hinnant
5ec7f5a518 Fix type-o found by Justin Hibbits
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131348 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 18:20:45 +00:00
Howard Hinnant
e06b9965ad Fix type-o found by Justin Hibbits
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131346 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 17:24:22 +00:00
Howard Hinnant
f6cc833ae7 Warning suppression in test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131344 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 15:38:08 +00:00
Howard Hinnant
783b810cae Warning suppression in test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131343 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 15:36:25 +00:00
Howard Hinnant
a5a0ba86c8 Warning suppression in test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131341 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 14:53:12 +00:00
Howard Hinnant
e80c36e27b Correction to hexfloat hack.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131340 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 14:33:56 +00:00
Howard Hinnant
d515df2a50 Fix test bug.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131328 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 00:07:53 +00:00
Howard Hinnant
f1151efcb1 Suppress some warings in the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131327 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 00:04:05 +00:00
Howard Hinnant
2d01bf0665 Suppress some warings in the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131326 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 23:59:50 +00:00
Howard Hinnant
0a111118a6 http://llvm.org/bugs/show_bug.cgi?id=9854. Also created an emulated hexfloat literal for use in some of the tests. <sigh> And cleaned up some harmless but irritating warnings in the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131318 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 21:52:40 +00:00
Howard Hinnant
11a58a68e1 http://llvm.org/bugs/show_bug.cgi?id=9118
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131296 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 17:16:06 +00:00
Howard Hinnant
6063ec176d A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131291 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 14:08:16 +00:00
Howard Hinnant
0cfa1f7cbd CWG 1170 has been fixed for destructors
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131290 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 13:39:08 +00:00
Sean Hunt
9e604b442c __is_trivially_copyable now supplied by clang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131271 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 00:32:09 +00:00
Howard Hinnant
d5c2f255c5 Corrected misspelling
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131265 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 00:03:08 +00:00
Howard Hinnant
7bbce3c0e7 Updated to reflect updated use of existing clang support
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131264 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 00:01:01 +00:00
Howard Hinnant
6b41c6047b Corrected some bugs in both memory and the tests. Preparing for being able to turn on support for alias templates.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131199 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-11 20:21:19 +00:00
Howard Hinnant
5d37fb32d2 Redid nothrow traits in terms of non-nothrow traits when noexcept is available
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131198 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-11 20:19:40 +00:00
Howard Hinnant
3666695f0d Updated type_traits and the type_traits design doc with recent work done in clang.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131090 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-09 19:21:17 +00:00
Nick Kledzik
d982028b92 change RC_BUILDIT to RC_XBS for detecting Apple build environment
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130970 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-06 01:13:20 +00:00
Nick Kledzik
ffadfd4c1e add support for setjmp/longjmp based exceptions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130938 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-05 18:45:41 +00:00
Nick Kledzik
c6e08d6c44 <rdar://problem/9014045> more support for Apple internal build environments
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130872 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-04 21:50:46 +00:00
Howard Hinnant
469d419a17 Correction to set of overloaded pair constructors for C++0x
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130521 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 18:10:55 +00:00
Douglas Gregor
7ac6af7027 Qualify calls to std::next(), to avoid conflicts with
libraries/applications that define their own 'next' template.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130511 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 16:20:26 +00:00
Howard Hinnant
e14ea5835e http://llvm.org/bugs/show_bug.cgi?id=9765
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129910 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-21 14:29:59 +00:00
Howard Hinnant
75f7695c62 Think-o in poisson_distribution at mean == 10
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129520 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 15:59:22 +00:00
Howard Hinnant
ef3b2e2e34 Fix bug in Sseq constraints found by Seth Cantrell
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129285 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 18:22:12 +00:00
Howard Hinnant
9dbeff919b http://llvm.org/bugs/show_bug.cgi?id=9672
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129266 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 02:18:41 +00:00
Howard Hinnant
8c1aa2c24d Changes to cerrno to protect against the case the ELAST is not defined.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129255 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-10 19:46:55 +00:00
Howard Hinnant
506b36487c time_get was missing the %F specifier. This change impacts the binary.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129251 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-10 17:54:14 +00:00
111 changed files with 2173 additions and 942 deletions

View File

@@ -5,10 +5,10 @@
#===============================================================================
project(libcxx CXX C)
cmake_minimum_required(VERSION 2.6.4)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME libcxx)
set(PACKAGE_VERSION lll)
set(PACKAGE_VERSION trunk-svn)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")

View File

@@ -9,6 +9,12 @@ OBJROOT=.
SYMROOT=.
export TRIPLE=-apple-
ifeq (,$(RC_INDIGO))
INSTALL_PREFIX=""
else
INSTALL_PREFIX="$(SDKROOT)"
endif
installsrc:: $(SRCROOT)
ditto $(SRCDIRS)/include $(SRCROOT)/include
@@ -20,19 +26,19 @@ clean::
installhdrs::
mkdir -p $(DSTROOT)/usr/include/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/usr/include/c++/v1/
chown -R root:wheel $(DSTROOT)/usr/include
chmod 755 $(DSTROOT)/usr/include/c++/v1
chmod 644 $(DSTROOT)/usr/include/c++/v1/*
chmod 755 $(DSTROOT)/usr/include/c++/v1/ext
chmod 644 $(DSTROOT)/usr/include/c++/v1/ext/*
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/include
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/*
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext/*
install:: installhdrs $(DESTDIR)
cd lib && ./buildit
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM $(SYMROOT)/usr/lib/libc++.1.dylib
mkdir -p $(DSTROOT)/usr/lib
strip -S -o $(DSTROOT)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd $(DSTROOT)/usr/lib && ln -s libc++.1.dylib libc++.dylib
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib
strip -S -o $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib && ln -s libc++.1.dylib libc++.dylib

View File

@@ -25,6 +25,7 @@ check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
# Check C++0x features

View File

@@ -47,6 +47,11 @@
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
#endif // __FreeBSD__
#ifdef _WIN32
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
#endif // _WIN32
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -86,8 +91,9 @@
#if defined(__clang__)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
//#if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
//#endif
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#ifdef __linux__
@@ -138,6 +144,7 @@ typedef __char32_t char32_t;
#if !(__has_feature(cxx_auto_type))
#define _LIBCPP_HAS_NO_AUTO_TYPE
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#endif
#if !(__has_feature(cxx_variadic_templates))
@@ -162,6 +169,14 @@ namespace std {
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
#if (__has_feature(cxx_noexcept))
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
#endif
// end defined(__clang__)
#elif defined(__GNUC__)
@@ -173,6 +188,9 @@ namespace std {
#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

View File

@@ -281,161 +281,55 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
// __invoke
// first bullet
// bullets 1 and 2
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
template <class _F, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
auto
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype((_STD::forward<_A0>(__a0).*__f)(_STD::forward<_Args>(__args)...))
{
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
return (_STD::forward<_A0>(__a0).*__f)(_STD::forward<_Args>(__args)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
template <class _F, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
auto
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype(((*_STD::forward<_A0>(__a0)).*__f)(_STD::forward<_Args>(__args)...))
{
return (_STD::forward<const _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
return ((*_STD::forward<_A0>(__a0)).*__f)(_STD::forward<_Args>(__args)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
// bullets 3 and 4
template <class _F, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
auto
__invoke(_F&& __f, _A0&& __a0)
-> decltype(_STD::forward<_A0>(__a0).*__f)
{
return (_STD::forward<volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
return _STD::forward<_A0>(__a0).*__f;
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
template <class _F, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
auto
__invoke(_F&& __f, _A0&& __a0)
-> decltype((*_STD::forward<_A0>(__a0)).*__f)
{
return (_STD::forward<const volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
return (*_STD::forward<_A0>(__a0)).*__f;
}
// second bullet
// bullet 5
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
template <class _F, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
auto
__invoke(_F&& __f, _Args&& ...__args)
-> decltype(_STD::forward<_F>(__f)(_STD::forward<_Args>(__args)...))
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
// third bullet
template <class _R, class _T, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_base_of<_T, typename remove_reference<_T1>::type>::value,
typename __apply_cv<_T1, _R>::type&&
>::type
__invoke(_R _T::* __f, _T1&& __t1)
{
return _STD::forward<_T1>(__t1).*__f;
}
// forth bullet
template <class _T1, class _R, bool>
struct __4th_helper
{
};
template <class _T1, class _R>
struct __4th_helper<_T1, _R, true>
{
typedef typename __apply_cv<decltype(*_STD::declval<_T1>()), _R>::type type;
};
template <class _R, class _T, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename __4th_helper<_T1, _R,
!is_base_of<_T,
typename remove_reference<_T1>::type
>::value
>::type&&
__invoke(_R _T::* __f, _T1&& __t1)
{
return (*_STD::forward<_T1>(__t1)).*__f;
}
// fifth bullet
template <class _F, class ..._T>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F(_T...)>::type
__invoke(_F&& __f, _T&& ...__t)
{
return _STD::forward<_F>(__f)(_STD::forward<_T>(__t)...);
return _STD::forward<_F>(__f)(_STD::forward<_Args>(__args)...);
}
template <class _Tp, class ..._Args>
@@ -468,7 +362,7 @@ public:
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type&, _ArgTypes...>::type
typename __invoke_of<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{
return __invoke(get(), _STD::forward<_ArgTypes>(__args)...);

View File

@@ -1609,7 +1609,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
const_iterator __next = _STD::next(__hint);
if (__next == end() || value_comp()(__v, *__next))
{
// *__hint < __v < *next(__hint)
// *__hint < __v < *_STD::next(__hint)
if (__hint.__ptr_->__right_ == nullptr)
{
__parent = const_cast<__node_pointer&>(__hint.__ptr_);

View File

@@ -30,25 +30,43 @@ Macros:
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
#ifdef ELAST
const int __elast1 = ELAST+1;
const int __elast2 = ELAST+2;
#undef ELAST
#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)

View File

@@ -303,8 +303,340 @@ long double truncl(long double x);
#pragma GCC system_header
// signbit
#ifdef signbit
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_signbit(_A1 __x)
{
return signbit(__x);
}
#undef signbit
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
signbit(_A1 __x)
{
return __libcpp_signbit(__x);
}
#endif // signbit
// fpclassify
#ifdef fpclassify
template <class _A1>
_LIBCPP_ALWAYS_INLINE
int
__libcpp_fpclassify(_A1 __x)
{
return fpclassify(__x);
}
#undef fpclassify
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
fpclassify(_A1 __x)
{
return __libcpp_fpclassify(__x);
}
#endif // fpclassify
// isfinite
#ifdef isfinite
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isfinite(_A1 __x)
{
return isfinite(__x);
}
#undef isfinite
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
isfinite(_A1 __x)
{
return __libcpp_isfinite(__x);
}
#endif // isfinite
// isinf
#ifdef isinf
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isinf(_A1 __x)
{
return isinf(__x);
}
#undef isinf
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
isinf(_A1 __x)
{
return __libcpp_isinf(__x);
}
#endif // isinf
// isnan
#ifdef isnan
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isnan(_A1 __x)
{
return isnan(__x);
}
#undef isnan
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
isnan(_A1 __x)
{
return __libcpp_isnan(__x);
}
#endif // isnan
// isnormal
#ifdef isnormal
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isnormal(_A1 __x)
{
return isnormal(__x);
}
#undef isnormal
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
isnormal(_A1 __x)
{
return __libcpp_isnormal(__x);
}
#endif // isnormal
// isgreater
#ifdef isgreater
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isgreater(_A1 __x, _A2 __y)
{
return isgreater(__x, __y);
}
#undef isgreater
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
std::is_floating_point<_A1>::value &&
std::is_floating_point<_A2>::value,
bool
>::type
isgreater(_A1 __x, _A2 __y)
{
return __libcpp_isgreater(__x, __y);
}
#endif // isgreater
// isgreaterequal
#ifdef isgreaterequal
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isgreaterequal(_A1 __x, _A2 __y)
{
return isgreaterequal(__x, __y);
}
#undef isgreaterequal
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
std::is_floating_point<_A1>::value &&
std::is_floating_point<_A2>::value,
bool
>::type
isgreaterequal(_A1 __x, _A2 __y)
{
return __libcpp_isgreaterequal(__x, __y);
}
#endif // isgreaterequal
// isless
#ifdef isless
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isless(_A1 __x, _A2 __y)
{
return isless(__x, __y);
}
#undef isless
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
std::is_floating_point<_A1>::value &&
std::is_floating_point<_A2>::value,
bool
>::type
isless(_A1 __x, _A2 __y)
{
return __libcpp_isless(__x, __y);
}
#endif // isless
// islessequal
#ifdef islessequal
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_islessequal(_A1 __x, _A2 __y)
{
return islessequal(__x, __y);
}
#undef islessequal
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
std::is_floating_point<_A1>::value &&
std::is_floating_point<_A2>::value,
bool
>::type
islessequal(_A1 __x, _A2 __y)
{
return __libcpp_islessequal(__x, __y);
}
#endif // islessequal
// islessgreater
#ifdef islessgreater
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_islessgreater(_A1 __x, _A2 __y)
{
return islessgreater(__x, __y);
}
#undef islessgreater
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
std::is_floating_point<_A1>::value &&
std::is_floating_point<_A2>::value,
bool
>::type
islessgreater(_A1 __x, _A2 __y)
{
return __libcpp_islessgreater(__x, __y);
}
#endif // islessgreater
// isunordered
#ifdef isunordered
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isunordered(_A1 __x, _A2 __y)
{
return isunordered(__x, __y);
}
#undef isunordered
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
std::is_floating_point<_A1>::value &&
std::is_floating_point<_A2>::value,
bool
>::type
isunordered(_A1 __x, _A2 __y)
{
return __libcpp_isunordered(__x, __y);
}
#endif // isunordered
_LIBCPP_BEGIN_NAMESPACE_STD
using ::signbit;
using ::fpclassify;
using ::isfinite;
using ::isinf;
using ::isnan;
using ::isnormal;
using ::isgreater;
using ::isgreaterequal;
using ::isless;
using ::islessequal;
using ::islessgreater;
using ::isunordered;
using ::isunordered;
using ::float_t;
using ::double_t;
@@ -629,348 +961,6 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
tanh(_A1 __x) {return tanh((double)__x);}
// signbit
#ifndef signbit
#error Implementation error: signbit not defined
#else
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_signbit(_A1 __x)
{
return signbit(__x);
}
#undef signbit
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
signbit(_A1 __x)
{
return __libcpp_signbit(__x);
}
#endif // signbit
// fpclassify
#ifndef fpclassify
#error Implementation error: fpclassify not defined
#else
template <class _A1>
_LIBCPP_ALWAYS_INLINE
int
__libcpp_fpclassify(_A1 __x)
{
return fpclassify(__x);
}
#undef fpclassify
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, int>::type
fpclassify(_A1 __x)
{
return __libcpp_fpclassify(__x);
}
#endif // fpclassify
// isfinite
#ifndef isfinite
#error Implementation error: isfinite not defined
#else
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isfinite(_A1 __x)
{
return isfinite(__x);
}
#undef isfinite
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
isfinite(_A1 __x)
{
return __libcpp_isfinite(__x);
}
#endif // isfinite
// isinf
#ifndef isinf
#error Implementation error: isinf not defined
#else
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isinf(_A1 __x)
{
return isinf(__x);
}
#undef isinf
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
isinf(_A1 __x)
{
return __libcpp_isinf(__x);
}
#endif // isinf
// isnan
#ifndef isnan
#error Implementation error: isnan not defined
#else
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isnan(_A1 __x)
{
return isnan(__x);
}
#undef isnan
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
isnan(_A1 __x)
{
return __libcpp_isnan(__x);
}
#endif // isnan
// isnormal
#ifndef isnormal
#error Implementation error: isnormal not defined
#else
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isnormal(_A1 __x)
{
return isnormal(__x);
}
#undef isnormal
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
isnormal(_A1 __x)
{
return __libcpp_isnormal(__x);
}
#endif // isnormal
// isgreater
#ifndef isgreater
#error Implementation error: isgreater not defined
#else
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isgreater(_A1 __x, _A2 __y)
{
return isgreater(__x, __y);
}
#undef isgreater
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
is_floating_point<_A2>::value,
bool
>::type
isgreater(_A1 __x, _A2 __y)
{
return __libcpp_isgreater(__x, __y);
}
#endif // isgreater
// isgreaterequal
#ifndef isgreaterequal
#error Implementation error: isgreaterequal not defined
#else
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isgreaterequal(_A1 __x, _A2 __y)
{
return isgreaterequal(__x, __y);
}
#undef isgreaterequal
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
is_floating_point<_A2>::value,
bool
>::type
isgreaterequal(_A1 __x, _A2 __y)
{
return __libcpp_isgreaterequal(__x, __y);
}
#endif // isgreaterequal
// isless
#ifndef isless
#error Implementation error: isless not defined
#else
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isless(_A1 __x, _A2 __y)
{
return isless(__x, __y);
}
#undef isless
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
is_floating_point<_A2>::value,
bool
>::type
isless(_A1 __x, _A2 __y)
{
return __libcpp_isless(__x, __y);
}
#endif // isless
// islessequal
#ifndef islessequal
#error Implementation error: islessequal not defined
#else
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_islessequal(_A1 __x, _A2 __y)
{
return islessequal(__x, __y);
}
#undef islessequal
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
is_floating_point<_A2>::value,
bool
>::type
islessequal(_A1 __x, _A2 __y)
{
return __libcpp_islessequal(__x, __y);
}
#endif // islessequal
// islessgreater
#ifndef islessgreater
#error Implementation error: islessgreater not defined
#else
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_islessgreater(_A1 __x, _A2 __y)
{
return islessgreater(__x, __y);
}
#undef islessgreater
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
is_floating_point<_A2>::value,
bool
>::type
islessgreater(_A1 __x, _A2 __y)
{
return __libcpp_islessgreater(__x, __y);
}
#endif // islessgreater
// isunordered
#ifndef isunordered
#error Implementation error: isunordered not defined
#else
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isunordered(_A1 __x, _A2 __y)
{
return isunordered(__x, __y);
}
#undef isunordered
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
is_floating_point<_A2>::value,
bool
>::type
isunordered(_A1 __x, _A2 __y)
{
return __libcpp_isunordered(__x, __y);
}
#endif // isunordered
// acosh
using ::acosh;

View File

@@ -1787,7 +1787,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = __move_and_check(next(__b), __b + __pos, __b, __vt);
__b = __move_and_check(_STD::next(__b), __b + __pos, __b, __vt);
*__b = *__vt;
}
}
@@ -1847,7 +1847,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = _STD::move(next(__b), __b + __pos, __b);
__b = _STD::move(_STD::next(__b), __b + __pos, __b);
*__b = _STD::move(__v);
}
}
@@ -1905,7 +1905,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = _STD::move(next(__b), __b + __pos, __b);
__b = _STD::move(_STD::next(__b), __b + __pos, __b);
*__b = value_type(_STD::forward<_Args>(__args)...);
}
}
@@ -2621,7 +2621,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
}
else
{ // erase from back
iterator __i = _STD::move(next(__p), __base::end(), __p);
iterator __i = _STD::move(_STD::next(__p), __base::end(), __p);
__alloc_traits::destroy(__a, _STD::addressof(*__i));
--__base::size();
if (__back_spare() >= 2 * __base::__block_size)

View File

@@ -1510,21 +1510,12 @@ __mu(reference_wrapper<_Tp> __t, _Uj&)
return __t.get();
}
template <bool _IsBindExpr, class _Ti, class ..._Uj>
struct __mu_return1 {};
template <class _Ti, class ..._Uj>
struct __mu_return1<true, _Ti, _Uj...>
{
typedef typename result_of<_Ti(_Uj...)>::type type;
};
template <class _Ti, class ..._Uj, size_t ..._Indx>
inline _LIBCPP_INLINE_VISIBILITY
typename __mu_return1<true, _Ti, _Uj...>::type
__mu_expand(_Ti& __ti, tuple<_Uj...>&& __uj, __tuple_indices<_Indx...>)
typename __invoke_of<_Ti&, _Uj...>::type
__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>)
{
return __ti(_STD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj))...);
return __ti(_STD::forward<_Uj>(get<_Indx>(__uj))...);
}
template <class _Ti, class ..._Uj>
@@ -1532,7 +1523,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_bind_expression<_Ti>::value,
typename __mu_return1<is_bind_expression<_Ti>::value, _Ti, _Uj...>::type
typename __invoke_of<_Ti&, _Uj...>::type
>::type
__mu(_Ti& __ti, tuple<_Uj...>& __uj)
{
@@ -1576,24 +1567,31 @@ __mu(_Ti& __ti, _Uj& __uj)
return __ti;
}
template <class _Ti, bool IsBindEx, bool IsPh, class _TupleUj>
template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh,
class _TupleUj>
struct ____mu_return;
template <class _Ti, class ..._Uj>
struct ____mu_return<_Ti, true, false, tuple<_Uj...> >
struct ____mu_return<_Ti, false, true, false, tuple<_Uj...> >
{
typedef typename result_of<_Ti(_Uj...)>::type type;
typedef typename __invoke_of<_Ti&, _Uj...>::type type;
};
template <class _Ti, class _TupleUj>
struct ____mu_return<_Ti, false, true, _TupleUj>
struct ____mu_return<_Ti, false, false, true, _TupleUj>
{
typedef typename tuple_element<is_placeholder<_Ti>::value - 1,
_TupleUj>::type&& type;
};
template <class _Ti, class _TupleUj>
struct ____mu_return<_Ti, false, false, _TupleUj>
struct ____mu_return<_Ti, true, false, false, _TupleUj>
{
typedef typename _Ti::type& type;
};
template <class _Ti, class _TupleUj>
struct ____mu_return<_Ti, false, false, false, _TupleUj>
{
typedef _Ti& type;
};
@@ -1601,25 +1599,20 @@ struct ____mu_return<_Ti, false, false, _TupleUj>
template <class _Ti, class _TupleUj>
struct __mu_return
: public ____mu_return<_Ti,
__is_reference_wrapper<_Ti>::value,
is_bind_expression<_Ti>::value,
0 < is_placeholder<_Ti>::value,
_TupleUj>
{
};
template <class _Ti, class _TupleUj>
struct __mu_return<reference_wrapper<_Ti>, _TupleUj>
{
typedef _Ti& type;
};
template <class _F, class _BoundArgs, class _TupleUj>
struct __bind_return;
template <class _F, class ..._BoundArgs, class _TupleUj>
struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __invoke_return
typedef typename __invoke_of
<
_F&,
typename __mu_return
@@ -1633,7 +1626,7 @@ struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj>
template <class _F, class ..._BoundArgs, class _TupleUj>
struct __bind_return<_F, const tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __invoke_return
typedef typename __invoke_of
<
_F&,
typename __mu_return
@@ -1655,10 +1648,12 @@ __apply_functor(_F& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
template<class _F, class ..._BoundArgs>
class __bind
: public __weak_result_type<_F>
: public __weak_result_type<typename decay<_F>::type>
{
_F __f_;
tuple<_BoundArgs...> __bound_args_;
typedef typename decay<_F>::type _Fd;
typedef tuple<typename decay<_BoundArgs>::type...> _Td;
_Fd __f_;
_Td __bound_args_;
typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
public:
@@ -1675,17 +1670,16 @@ public:
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
operator()(_Args&& ...__args)
{
// compiler bug workaround
return __apply_functor(__f_, __bound_args_, __indices(),
tuple<_Args&&...>(_STD::forward<_Args>(__args)...));
}
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
operator()(_Args&& ...__args) const
{
return __apply_functor(__f_, __bound_args_, __indices(),
@@ -1704,6 +1698,10 @@ class __bind_r
public:
typedef _R result_type;
_LIBCPP_INLINE_VISIBILITY
__bind_r(__bind_r&& __b)
: base(_STD::forward<base>(__b)) {}
template <class _G, class ..._BA>
_LIBCPP_INLINE_VISIBILITY
explicit __bind_r(_G&& __f, _BA&& ...__bound_args)
@@ -1732,19 +1730,19 @@ struct __is_bind_expression<__bind_r<_R, _F, _BoundArgs...> > : public true_type
template<class _F, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
__bind<typename decay<_F>::type, typename decay<_BoundArgs>::type...>
__bind<_F, _BoundArgs...>
bind(_F&& __f, _BoundArgs&&... __bound_args)
{
typedef __bind<typename decay<_F>::type, typename decay<_BoundArgs>::type...> type;
typedef __bind<_F, _BoundArgs...> type;
return type(_STD::forward<_F>(__f), _STD::forward<_BoundArgs>(__bound_args)...);
}
template<class _R, class _F, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
__bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...>
__bind_r<_R, _F, _BoundArgs...>
bind(_F&& __f, _BoundArgs&&... __bound_args)
{
typedef __bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...> type;
typedef __bind_r<_R, _F, _BoundArgs...> type;
return type(_STD::forward<_F>(__f), _STD::forward<_BoundArgs>(__bound_args)...);
}

View File

@@ -858,6 +858,115 @@ __deferred_assoc_state<void, _F>::__execute()
#endif // _LIBCPP_NO_EXCEPTIONS
}
template <class _R, class _F>
class __async_assoc_state
: public __assoc_state<_R>
{
typedef __assoc_state<_R> base;
_F __func_;
virtual void __on_zero_shared();
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
explicit __async_assoc_state(_F&& __f);
#endif
virtual void __execute();
};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _R, class _F>
inline _LIBCPP_INLINE_VISIBILITY
__async_assoc_state<_R, _F>::__async_assoc_state(_F&& __f)
: __func_(_STD::forward<_F>(__f))
{
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _R, class _F>
void
__async_assoc_state<_R, _F>::__execute()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
this->set_value(__func_());
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
this->set_exception(current_exception());
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
template <class _R, class _F>
void
__async_assoc_state<_R, _F>::__on_zero_shared()
{
this->wait();
base::__on_zero_shared();
}
template <class _F>
class __async_assoc_state<void, _F>
: public __assoc_sub_state
{
typedef __assoc_sub_state base;
_F __func_;
virtual void __on_zero_shared();
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
explicit __async_assoc_state(_F&& __f);
#endif
virtual void __execute();
};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _F>
inline _LIBCPP_INLINE_VISIBILITY
__async_assoc_state<void, _F>::__async_assoc_state(_F&& __f)
: __func_(_STD::forward<_F>(__f))
{
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _F>
void
__async_assoc_state<void, _F>::__execute()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
__func_();
this->set_value();
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
this->set_exception(current_exception());
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
template <class _F>
void
__async_assoc_state<void, _F>::__on_zero_shared()
{
this->wait();
base::__on_zero_shared();
}
template <class> class promise;
template <class> class shared_future;
template <class> class atomic_future;
@@ -874,6 +983,14 @@ __make_deferred_assoc_state(_F&& __f);
__make_deferred_assoc_state(_F __f);
#endif
template <class _R, class _F>
future<_R>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__make_async_assoc_state(_F&& __f);
#else
__make_async_assoc_state(_F __f);
#endif
template <class _R>
class _LIBCPP_VISIBLE future
{
@@ -885,11 +1002,16 @@ class _LIBCPP_VISIBLE future
template <class> friend class shared_future;
template <class> friend class atomic_future;
template <class _R1, class _F>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _R1, class _F>
friend future<_R1> __make_deferred_assoc_state(_F&& __f);
template <class _R1, class _F>
friend future<_R1> __make_async_assoc_state(_F&& __f);
#else
template <class _R1, class _F>
friend future<_R1> __make_deferred_assoc_state(_F __f);
template <class _R1, class _F>
friend future<_R1> __make_async_assoc_state(_F __f);
#endif
public:
@@ -983,11 +1105,16 @@ class _LIBCPP_VISIBLE future<_R&>
template <class> friend class shared_future;
template <class> friend class atomic_future;
template <class _R1, class _F>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _R1, class _F>
friend future<_R1> __make_deferred_assoc_state(_F&& __f);
template <class _R1, class _F>
friend future<_R1> __make_async_assoc_state(_F&& __f);
#else
template <class _R1, class _F>
friend future<_R1> __make_deferred_assoc_state(_F __f);
template <class _R1, class _F>
friend future<_R1> __make_async_assoc_state(_F __f);
#endif
public:
@@ -1076,11 +1203,16 @@ class _LIBCPP_VISIBLE future<void>
template <class> friend class shared_future;
template <class> friend class atomic_future;
template <class _R1, class _F>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _R1, class _F>
friend future<_R1> __make_deferred_assoc_state(_F&& __f);
template <class _R1, class _F>
friend future<_R1> __make_async_assoc_state(_F&& __f);
#else
template <class _R1, class _F>
friend future<_R1> __make_deferred_assoc_state(_F __f);
template <class _R1, class _F>
friend future<_R1> __make_async_assoc_state(_F __f);
#endif
public:
@@ -2034,36 +2166,72 @@ __make_deferred_assoc_state(_F __f)
return future<_R>(__h.get());
}
template <class _R, class _F>
future<_R>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__make_async_assoc_state(_F&& __f)
#else
__make_async_assoc_state(_F __f)
#endif
{
unique_ptr<__async_assoc_state<_R, _F>, __release_shared_count>
__h(new __async_assoc_state<_R, _F>(_STD::forward<_F>(__f)));
_STD::thread(&__async_assoc_state<_R, _F>::__execute, __h.get()).detach();
return future<_R>(__h.get());
}
template <class _F, class... _Args>
future<typename result_of<_F(_Args...)>::type>
class __async_func
{
tuple<_F, _Args...> __f_;
public:
typedef typename __invoke_of<_F, _Args...>::type _R;
_LIBCPP_INLINE_VISIBILITY
explicit __async_func(_F&& __f, _Args&&... __args)
: __f_(_STD::move(__f), _STD::move(__args)...) {}
_LIBCPP_INLINE_VISIBILITY
__async_func(__async_func&& __f) : __f_(_STD::move(__f.__f_)) {}
_R operator()()
{
typedef typename __make_tuple_indices<1+sizeof...(_Args), 1>::type _Index;
return __execute(_Index());
}
private:
template <size_t ..._Indices>
_R
__execute(__tuple_indices<_Indices...>)
{
return __invoke(_STD::move(_STD::get<0>(__f_)), _STD::move(_STD::get<_Indices>(__f_))...);
}
};
template <class _F, class... _Args>
future<typename __invoke_of<typename decay<_F>::type, typename decay<_Args>::type...>::type>
async(launch __policy, _F&& __f, _Args&&... __args)
{
typedef typename result_of<_F(_Args...)>::type _R;
typedef __async_func<typename decay<_F>::type, typename decay<_Args>::type...> _BF;
typedef typename _BF::_R _R;
future<_R> __r;
if (__policy & launch::async)
{
packaged_task<_R()> __pk(bind(_STD::forward<_F>(__f),
_STD::forward<_Args>(__args)...));
__r = __pk.get_future();
thread(_STD::move(__pk)).detach();
}
__r = _STD::__make_async_assoc_state<_R>(_BF(__decay_copy(_STD::forward<_F>(__f)),
__decay_copy(_STD::forward<_Args>(__args))...));
else if (__policy & launch::deferred)
__r = _STD::__make_deferred_assoc_state<_R>(bind(_STD::forward<_F>(__f),
_STD::forward<_Args>(__args)...));
__r = _STD::__make_deferred_assoc_state<_R>(_BF(__decay_copy(_STD::forward<_F>(__f)),
__decay_copy(_STD::forward<_Args>(__args))...));
return __r;
}
template <class _F, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_same<typename decay<_F>::type, launch>::value,
future<typename result_of<_F(_Args...)>::type>
>::type
future<typename __invoke_of<typename decay<_F>::type, typename decay<_Args>::type...>::type>
async(_F&& __f, _Args&&... __args)
{
return async(launch::any, _STD::forward<_F>(__f),
_STD::forward<_Args>(__args)...);
return _STD::async(launch::any, _STD::forward<_F>(__f),
_STD::forward<_Args>(__args)...);
}
#endif // _LIBCPP_HAS_NO_VARIADICS

View File

@@ -20,6 +20,7 @@ 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;

View File

@@ -2346,6 +2346,12 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
}
break;
case 'F':
{
const char_type __fmt[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
}
break;
case 'H':
__get_hour(__tm->tm_hour, __b, __e, __err, __ct);
break;

View File

@@ -567,9 +567,9 @@ public:
typedef const value_type& reference;
typedef typename __pointer_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
rebind<const value_type>
#else
rebind<value_type>::other
rebind<const value_type>::other
#endif
pointer;

View File

@@ -794,7 +794,7 @@ struct _LIBCPP_VISIBLE pointer_traits
typedef typename __pointer_traits_difference_type<pointer>::type difference_type;
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _Up> using rebind = __pointer_traits_rebind<pointer, _Up>::type;
template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
#else
template <class _Up> struct rebind
{typedef typename __pointer_traits_rebind<pointer, _Up>::type other;};
@@ -1331,7 +1331,7 @@ struct _LIBCPP_VISIBLE allocator_traits
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _Tp> using rebind_alloc =
__allocator_traits_rebind<allocator_type, _Tp>::type;
typename __allocator_traits_rebind<allocator_type, _Tp>::type;
template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp>>;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _Tp> struct rebind_alloc
@@ -3338,7 +3338,7 @@ inline _LIBCPP_INLINE_VISIBILITY
shared_ptr<_Tp>&
shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
{
shared_ptr(__r).swap(*this);
shared_ptr(_STD::move(__r)).swap(*this);
return *this;
}
@@ -3586,10 +3586,10 @@ private:
public:
weak_ptr();
template<class _Yp> weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat());
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0);
weak_ptr(weak_ptr const& __r);
template<class _Yp> weak_ptr(weak_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat());
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0);
~weak_ptr();
@@ -3640,7 +3640,7 @@ template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
{
@@ -3652,7 +3652,7 @@ template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
{

View File

@@ -175,6 +175,9 @@ template<class Callable, class ...Args>
#include <__config>
#include <__mutex_base>
#include <functional>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#pragma GCC system_header
@@ -455,6 +458,39 @@ private:
#endif // _LIBCPP_HAS_NO_VARIADICS
};
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F>
class __call_once_param
{
_F __f_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _F& __f) : __f_(__f) {}
#endif
_LIBCPP_INLINE_VISIBILITY
void operator()()
{
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
__execute(_Index());
}
private:
template <size_t ..._Indices>
_LIBCPP_INLINE_VISIBILITY
void __execute(__tuple_indices<_Indices...>)
{
__invoke(_STD::move(_STD::get<0>(__f_)), _STD::move(_STD::get<_Indices>(__f_))...);
}
};
#else
template <class _F>
class __call_once_param
{
@@ -475,6 +511,8 @@ public:
}
};
#endif
template <class _F>
void
__call_once_proxy(void* __vp)
@@ -494,10 +532,9 @@ call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
{
if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
{
typedef decltype(std::bind(std::forward<_Callable>(__func),
std::forward<_Args>(__args)...)) _G;
__call_once_param<_G> __p(std::bind(std::forward<_Callable>(__func),
std::forward<_Args>(__args)...));
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _G;
__call_once_param<_G> __p(_G(__decay_copy(_STD::forward<_Callable>(__func)),
__decay_copy(_STD::forward<_Args>(__args))...));
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
}
}

View File

@@ -1650,6 +1650,16 @@ class piecewise_linear_distribution
_LIBCPP_BEGIN_NAMESPACE_STD
// __is_seed_sequence
template <class _Sseq, class _Engine>
struct __is_seed_sequence
{
static const bool value =
!is_convertible<_Sseq, typename _Engine::result_type>::value &&
!is_same<typename remove_cv<_Sseq>::type, _Engine>::value;
};
// linear_congruential_engine
template <unsigned long long __a, unsigned long long __c,
@@ -1848,7 +1858,7 @@ public:
{seed(__s);}
template<class _Sseq> explicit linear_congruential_engine(_Sseq& __q,
_LIBCPP_INLINE_VISIBILITY
typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0)
typename enable_if<__is_seed_sequence<_Sseq, linear_congruential_engine>::value>::type* = 0)
{seed(__q);}
_LIBCPP_INLINE_VISIBILITY
void seed(result_type __s = default_seed)
@@ -1858,7 +1868,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_convertible<_Sseq, result_type>::value,
__is_seed_sequence<_Sseq, linear_congruential_engine>::value,
void
>::type
seed(_Sseq& __q)
@@ -2104,14 +2114,14 @@ public:
{seed(__sd);}
template<class _Sseq> explicit mersenne_twister_engine(_Sseq& __q,
_LIBCPP_INLINE_VISIBILITY
typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0)
typename enable_if<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value>::type* = 0)
{seed(__q);}
void seed(result_type __sd = default_seed);
template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_convertible<_Sseq, result_type>::value,
__is_seed_sequence<_Sseq, mersenne_twister_engine>::value,
void
>::type
seed(_Sseq& __q)
@@ -2473,7 +2483,7 @@ public:
{seed(__sd);}
template<class _Sseq> explicit subtract_with_carry_engine(_Sseq& __q,
_LIBCPP_INLINE_VISIBILITY
typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0)
typename enable_if<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value>::type* = 0)
{seed(__q);}
_LIBCPP_INLINE_VISIBILITY
void seed(result_type __sd = default_seed)
@@ -2482,7 +2492,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_convertible<_Sseq, result_type>::value,
__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value,
void
>::type
seed(_Sseq& __q)
@@ -2741,7 +2751,7 @@ public:
template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY
explicit discard_block_engine(_Sseq& __q,
typename enable_if<!is_convertible<_Sseq, result_type>::value &&
typename enable_if<__is_seed_sequence<_Sseq, discard_block_engine>::value &&
!is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q), __n_(0) {}
_LIBCPP_INLINE_VISIBILITY
@@ -2752,7 +2762,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_convertible<_Sseq, result_type>::value,
__is_seed_sequence<_Sseq, discard_block_engine>::value,
void
>::type
seed(_Sseq& __q) {__e_.seed(__q); __n_ = 0;}
@@ -2940,7 +2950,7 @@ public:
explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
template<class _Sseq> explicit independent_bits_engine(_Sseq& __q,
_LIBCPP_INLINE_VISIBILITY
typename enable_if<!is_convertible<_Sseq, result_type>::value &&
typename enable_if<__is_seed_sequence<_Sseq, independent_bits_engine>::value &&
!is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q) {}
_LIBCPP_INLINE_VISIBILITY
@@ -2951,7 +2961,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_convertible<_Sseq, result_type>::value,
__is_seed_sequence<_Sseq, independent_bits_engine>::value,
void
>::type
seed(_Sseq& __q) {__e_.seed(__q);}
@@ -3163,7 +3173,7 @@ public:
explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();}
template<class _Sseq> explicit shuffle_order_engine(_Sseq& __q,
_LIBCPP_INLINE_VISIBILITY
typename enable_if<!is_convertible<_Sseq, result_type>::value &&
typename enable_if<__is_seed_sequence<_Sseq, shuffle_order_engine>::value &&
!is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q) {__init();}
_LIBCPP_INLINE_VISIBILITY
@@ -3174,7 +3184,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_convertible<_Sseq, result_type>::value,
__is_seed_sequence<_Sseq, shuffle_order_engine>::value,
void
>::type
seed(_Sseq& __q) {__e_.seed(__q); __init();}
@@ -4467,7 +4477,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
{
result_type __x;
uniform_real_distribution<double> __urd;
if (__pr.__mean_ <= 10)
if (__pr.__mean_ < 10)
{
__x = 0;
for (double __p = __urd(__urng); __p > __pr.__l_; ++__x)

View File

@@ -547,11 +547,11 @@ operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
return __a.outer_allocator() == __b.outer_allocator();
}
template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b)
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b)
{
return __a.outer_allocator() == __b.outer_allocator() &&
__a.inner_allocator() == __b.inner_allocator();

View File

@@ -95,6 +95,9 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <system_error>
#include <chrono>
#include <__mutex_base>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#include <pthread.h>
#pragma GCC system_header
@@ -315,6 +318,44 @@ public:
__thread_specific_ptr<__thread_struct>& __thread_local_data();
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F, class ..._Args, size_t ..._Indices>
inline _LIBCPP_INLINE_VISIBILITY
void
__threaad_execute(tuple<_F, _Args...>& __t, __tuple_indices<_Indices...>)
{
__invoke(_STD::move(_STD::get<0>(__t)), _STD::move(_STD::get<_Indices>(__t))...);
}
template <class _F>
void*
__thread_proxy(void* __vp)
{
__thread_local_data().reset(new __thread_struct);
std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
__threaad_execute(*__p, _Index());
return nullptr;
}
template <class _F, class ..._Args,
class
>
thread::thread(_F&& __f, _Args&&... __args)
{
typedef tuple<typename decay<_F>::type, typename decay<_Args>::type...> _G;
_STD::unique_ptr<_G> __p(new _G(__decay_copy(_STD::forward<_F>(__f)),
__decay_copy(_STD::forward<_Args>(__args))...));
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get());
if (__ec == 0)
__p.release();
else
__throw_system_error(__ec, "thread constructor failed");
}
#else // _LIBCPP_HAS_NO_VARIADICS
template <class _F>
void*
__thread_proxy(void* __vp)
@@ -325,25 +366,6 @@ __thread_proxy(void* __vp)
return nullptr;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F, class ..._Args,
class
>
thread::thread(_F&& __f, _Args&&... __args)
{
typedef decltype(bind(std::forward<_F>(__f), std::forward<_Args>(__args)...)) _G;
std::unique_ptr<_G> __p(new _G(bind(std::forward<_F>(__f),
std::forward<_Args>(__args)...)));
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get());
if (__ec == 0)
__p.release();
else
__throw_system_error(__ec, "thread constructor failed");
}
#else // _LIBCPP_HAS_NO_VARIADICS
template <class _F>
thread::thread(_F __f)
{

File diff suppressed because it is too large Load Diff

View File

@@ -211,6 +211,13 @@ struct _LIBCPP_VISIBLE pair
_LIBCPP_INLINE_VISIBILITY pair(const _T1& __x, const _T2& __y)
: first(__x), second(__y) {}
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY
pair(const pair<_U1, _U2>& __p,
typename enable_if<is_convertible<_U1, _T1>::value &&
is_convertible<_U2, _T2>::value>::type* = 0)
: first(__p.first), second(__p.second) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _U1, class _U2,
@@ -222,6 +229,14 @@ struct _LIBCPP_VISIBLE pair
second(_STD::forward<_U2>(__u2))
{}
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY
pair(pair<_U1, _U2>&& __p,
typename enable_if<is_convertible<_U1, _T1>::value &&
is_convertible<_U2, _T2>::value>::type* = 0)
: first(_STD::forward<_U1>(__p.first)),
second(_STD::forward<_U2>(__p.second)) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template<class _Tuple,
@@ -261,10 +276,6 @@ struct _LIBCPP_VISIBLE pair
#endif // _LIBCPP_HAS_NO_VARIADICS
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p)
: first(__p.first), second(__p.second) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void _LIBCPP_INLINE_VISIBILITY swap(pair& __p) {_STD::swap(*this, __p);}
private:

View File

@@ -14,10 +14,12 @@ endif()
if (LIBCXX_ENABLE_SHARED)
add_library(cxx SHARED
${sources}
${headers}
)
else()
add_library(cxx STATIC
${sources}
${headers}
)
endif()
@@ -25,6 +27,7 @@ endif()
append_if(libraries LIBCXX_HAS_PTHREAD_LIB pthread)
append_if(libraries LIBCXX_HAS_C_LIB c)
append_if(libraries LIBCXX_HAS_M_LIB m)
append_if(libraries LIBCXX_HAS_RT_LIB rt)
append_if(libraries LIBCXX_HAS_GCC_S_LIB gcc_s)
target_link_libraries(cxx ${libraries})
@@ -48,10 +51,8 @@ install(TARGETS cxx
)
install(DIRECTORY ../include/
DESTINATION include/libcxx/v1
DESTINATION include/c++/v1
FILES_MATCHING
PATTERN "*"
PATTERN ".svn" EXCLUDE
PATTERN ".git" EXCLUDE
)

View File

@@ -17,9 +17,17 @@ then
CXX=clang++
fi
if [ -z "$CC" ]
then
CC=clang
fi
if [ -z $MACOSX_DEPLOYMENT_TARGET ]
then
MACOSX_DEPLOYMENT_TARGET=10.6
if [ -z $IPHONEOS_DEPLOYMENT_TARGET ]
then
MACOSX_DEPLOYMENT_TARGET=10.6
fi
fi
if [ -z $RC_ProjectSourceVersion ]
@@ -29,7 +37,7 @@ fi
case $TRIPLE in
*-apple-*)
if [ -z $RC_BUILDIT ]
if [ -z $RC_XBS ]
then
RC_CFLAGS="-arch i386 -arch x86_64"
fi
@@ -45,16 +53,28 @@ case $TRIPLE in
-Wl,-unexported_symbols_list,libc++unexp.exp \
/usr/lib/libSystem.B.dylib"
else
EXTRA_FLAGS="-std=c++0x"
LDSHARED_FLAGS="-o libc++.1.dylib \
EXTRA_FLAGS="-std=c++0x "
RE_EXPORT_LINE="/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi.exp"
if [ -n "$SDKROOT" ]
then
EXTRA_FLAGS+="-isysroot ${SDKROOT}"
if echo "${RC_ARCHS}" | grep -q "armv7"
then
RE_EXPORT_LINE="${SDKROOT}/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++sjlj-abi.exp"
else
RE_EXPORT_LINE="-Wl,-reexport_library,${SDKROOT}/usr/lib/libc++abi.dylib"
fi
CXX=`xcrun -sdk "${SDKROOT}" -find clang++`
CC=`xcrun -sdk "${SDKROOT}" -find clang`
fi
LDSHARED_FLAGS="-o libc++.1.dylib \
-dynamiclib -nodefaultlibs \
-current_version ${RC_ProjectSourceVersion} -compatibility_version 1 \
-install_name /usr/lib/libc++.1.dylib \
${SDKROOT}/usr/lib/libc++abi.dylib \
-lSystem \
-Wl,-unexported_symbols_list,libc++unexp.exp \
-Wl,-reexported_symbols_list,libc++abi.exp \
-Wl,-force_symbols_not_weak_list,notweak.exp"
${RE_EXPORT_LINE} \
-Wl,-force_symbols_not_weak_list,notweak.exp "
fi
;;
*)
@@ -66,7 +86,7 @@ case $TRIPLE in
;;
esac
if [ -z $RC_BUILDIT ]
if [ -z $RC_XBS ]
then
rm -f libc++.1.$SOEXT*
fi
@@ -78,11 +98,11 @@ for FILE in ../src/*.cpp; do
done
cc *.o $RC_CFLAGS $LDSHARED_FLAGS
$CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS
#libtool -static -o libc++.a *.o
if [ -z $RC_BUILDIT ]
if [ -z $RC_XBS ]
then
rm *.o
fi

159
lib/libc++sjlj-abi.exp Normal file
View File

@@ -0,0 +1,159 @@
___cxa_allocate_exception
___cxa_end_catch
___cxa_demangle
___cxa_current_exception_type
___cxa_call_unexpected
___cxa_free_exception
___cxa_get_exception_ptr
___cxa_get_globals
___cxa_get_globals_fast
___cxa_guard_abort
___cxa_guard_acquire
___cxa_guard_release
___cxa_rethrow
___cxa_pure_virtual
___cxa_begin_catch
___cxa_throw
___cxa_vec_cctor
___cxa_vec_cleanup
___cxa_vec_ctor
___cxa_vec_delete
___cxa_vec_delete2
___cxa_vec_delete3
___cxa_vec_dtor
___cxa_vec_new
___cxa_vec_new2
___cxa_vec_new3
___dynamic_cast
___gxx_personality_sj0
__ZTIDi
__ZTIDn
__ZTIDs
__ZTIPDi
__ZTIPDn
__ZTIPDs
__ZTIPKDi
__ZTIPKDn
__ZTIPKDs
__ZTSPm
__ZTSPl
__ZTSPj
__ZTSPi
__ZTSPh
__ZTSPf
__ZTSPe
__ZTSPd
__ZTSPc
__ZTSPb
__ZTSPa
__ZTSPKc
__ZTSPKy
__ZTSPKx
__ZTSPKw
__ZTSPKv
__ZTSPKt
__ZTSPKs
__ZTSPKm
__ZTSPKl
__ZTSPKi
__ZTSPKh
__ZTSPs
__ZTSPt
__ZTSPv
__ZTSPw
__ZTSPKa
__ZTSPx
__ZTSPy
__ZTSPKd
__ZTSPKe
__ZTSPKj
__ZTSPKb
__ZTSPKf
__ZTSv
__ZTSt
__ZTSs
__ZTSm
__ZTSl
__ZTSj
__ZTSi
__ZTSh
__ZTSf
__ZTSe
__ZTSd
__ZTSc
__ZTSw
__ZTSx
__ZTSy
__ZTSb
__ZTSa
__ZTIPKh
__ZTIPKf
__ZTIPKe
__ZTIPKd
__ZTIPKc
__ZTIPKb
__ZTIPKa
__ZTIPy
__ZTIPx
__ZTIPw
__ZTIPv
__ZTIPt
__ZTIPs
__ZTIPm
__ZTIPl
__ZTIPj
__ZTIPi
__ZTIPKi
__ZTIPKj
__ZTIPKl
__ZTIPKm
__ZTIPKs
__ZTIPKt
__ZTIPKv
__ZTIPKw
__ZTIPKx
__ZTIPKy
__ZTIPa
__ZTIPb
__ZTIPc
__ZTIPd
__ZTIPe
__ZTIPf
__ZTIPh
__ZTVN10__cxxabiv129__pointer_to_member_type_infoE
__ZTVN10__cxxabiv116__enum_type_infoE
__ZTVN10__cxxabiv117__array_type_infoE
__ZTVN10__cxxabiv117__class_type_infoE
__ZTVN10__cxxabiv117__pbase_type_infoE
__ZTVN10__cxxabiv119__pointer_type_infoE
__ZTVN10__cxxabiv120__function_type_infoE
__ZTVN10__cxxabiv120__si_class_type_infoE
__ZTVN10__cxxabiv121__vmi_class_type_infoE
__ZTVN10__cxxabiv123__fundamental_type_infoE
__ZTIa
__ZTIb
__ZTIc
__ZTId
__ZTIe
__ZTIf
__ZTIh
__ZTIi
__ZTIj
__ZTIl
__ZTIm
__ZTIs
__ZTIt
__ZTSN10__cxxabiv129__pointer_to_member_type_infoE
__ZTSN10__cxxabiv123__fundamental_type_infoE
__ZTSN10__cxxabiv121__vmi_class_type_infoE
__ZTSN10__cxxabiv120__si_class_type_infoE
__ZTSN10__cxxabiv120__function_type_infoE
__ZTSN10__cxxabiv119__pointer_type_infoE
__ZTSN10__cxxabiv117__pbase_type_infoE
__ZTSN10__cxxabiv117__class_type_infoE
__ZTSN10__cxxabiv117__array_type_infoE
__ZTSN10__cxxabiv116__enum_type_infoE
__ZTIy
__ZTIx
__ZTIw
__ZTIv

View File

@@ -32,7 +32,7 @@ if(PYTHONINTERP_FOUND)
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
@ONLY)
add_custom_target(libcxx.check
add_custom_target(check
COMMAND ${PYTHON_EXECUTABLE}
${LIT_EXECUTABLE}
${LIT_ARGS}
@@ -40,5 +40,5 @@ if(PYTHONINTERP_FOUND)
DEPENDS
COMMENT "Running libcxx tests")
else()
message(WARNING "Could not find Python, no libcxx.check target will be available!")
message(WARNING "Could not find Python, no check target will be available!")
endif()

View File

@@ -24,7 +24,7 @@ public:
bool operator==(const Emplaceable& x) const
{return int_ == x.int_ && double_ == x.double_;}
bool operator<(const Emplaceable& x) const
{return int_ < x.int_ || int_ == x.int_ && double_ < x.double_;}
{return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);}
int get() const {return int_;}
};

View File

@@ -13,6 +13,8 @@
#include <type_traits>
#include <cassert>
#include "../../hexfloat.h"
void test_acos()
{
static_assert((std::is_same<decltype(acos((double)0)), double>::value), "");
@@ -194,9 +196,9 @@ void test_tanh()
void test_signbit()
{
static_assert((std::is_same<decltype(signbit((float)0)), int>::value), "");
static_assert((std::is_same<decltype(signbit((double)0)), int>::value), "");
static_assert((std::is_same<decltype(signbit((long double)0)), int>::value), "");
static_assert((std::is_same<decltype(signbit((float)0)), bool>::value), "");
static_assert((std::is_same<decltype(signbit((double)0)), bool>::value), "");
static_assert((std::is_same<decltype(signbit((long double)0)), bool>::value), "");
assert(signbit(-1.0) == true);
}
@@ -210,117 +212,117 @@ void test_fpclassify()
void test_isfinite()
{
static_assert((std::is_same<decltype(isfinite((float)0)), int>::value), "");
static_assert((std::is_same<decltype(isfinite((double)0)), int>::value), "");
static_assert((std::is_same<decltype(isfinite((long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isfinite((float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isfinite((double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isfinite((long double)0)), bool>::value), "");
assert(isfinite(-1.0) == true);
}
void test_isinf()
{
static_assert((std::is_same<decltype(isinf((float)0)), int>::value), "");
static_assert((std::is_same<decltype(isinf((double)0)), int>::value), "");
static_assert((std::is_same<decltype(isinf((long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isinf((float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isinf((double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isinf((long double)0)), bool>::value), "");
assert(isinf(-1.0) == false);
}
void test_isnan()
{
static_assert((std::is_same<decltype(isnan((float)0)), int>::value), "");
static_assert((std::is_same<decltype(isnan((double)0)), int>::value), "");
static_assert((std::is_same<decltype(isnan((long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isnan((float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isnan((double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isnan((long double)0)), bool>::value), "");
assert(isnan(-1.0) == false);
}
void test_isnormal()
{
static_assert((std::is_same<decltype(isnormal((float)0)), int>::value), "");
static_assert((std::is_same<decltype(isnormal((double)0)), int>::value), "");
static_assert((std::is_same<decltype(isnormal((long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isnormal((float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isnormal((double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isnormal((long double)0)), bool>::value), "");
assert(isnormal(-1.0) == true);
}
void test_isgreater()
{
static_assert((std::is_same<decltype(isgreater((float)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreater((float)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreater((float)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreater((double)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreater((double)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreater((double)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreater((long double)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreater((long double)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreater((long double)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreater((float)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((float)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((float)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((double)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((long double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((long double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((long double)0, (long double)0)), bool>::value), "");
assert(isgreater(-1.0, 0.F) == false);
}
void test_isgreaterequal()
{
static_assert((std::is_same<decltype(isgreaterequal((float)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((float)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((float)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((double)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((double)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((double)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((long double)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((long double)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((long double)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((float)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((float)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((float)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((double)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((long double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((long double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((long double)0, (long double)0)), bool>::value), "");
assert(isgreaterequal(-1.0, 0.F) == false);
}
void test_isless()
{
static_assert((std::is_same<decltype(isless((float)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(isless((float)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(isless((float)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isless((double)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(isless((double)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(isless((double)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isless((long double)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(isless((long double)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(isless((long double)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isless((float)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((float)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((float)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((double)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((long double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((long double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((long double)0, (long double)0)), bool>::value), "");
assert(isless(-1.0, 0.F) == true);
}
void test_islessequal()
{
static_assert((std::is_same<decltype(islessequal((float)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(islessequal((float)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(islessequal((float)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(islessequal((double)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(islessequal((double)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(islessequal((double)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(islessequal((long double)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(islessequal((long double)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(islessequal((long double)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(islessequal((float)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((float)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((float)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((double)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((long double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((long double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((long double)0, (long double)0)), bool>::value), "");
assert(islessequal(-1.0, 0.F) == true);
}
void test_islessgreater()
{
static_assert((std::is_same<decltype(islessgreater((float)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(islessgreater((float)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(islessgreater((float)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(islessgreater((double)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(islessgreater((double)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(islessgreater((double)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(islessgreater((long double)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(islessgreater((long double)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(islessgreater((long double)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(islessgreater((float)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((float)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((float)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((double)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((long double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((long double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((long double)0, (long double)0)), bool>::value), "");
assert(islessgreater(-1.0, 0.F) == true);
}
void test_isunordered()
{
static_assert((std::is_same<decltype(isunordered((float)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(isunordered((float)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(isunordered((float)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isunordered((double)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(isunordered((double)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(isunordered((double)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isunordered((long double)0, (float)0)), int>::value), "");
static_assert((std::is_same<decltype(isunordered((long double)0, (double)0)), int>::value), "");
static_assert((std::is_same<decltype(isunordered((long double)0, (long double)0)), int>::value), "");
static_assert((std::is_same<decltype(isunordered((float)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((float)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((float)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((double)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((long double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((long double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((long double)0, (long double)0)), bool>::value), "");
assert(isunordered(-1.0, 0.F) == false);
}
@@ -528,7 +530,7 @@ void test_nextafter()
static_assert((std::is_same<decltype(nextafter((double)0, (double)0)), double>::value), "");
static_assert((std::is_same<decltype(nextafterf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(nextafterl(0,0)), long double>::value), "");
assert(nextafter(0,1) == 0x1p-1074);
assert(nextafter(0,1) == hexfloat<double>(0x1, 0, -1074));
}
void test_nexttoward()
@@ -536,7 +538,7 @@ void test_nexttoward()
static_assert((std::is_same<decltype(nexttoward((double)0, (long double)0)), double>::value), "");
static_assert((std::is_same<decltype(nexttowardf(0, (long double)0)), float>::value), "");
static_assert((std::is_same<decltype(nexttowardl(0, (long double)0)), long double>::value), "");
assert(nexttoward(0, 1) == 0x1p-1074);
assert(nexttoward(0, 1) == hexfloat<double>(0x1, 0, -1074));
}
void test_remainder()

View File

@@ -95,19 +95,19 @@ int main()
static_assert((std::is_same<decltype(freopen("", "", fp)), FILE*>::value), "");
static_assert((std::is_same<decltype(setbuf(fp,cp)), void>::value), "");
static_assert((std::is_same<decltype(vfprintf(fp,"",va)), int>::value), "");
static_assert((std::is_same<decltype(fprintf(fp,"")), int>::value), "");
static_assert((std::is_same<decltype(fprintf(fp," ")), int>::value), "");
static_assert((std::is_same<decltype(fscanf(fp,"")), int>::value), "");
static_assert((std::is_same<decltype(printf("")), int>::value), "");
static_assert((std::is_same<decltype(scanf("")), int>::value), "");
static_assert((std::is_same<decltype(snprintf(cp,0,"")), int>::value), "");
static_assert((std::is_same<decltype(sprintf(cp,"")), int>::value), "");
static_assert((std::is_same<decltype(printf("\n")), int>::value), "");
static_assert((std::is_same<decltype(scanf("\n")), int>::value), "");
static_assert((std::is_same<decltype(snprintf(cp,0,"p")), int>::value), "");
static_assert((std::is_same<decltype(sprintf(cp," ")), int>::value), "");
static_assert((std::is_same<decltype(sscanf("","")), int>::value), "");
static_assert((std::is_same<decltype(vfprintf(fp,"",va)), int>::value), "");
static_assert((std::is_same<decltype(vfscanf(fp,"",va)), int>::value), "");
static_assert((std::is_same<decltype(vprintf("",va)), int>::value), "");
static_assert((std::is_same<decltype(vprintf(" ",va)), int>::value), "");
static_assert((std::is_same<decltype(vscanf("",va)), int>::value), "");
static_assert((std::is_same<decltype(vsnprintf(cp,0,"",va)), int>::value), "");
static_assert((std::is_same<decltype(vsprintf(cp,"",va)), int>::value), "");
static_assert((std::is_same<decltype(vsnprintf(cp,0," ",va)), int>::value), "");
static_assert((std::is_same<decltype(vsprintf(cp," ",va)), int>::value), "");
static_assert((std::is_same<decltype(vsscanf("","",va)), int>::value), "");
static_assert((std::is_same<decltype(fgetc(fp)), int>::value), "");
static_assert((std::is_same<decltype(fgets(cp,0,fp)), char*>::value), "");

38
test/hexfloat.h Normal file
View File

@@ -0,0 +1,38 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// Define a hexfloat literal emulator since we can't depend on being able to
// for hexfloat literals
// 0x10.F5p-10 == hexfloat<double>(0x10, 0xF5, -10)
#ifndef HEXFLOAT_H
#define HEXFLOAT_H
#include <algorithm>
#include <cmath>
#include <climits>
template <class T>
class hexfloat
{
T value_;
public:
hexfloat(long long m1, unsigned long long m0, int exp)
{
const std::size_t n = sizeof(unsigned long long) * CHAR_BIT;
int s = m1 < 0 ? -1 : 1;
value_ = std::ldexp(m1 + s * std::ldexp(T(m0), -static_cast<int>(n -
std::__clz(m0)/4*4)), exp);
}
operator T() const {return value_;}
};
#endif

View File

@@ -95,19 +95,19 @@ int main()
static_assert((std::is_same<decltype(std::freopen("", "", fp)), std::FILE*>::value), "");
static_assert((std::is_same<decltype(std::setbuf(fp,cp)), void>::value), "");
static_assert((std::is_same<decltype(std::vfprintf(fp,"",va)), int>::value), "");
static_assert((std::is_same<decltype(std::fprintf(fp,"")), int>::value), "");
static_assert((std::is_same<decltype(std::fprintf(fp," ")), int>::value), "");
static_assert((std::is_same<decltype(std::fscanf(fp,"")), int>::value), "");
static_assert((std::is_same<decltype(std::printf("")), int>::value), "");
static_assert((std::is_same<decltype(std::scanf("")), int>::value), "");
static_assert((std::is_same<decltype(std::snprintf(cp,0,"")), int>::value), "");
static_assert((std::is_same<decltype(std::sprintf(cp,"")), int>::value), "");
static_assert((std::is_same<decltype(std::printf(" ")), int>::value), "");
static_assert((std::is_same<decltype(std::scanf(" ")), int>::value), "");
static_assert((std::is_same<decltype(std::snprintf(cp,0," ")), int>::value), "");
static_assert((std::is_same<decltype(std::sprintf(cp," ")), int>::value), "");
static_assert((std::is_same<decltype(std::sscanf("","")), int>::value), "");
static_assert((std::is_same<decltype(std::vfprintf(fp,"",va)), int>::value), "");
static_assert((std::is_same<decltype(std::vfscanf(fp,"",va)), int>::value), "");
static_assert((std::is_same<decltype(std::vprintf("",va)), int>::value), "");
static_assert((std::is_same<decltype(std::vprintf(" ",va)), int>::value), "");
static_assert((std::is_same<decltype(std::vscanf("",va)), int>::value), "");
static_assert((std::is_same<decltype(std::vsnprintf(cp,0,"",va)), int>::value), "");
static_assert((std::is_same<decltype(std::vsprintf(cp,"",va)), int>::value), "");
static_assert((std::is_same<decltype(std::vsnprintf(cp,0," ",va)), int>::value), "");
static_assert((std::is_same<decltype(std::vsprintf(cp," ",va)), int>::value), "");
static_assert((std::is_same<decltype(std::vsscanf("","",va)), int>::value), "");
static_assert((std::is_same<decltype(std::fgetc(fp)), int>::value), "");
static_assert((std::is_same<decltype(std::fgets(cp,0,fp)), char*>::value), "");

View File

@@ -80,7 +80,7 @@ int main()
assert(!is.fail());
assert(c == L'b');
is >> c;
assert( is.eof());
assert(!is.eof());
assert(!is.fail());
assert(c == L'c');
}

View File

@@ -44,7 +44,7 @@ int main()
F32_8::extern_type c8[4];
for (F32_8::intern_type c32x = 0; c32x < 0x110003; ++c32x)
{
if (0xD800 <= c32x && c32x < 0xE000 || c32x >= 0x110000)
if ((0xD800 <= c32x && c32x < 0xE000) || c32x >= 0x110000)
{
assert(f32_16.out(mbs, &c32x, &c32x+1, c_c32p, c16c+0, c16c+4, c16cp) == F32_8::error);
assert(f32_8.out(mbs, &c32x, &c32x+1, c_c32p, c8, c8+4, c8p) == F32_8::error);

View File

@@ -20,6 +20,7 @@
#include <streambuf>
#include <cmath>
#include "iterators.h"
#include "../../../../../hexfloat.h"
typedef std::num_get<char, input_iterator<const char*> > F;
@@ -105,7 +106,7 @@ int main()
ios, err, v);
assert(iter.base() == str+sizeof(str)-1);
assert(err == ios.goodbit);
assert(v == 0x125p-1);
assert(v == hexfloat<double>(0x125, 0, -1));
}
{
const char str[] = "inf";

View File

@@ -20,6 +20,7 @@
#include <streambuf>
#include <cmath>
#include "iterators.h"
#include "../../../../../hexfloat.h"
typedef std::num_get<char, input_iterator<const char*> > F;
@@ -93,7 +94,7 @@ int main()
ios, err, v);
assert(iter.base() == str+sizeof(str)-1);
assert(err == ios.goodbit);
assert(v == 0x125p-1);
assert(v == hexfloat<float>(0x125, 0, -1));
}
{
const char str[] = "inf";

View File

@@ -20,6 +20,7 @@
#include <streambuf>
#include <cmath>
#include "iterators.h"
#include "../../../../../hexfloat.h"
typedef std::num_get<char, input_iterator<const char*> > F;
@@ -93,7 +94,7 @@ int main()
ios, err, v);
assert(iter.base() == str+sizeof(str)-1);
assert(err == ios.goodbit);
assert(v == 0x125p-1);
assert(v == hexfloat<long double>(0x125, 0, -1));
}
{
const char str[] = "inf";

View File

@@ -13,6 +13,8 @@
#include <type_traits>
#include <cassert>
#include "../../hexfloat.h"
void test_abs()
{
static_assert((std::is_same<decltype(std::abs((float)0)), float>::value), "");
@@ -1089,7 +1091,7 @@ void test_nextafter()
static_assert((std::is_same<decltype(std::nextafterf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(std::nextafterl(0,0)), long double>::value), "");
static_assert((std::is_same<decltype(std::nextafter((int)0, (int)0)), double>::value), "");
assert(std::nextafter(0,1) == 0x1p-1074);
assert(std::nextafter(0,1) == hexfloat<double>(0x1, 0, -1074));
}
void test_nexttoward()
@@ -1107,7 +1109,7 @@ void test_nexttoward()
static_assert((std::is_same<decltype(std::nexttoward((long double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(std::nexttowardf(0, (long double)0)), float>::value), "");
static_assert((std::is_same<decltype(std::nexttowardl(0, (long double)0)), long double>::value), "");
assert(std::nexttoward(0, 1) == 0x1p-1074);
assert(std::nexttoward(0, 1) == hexfloat<double>(0x1, 0, -1074));
}
void test_remainder()

View File

@@ -39,8 +39,6 @@ public:
explicit rand1(result_type sd = Min) : x_(sd)
{
if (x_ < Min)
x_ = Min;
if (x_ > Max)
x_ = Max;
}

View File

@@ -39,8 +39,6 @@ public:
explicit rand1(result_type sd = Min) : x_(sd)
{
if (x_ < Min)
x_ = Min;
if (x_ > Max)
x_ = Max;
}

View File

@@ -40,7 +40,7 @@ test2()
typedef std::mt19937_64 E;
E e1;
e1();
E e2 = e1;
E e2(e1);
assert(e1 == e2);
assert(e1() == e2());
E::result_type k = e1();

View File

@@ -38,7 +38,7 @@ test2()
typedef std::ranlux48_base E;
E e1;
e1();
E e2 = e1;
E e2(e1);
assert(e1 == e2);
assert(e1() == e2());
E::result_type k = e1();

View File

@@ -20,7 +20,7 @@
int main()
{
static_assert(std::launch::any == std::launch::async | std::launch::deferred, "");
static_assert(std::launch::any == (std::launch::async | std::launch::deferred), "");
static_assert(std::launch::async == 1, "");
static_assert(std::launch::deferred == 2, "");
}

View File

@@ -16,7 +16,7 @@
#include <future>
#include <cassert>
void func(std::promise<int>& p)
void func(std::promise<int> p)
{
const int i = 5;
p.set_exception_at_thread_exit(std::make_exception_ptr(3));

View File

@@ -19,7 +19,7 @@
int i = 0;
void func(std::promise<int&>& p)
void func(std::promise<int&> p)
{
p.set_value_at_thread_exit(i);
i = 4;

View File

@@ -19,7 +19,7 @@
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void func(std::promise<std::unique_ptr<int>>& p)
void func(std::promise<std::unique_ptr<int>> p)
{
p.set_value_at_thread_exit(std::unique_ptr<int>(new int(5)));
}

View File

@@ -16,7 +16,7 @@
#include <future>
#include <cassert>
void func(std::promise<int>& p)
void func(std::promise<int> p)
{
const int i = 5;
p.set_value_at_thread_exit(i);

View File

@@ -19,7 +19,7 @@
int i = 0;
void func(std::promise<void>& p)
void func(std::promise<void> p)
{
p.set_value_at_thread_exit();
i = 1;

View File

@@ -18,13 +18,13 @@
#include <future>
#include <cassert>
void func1(std::promise<int>& p)
void func1(std::promise<int> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_value(3);
}
void func2(std::promise<int>& p)
void func2(std::promise<int> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_exception(std::make_exception_ptr(3));
@@ -32,26 +32,26 @@ void func2(std::promise<int>& p)
int j = 0;
void func3(std::promise<int&>& p)
void func3(std::promise<int&> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
j = 5;
p.set_value(j);
}
void func4(std::promise<int&>& p)
void func4(std::promise<int&> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_exception(std::make_exception_ptr(3.5));
}
void func5(std::promise<void>& p)
void func5(std::promise<void> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_value();
}
void func6(std::promise<void>& p)
void func6(std::promise<void> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_exception(std::make_exception_ptr('c'));

View File

@@ -16,7 +16,7 @@
#include <future>
#include <cassert>
void func1(std::promise<int>& p)
void func1(std::promise<int> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_value(3);
@@ -24,14 +24,14 @@ void func1(std::promise<int>& p)
int j = 0;
void func3(std::promise<int&>& p)
void func3(std::promise<int&> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
j = 5;
p.set_value(j);
}
void func5(std::promise<void>& p)
void func5(std::promise<void> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_value();

View File

@@ -20,7 +20,7 @@
typedef std::chrono::milliseconds ms;
void func1(std::promise<int>& p)
void func1(std::promise<int> p)
{
std::this_thread::sleep_for(ms(500));
p.set_value(3);
@@ -28,14 +28,14 @@ void func1(std::promise<int>& p)
int j = 0;
void func3(std::promise<int&>& p)
void func3(std::promise<int&> p)
{
std::this_thread::sleep_for(ms(500));
j = 5;
p.set_value(j);
}
void func5(std::promise<void>& p)
void func5(std::promise<void> p)
{
std::this_thread::sleep_for(ms(500));
p.set_value();

View File

@@ -20,7 +20,7 @@
typedef std::chrono::milliseconds ms;
void func1(std::promise<int>& p)
void func1(std::promise<int> p)
{
std::this_thread::sleep_for(ms(500));
p.set_value(3);
@@ -28,14 +28,14 @@ void func1(std::promise<int>& p)
int j = 0;
void func3(std::promise<int&>& p)
void func3(std::promise<int&> p)
{
std::this_thread::sleep_for(ms(500));
j = 5;
p.set_value(j);
}
void func5(std::promise<void>& p)
void func5(std::promise<void> p)
{
std::this_thread::sleep_for(ms(500));
p.set_value();

View File

@@ -46,7 +46,7 @@ int main()
assert(A::n_copies == 0);
assert(A::n_moves > 0);
}
A::n_copies == 0;
A::n_copies = 0;
A::n_copies = 0;
{
A a(5);

View File

@@ -51,7 +51,7 @@ int main()
assert(A::n_moves > 0);
}
assert(test_alloc_base::count == 0);
A::n_copies == 0;
A::n_copies = 0;
A::n_copies = 0;
{
A a(5);

View File

@@ -26,11 +26,11 @@ public:
long operator()(long i, long j) const {return data_ + i + j;}
};
void func(std::packaged_task<double(int, char)>& p)
void func(std::packaged_task<double(int, char)> p)
{
}
void func2(std::packaged_task<double(int, char)>& p)
void func2(std::packaged_task<double(int, char)> p)
{
p(3, 'a');
}

View File

@@ -31,19 +31,19 @@ public:
}
};
void func0(std::packaged_task<double(int, char)>& p)
void func0(std::packaged_task<double(int, char)> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.make_ready_at_thread_exit(3, 'a');
}
void func1(std::packaged_task<double(int, char)>& p)
void func1(std::packaged_task<double(int, char)> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.make_ready_at_thread_exit(3, 'z');
}
void func2(std::packaged_task<double(int, char)>& p)
void func2(std::packaged_task<double(int, char)> p)
{
p.make_ready_at_thread_exit(3, 'a');
try
@@ -56,7 +56,7 @@ void func2(std::packaged_task<double(int, char)>& p)
}
}
void func3(std::packaged_task<double(int, char)>& p)
void func3(std::packaged_task<double(int, char)> p)
{
try
{

View File

@@ -31,19 +31,19 @@ public:
}
};
void func0(std::packaged_task<double(int, char)>& p)
void func0(std::packaged_task<double(int, char)> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p(3, 'a');
}
void func1(std::packaged_task<double(int, char)>& p)
void func1(std::packaged_task<double(int, char)> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p(3, 'z');
}
void func2(std::packaged_task<double(int, char)>& p)
void func2(std::packaged_task<double(int, char)> p)
{
p(3, 'a');
try
@@ -56,7 +56,7 @@ void func2(std::packaged_task<double(int, char)>& p)
}
}
void func3(std::packaged_task<double(int, char)>& p)
void func3(std::packaged_task<double(int, char)> p)
{
try
{

View File

@@ -18,13 +18,13 @@
#include <future>
#include <cassert>
void func1(std::promise<int>& p)
void func1(std::promise<int> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_value(3);
}
void func2(std::promise<int>& p)
void func2(std::promise<int> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_exception(std::make_exception_ptr(3));
@@ -32,26 +32,26 @@ void func2(std::promise<int>& p)
int j = 0;
void func3(std::promise<int&>& p)
void func3(std::promise<int&> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
j = 5;
p.set_value(j);
}
void func4(std::promise<int&>& p)
void func4(std::promise<int&> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_exception(std::make_exception_ptr(3.5));
}
void func5(std::promise<void>& p)
void func5(std::promise<void> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_value();
}
void func6(std::promise<void>& p)
void func6(std::promise<void> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_exception(std::make_exception_ptr('c'));

View File

@@ -16,7 +16,7 @@
#include <future>
#include <cassert>
void func1(std::promise<int>& p)
void func1(std::promise<int> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_value(3);
@@ -24,14 +24,14 @@ void func1(std::promise<int>& p)
int j = 0;
void func3(std::promise<int&>& p)
void func3(std::promise<int&> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
j = 5;
p.set_value(j);
}
void func5(std::promise<void>& p)
void func5(std::promise<void> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
p.set_value();

View File

@@ -20,7 +20,7 @@
typedef std::chrono::milliseconds ms;
void func1(std::promise<int>& p)
void func1(std::promise<int> p)
{
std::this_thread::sleep_for(ms(500));
p.set_value(3);
@@ -28,14 +28,14 @@ void func1(std::promise<int>& p)
int j = 0;
void func3(std::promise<int&>& p)
void func3(std::promise<int&> p)
{
std::this_thread::sleep_for(ms(500));
j = 5;
p.set_value(j);
}
void func5(std::promise<void>& p)
void func5(std::promise<void> p)
{
std::this_thread::sleep_for(ms(500));
p.set_value();

View File

@@ -20,7 +20,7 @@
typedef std::chrono::milliseconds ms;
void func1(std::promise<int>& p)
void func1(std::promise<int> p)
{
std::this_thread::sleep_for(ms(500));
p.set_value(3);
@@ -28,14 +28,14 @@ void func1(std::promise<int>& p)
int j = 0;
void func3(std::promise<int&>& p)
void func3(std::promise<int&> p)
{
std::this_thread::sleep_for(ms(500));
j = 5;
p.set_value(j);
}
void func5(std::promise<void>& p)
void func5(std::promise<void> p)
{
std::this_thread::sleep_for(ms(500));
p.set_value();

View File

@@ -129,6 +129,22 @@ void f42()
std::call_once(flg41, init41);
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
class MoveOnly
{
MoveOnly(const MoveOnly&);
public:
MoveOnly() {}
MoveOnly(MoveOnly&&) {}
void operator()(MoveOnly&&)
{
}
};
#endif
int main()
{
// check basic functionality
@@ -174,5 +190,9 @@ int main()
t1.join();
assert(init2::called == 5);
}
{
std::once_flag f;
std::call_once(f, MoveOnly(), MoveOnly());
}
#endif // _LIBCPP_HAS_NO_VARIADICS
}

View File

@@ -71,6 +71,22 @@ public:
int G::n_alive = 0;
bool G::op_run = false;
#ifndef _LIBCPP_HAS_NO_VARIADICS
class MoveOnly
{
MoveOnly(const MoveOnly&);
public:
MoveOnly() {}
MoveOnly(MoveOnly&&) {}
void operator()(MoveOnly&&)
{
}
};
#endif
int main()
{
{
@@ -126,5 +142,9 @@ int main()
assert(G::n_alive == 0);
assert(G::op_run);
}
{
std::thread t = std::thread(MoveOnly(), MoveOnly());
t.join();
}
#endif // _LIBCPP_HAS_NO_VARIADICS
}

View File

@@ -264,4 +264,5 @@ int main()
{
test_void_1();
test_int_1();
test_void_2();
}

View File

@@ -241,8 +241,26 @@ test_void_2()
}
}
int f_nested(int i)
{
return i+1;
}
int g_nested(int i)
{
return i*10;
}
void test_nested()
{
using namespace std::placeholders;
assert(std::bind(f_nested, std::bind(g_nested, _1))(3) == 31);
}
int main()
{
test_void_1();
test_int_1();
test_void_2();
test_nested();
}

View File

@@ -64,7 +64,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
move_only(move_only&&) {++move_only_constructed;}
move_only& operator=(move_only&&) {}
move_only& operator=(move_only&&) {return *this;}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
move_only(std::__rv<move_only>) {++move_only_constructed;}

View File

@@ -47,7 +47,7 @@ int main()
A* ptrA = pA.get();
{
std::shared_ptr<B> pB(new B);
pB = pA;
pB = std::move(pA);
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 1);
@@ -64,7 +64,7 @@ int main()
A* ptrA = pA.get();
{
std::shared_ptr<B> pB(new B);
pB = pA;
pB = std::move(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 1);
@@ -81,7 +81,7 @@ int main()
A* ptrA = pA.get();
{
std::shared_ptr<B> pB;
pB = pA;
pB = std::move(pA);
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 1);
@@ -98,7 +98,7 @@ int main()
A* ptrA = pA.get();
{
std::shared_ptr<B> pB;
pB = pA;
pB = std::move(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 1);

View File

@@ -20,7 +20,11 @@ int main()
static_assert(_5::value == 5, "");
static_assert((std::is_same<_5::value_type, int>::value), "");
static_assert((std::is_same<_5::type, _5>::value), "");
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
static_assert((_5() == 5), "");
#else
assert(_5() == 5);
#endif
static_assert(std::false_type::value == false, "");
static_assert((std::is_same<std::false_type::value_type, bool>::value), "");

View File

@@ -1,19 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// type_traits
// aligned_union
#include <type_traits>
int main()
{
#error aligned_union is not implemented
}

View File

@@ -34,6 +34,10 @@ int main()
static_assert((std::is_same<std::result_of<S&(unsigned char, int&)>::type, double>::value), "Error!");
static_assert((std::is_same<std::result_of<PF1()>::type, bool>::value), "Error!");
static_assert((std::is_same<std::result_of<PMS(std::unique_ptr<S>, int)>::type, void>::value), "Error!");
static_assert((std::is_same<std::result_of<PMS(S, int)>::type, void>::value), "Error!");
static_assert((std::is_same<std::result_of<PMS(const S&, int)>::type, void>::value), "Error!");
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
static_assert((std::is_same<std::result_of<PMD(S)>::type, char&&>::value), "Error!");
#endif
static_assert((std::is_same<std::result_of<PMD(const S*)>::type, const char&>::value), "Error!");
}

View File

@@ -31,4 +31,8 @@ int main()
static_assert(( std::is_assignable<int&, double>::value), "");
static_assert(( std::is_assignable<B, A>::value), "");
static_assert((!std::is_assignable<A, B>::value), "");
static_assert((!std::is_assignable<void, const void>::value), "");
static_assert((!std::is_assignable<const void, const void>::value), "");
static_assert(( std::is_assignable<void*&, void*>::value), "");
static_assert((!std::is_assignable<int(), int>::value), "");
}

View File

@@ -18,6 +18,8 @@ struct A
{
explicit A(int);
A(int, double);
private:
A(char);
};
int main()
@@ -27,4 +29,9 @@ int main()
static_assert((std::is_constructible<A, int>::value), "");
static_assert((std::is_constructible<A, int, double>::value), "");
static_assert((!std::is_constructible<A>::value), "");
static_assert((!std::is_constructible<A, char>::value), "");
static_assert((!std::is_constructible<A, void>::value), "");
static_assert((!std::is_constructible<void>::value), "");
static_assert((!std::is_constructible<int&>::value), "");
static_assert(( std::is_constructible<int&, int&>::value), "");
}

View File

@@ -35,6 +35,11 @@ struct A
A();
};
class B
{
B& operator=(const B&);
};
int main()
{
static_assert(( std::is_copy_assignable<int>::value), "");
@@ -47,4 +52,6 @@ int main()
static_assert(( std::is_copy_assignable<Union>::value), "");
static_assert(( std::is_copy_assignable<NotEmpty>::value), "");
static_assert(( std::is_copy_assignable<Empty>::value), "");
static_assert((!std::is_copy_assignable<B>::value), "");
static_assert((!std::is_copy_assignable<void>::value), "");
}

View File

@@ -47,6 +47,11 @@ struct A
A(const A&);
};
class B
{
B(const B&);
};
int main()
{
test_is_copy_constructible<char[3], false>();
@@ -55,6 +60,7 @@ int main()
test_is_copy_constructible<Abstract, false>();
test_is_copy_constructible<A, true>();
test_is_copy_constructible<B, false>();
test_is_copy_constructible<int&, true>();
test_is_copy_constructible<Union, true>();
test_is_copy_constructible<Empty, true>();

View File

@@ -50,6 +50,11 @@ struct A
A();
};
class B
{
B();
};
int main()
{
test_is_default_constructible<void, false>();
@@ -58,6 +63,7 @@ int main()
test_is_default_constructible<Abstract, false>();
test_is_default_constructible<A, true>();
test_is_default_constructible<B, false>();
test_is_default_constructible<Union, true>();
test_is_default_constructible<Empty, true>();
test_is_default_constructible<int, true>();

View File

@@ -13,10 +13,21 @@
#include <type_traits>
struct A
{
};
struct B
{
B();
};
int main()
{
static_assert( std::is_literal_type<int>::value, "");
static_assert( std::is_literal_type<const int>::value, "");
static_assert(!std::is_literal_type<int&>::value, "");
static_assert(!std::is_literal_type<volatile int&>::value, "");
static_assert( std::is_literal_type<int&>::value, "");
static_assert( std::is_literal_type<volatile int&>::value, "");
static_assert( std::is_literal_type<A>::value, "");
static_assert(!std::is_literal_type<B>::value, "");
}

View File

@@ -41,7 +41,8 @@ int main()
static_assert((!std::is_move_assignable<const int>::value), "");
static_assert((!std::is_move_assignable<int[]>::value), "");
static_assert((!std::is_move_assignable<int[3]>::value), "");
static_assert(( std::is_move_assignable<int&>::value), "");
static_assert((!std::is_move_assignable<int[3]>::value), "");
static_assert((!std::is_move_assignable<void>::value), "");
static_assert(( std::is_move_assignable<A>::value), "");
static_assert(( std::is_move_assignable<bit_zero>::value), "");
static_assert(( std::is_move_assignable<Union>::value), "");

View File

@@ -47,4 +47,6 @@ int main()
static_assert((!std::is_nothrow_constructible<A, int>::value), "");
static_assert((!std::is_nothrow_constructible<A, int, double>::value), "");
static_assert((!std::is_nothrow_constructible<A>::value), "");
static_assert(( std::is_nothrow_constructible<Empty>::value), "");
static_assert(( std::is_nothrow_constructible<Empty, const Empty&>::value), "");
}

View File

@@ -42,6 +42,7 @@ struct A
int main()
{
test_has_nothrow_assign<const int, false>();
test_has_nothrow_assign<void, false>();
test_has_nothrow_assign<A, false>();
test_has_nothrow_assign<int&, true>();

View File

@@ -18,8 +18,6 @@ void test_is_nothrow_copy_constructible()
{
static_assert( std::is_nothrow_copy_constructible<T>::value, "");
static_assert( std::is_nothrow_copy_constructible<const T>::value, "");
static_assert( std::is_nothrow_copy_constructible<volatile T>::value, "");
static_assert( std::is_nothrow_copy_constructible<const volatile T>::value, "");
}
template <class T>
@@ -35,12 +33,6 @@ class Empty
{
};
class NotEmpty
{
public:
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
@@ -65,6 +57,5 @@ int main()
test_is_nothrow_copy_constructible<double>();
test_is_nothrow_copy_constructible<int*>();
test_is_nothrow_copy_constructible<const int*>();
test_is_nothrow_copy_constructible<NotEmpty>();
test_is_nothrow_copy_constructible<bit_zero>();
}

View File

@@ -35,12 +35,6 @@ class Empty
{
};
class NotEmpty
{
public:
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
@@ -66,6 +60,5 @@ int main()
test_is_nothrow_default_constructible<int*>();
test_is_nothrow_default_constructible<const int*>();
test_is_nothrow_default_constructible<char[3]>();
test_is_nothrow_default_constructible<NotEmpty>();
test_is_nothrow_default_constructible<bit_zero>();
}

View File

@@ -18,8 +18,6 @@ void test_is_nothrow_move_constructible()
{
static_assert( std::is_nothrow_move_constructible<T>::value, "");
static_assert( std::is_nothrow_move_constructible<const T>::value, "");
static_assert( std::is_nothrow_move_constructible<volatile T>::value, "");
static_assert( std::is_nothrow_move_constructible<const volatile T>::value, "");
}
template <class T>
@@ -35,12 +33,6 @@ class Empty
{
};
class NotEmpty
{
public:
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
@@ -58,13 +50,12 @@ int main()
test_has_not_nothrow_move_constructor<void>();
test_has_not_nothrow_move_constructor<A>();
test_has_not_nothrow_move_constructor<int&>();
test_is_nothrow_move_constructible<int&>();
test_is_nothrow_move_constructible<Union>();
test_is_nothrow_move_constructible<Empty>();
test_is_nothrow_move_constructible<int>();
test_is_nothrow_move_constructible<double>();
test_is_nothrow_move_constructible<int*>();
test_is_nothrow_move_constructible<const int*>();
test_is_nothrow_move_constructible<NotEmpty>();
test_is_nothrow_move_constructible<bit_zero>();
}

View File

@@ -13,9 +13,18 @@
#include <type_traits>
template <class T1, class T2>
struct pair
{
T1 first;
T2 second;
};
int main()
{
static_assert( std::is_standard_layout<int>::value, "");
static_assert( std::is_standard_layout<int[3]>::value, "");
static_assert(!std::is_standard_layout<int&>::value, "");
static_assert(!std::is_standard_layout<volatile int&>::value, "");
static_assert(( std::is_standard_layout<pair<int, double> >::value), "");
}

View File

@@ -13,9 +13,19 @@
#include <type_traits>
struct A {};
class B
{
public:
B();
};
int main()
{
static_assert( std::is_trivial<int>::value, "");
static_assert(!std::is_trivial<int&>::value, "");
static_assert(!std::is_trivial<volatile int&>::value, "");
static_assert( std::is_trivial<A>::value, "");
static_assert(!std::is_trivial<B>::value, "");
}

View File

@@ -25,6 +25,12 @@ struct B
~B() {assert(i_ == 0);}
};
class C
{
public:
C();
};
int main()
{
static_assert( std::is_trivially_copyable<int>::value, "");
@@ -34,4 +40,5 @@ int main()
static_assert( std::is_trivially_copyable<const A>::value, "");
static_assert(!std::is_trivially_copyable<const A&>::value, "");
static_assert(!std::is_trivially_copyable<B>::value, "");
static_assert( std::is_trivially_copyable<C>::value, "");
}

View File

@@ -15,6 +15,8 @@
#include <bitset>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
void test_char_pointer_ctor()
{

View File

@@ -12,6 +12,8 @@
#include <bitset>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
void test_default_ctor()
{

View File

@@ -12,6 +12,8 @@
#include <bitset>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
void test_string_ctor()
{

View File

@@ -12,6 +12,8 @@
#include <bitset>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
void test_val_ctor()
{

View File

@@ -13,6 +13,8 @@
#include <cstdlib>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
std::bitset<N>
make_bitset()

View File

@@ -13,6 +13,8 @@
#include <cstdlib>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
std::bitset<N>
make_bitset()

View File

@@ -13,6 +13,8 @@
#include <cstdlib>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
std::bitset<N>
make_bitset()

View File

@@ -13,6 +13,8 @@
#include <cstdlib>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
std::bitset<N>
make_bitset()

View File

@@ -13,6 +13,8 @@
#include <cstdlib>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
std::bitset<N>
make_bitset()

View File

@@ -13,6 +13,8 @@
#include <cstdlib>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
std::bitset<N>
make_bitset()

View File

@@ -13,6 +13,8 @@
#include <cstdlib>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
std::bitset<N>
make_bitset()

View File

@@ -13,6 +13,8 @@
#include <cstdlib>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
std::bitset<N>
make_bitset()

View File

@@ -13,6 +13,8 @@
#include <cstdlib>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
std::bitset<N>
make_bitset()

View File

@@ -16,6 +16,8 @@
#include <cstdlib>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
std::bitset<N>
make_bitset()

View File

@@ -13,6 +13,8 @@
#include <cstdlib>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
std::bitset<N>
make_bitset()

View File

@@ -13,6 +13,8 @@
#include <cstdlib>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
std::bitset<N>
make_bitset()

View File

@@ -12,6 +12,8 @@
#include <bitset>
#include <cassert>
#pragma clang diagnostic ignored "-Wtautological-compare"
template <std::size_t N>
void test_reset_all()
{

Some files were not shown because too many files have changed in this diff Show More