Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
828c2bb86d | ||
![]() |
1d41df08d3 | ||
![]() |
85c01426ad | ||
![]() |
3006f595eb | ||
![]() |
84fd172cd6 | ||
![]() |
9b3829cb5b | ||
![]() |
da9c0f1fba | ||
![]() |
a9ad2ca8bd | ||
![]() |
8ffa5d58e0 | ||
![]() |
791e11cf33 | ||
![]() |
4d933b2b44 | ||
![]() |
4f598034d2 | ||
![]() |
fa06d75e8d | ||
![]() |
2644a7b3da | ||
![]() |
099084d52f | ||
![]() |
b3296ae5bc | ||
![]() |
bf6666f7a0 | ||
![]() |
541cb301a1 | ||
![]() |
13aaf422e4 | ||
![]() |
e6440c6fa2 | ||
![]() |
737a351850 | ||
![]() |
2d81f3d1f3 | ||
![]() |
464aa5cad3 | ||
![]() |
bcbbd4d14f | ||
![]() |
9a2078137f | ||
![]() |
a78264f872 | ||
![]() |
f3907e6cc0 |
@@ -20,3 +20,4 @@ D: Minor patches and bug fixes.
|
||||
N: Bjorn Reese
|
||||
E: breese@users.sourceforge.net
|
||||
D: Initial regex prototype
|
||||
|
||||
|
42
Makefile
42
Makefile
@@ -29,13 +29,41 @@ clean::
|
||||
|
||||
installhdrs::
|
||||
|
||||
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/*
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++/v1/ext
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++/v1/
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++/v1
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++/v1/*
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++/v1/ext
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++/v1/ext/*
|
||||
|
||||
install:: installhdrs $(DESTDIR)
|
||||
|
||||
|
@@ -146,6 +146,9 @@ typedef __char32_t char32_t;
|
||||
|
||||
#if !(__has_feature(cxx_auto_type))
|
||||
#define _LIBCPP_HAS_NO_AUTO_TYPE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#endif
|
||||
|
||||
@@ -188,6 +191,10 @@ namespace std {
|
||||
# define _NOEXCEPT_(x)
|
||||
#endif
|
||||
|
||||
#if __has_feature(underlying_type)
|
||||
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
|
||||
#endif
|
||||
|
||||
// end defined(__clang__)
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
@@ -285,6 +292,10 @@ template <unsigned> struct __static_assert_check {};
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define _LIBCPP_STABLE_APPLE_ABI
|
||||
#endif
|
||||
|
@@ -432,9 +432,10 @@ public:
|
||||
bool __value_constructed;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __hash_node_destructor(allocator_type& __na) _NOEXCEPT
|
||||
explicit __hash_node_destructor(allocator_type& __na,
|
||||
bool __constructed = false) _NOEXCEPT
|
||||
: __na_(__na),
|
||||
__value_constructed(false)
|
||||
__value_constructed(__constructed)
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1753,7 +1754,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
|
||||
__pn->__next_ = __cn->__next_;
|
||||
__cn->__next_ = nullptr;
|
||||
--size();
|
||||
return __node_holder(__cn, _D(__node_alloc()));
|
||||
return __node_holder(__cn, _D(__node_alloc(), true));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
|
@@ -1033,6 +1033,14 @@ struct _LIBCPP_VISIBLE hash<bitset<_Size> >
|
||||
{return __bs.__hash_code();}
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, size_t _Size>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x);
|
||||
|
||||
template <class _CharT, class _Traits, size_t _Size>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_BITSET
|
||||
|
@@ -204,7 +204,9 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
|
||||
#if __DEPRECATED
|
||||
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
|
||||
#endif
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
|
@@ -197,7 +197,9 @@ template <class Value, class Hash, class Pred, class Alloc>
|
||||
#include <__hash_table>
|
||||
#include <functional>
|
||||
|
||||
#if __DEPRECATED
|
||||
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
|
||||
#endif
|
||||
|
||||
namespace __gnu_cxx {
|
||||
|
||||
|
427
include/locale
427
include/locale
@@ -197,149 +197,202 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
locale_t __cloc();
|
||||
#endif
|
||||
|
||||
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
|
||||
typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __locale_unique_ptr;
|
||||
typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
|
||||
|
||||
// OSX has nice foo_l() functions that let you turn off use of the global
|
||||
// locale. Linux, not so much. The following functions avoid the locale when
|
||||
// that's possible and otherwise do the wrong thing. FIXME.
|
||||
#if __APPLE__
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
|
||||
template <class _Tp>
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_sprintf(char* __restrict __str,
|
||||
const char* __restrict __format, _Tp __v)
|
||||
__mb_cur_max_l(locale_t __l)
|
||||
{
|
||||
return sprintf_l(__str, 0, __format, __v);
|
||||
return MB_CUR_MAX_L(__l);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
const char* __restrict __format, _Tp __v)
|
||||
#else // _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
decltype(MB_CUR_MAX) __mb_cur_max_l(locale_t __l)
|
||||
{
|
||||
return snprintf_l(__str, __size, 0, __format, __v);
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return MB_CUR_MAX;
|
||||
}
|
||||
#endif // _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
const char* __restrict __format, int __prec, _Tp __v)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
wint_t __btowc_l(int __c, locale_t __l)
|
||||
{
|
||||
return snprintf_l(__str, __size, 0, __format, __prec, __v);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
|
||||
{
|
||||
return asprintf_l(__ret, 0, __format, __v);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
|
||||
_Tp __v)
|
||||
{
|
||||
return asprintf_l(__ret, 0, __format, __prec, __v);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_sscanf(const char* __restrict __str,
|
||||
const char* __restrict __format, _Tp* __v)
|
||||
{
|
||||
return sscanf_l(__str, 0, __format, __v);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isxdigit(int __c)
|
||||
{
|
||||
return isxdigit_l(__c, 0);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isdigit(int __c)
|
||||
{
|
||||
return isdigit_l(__c, 0);
|
||||
}
|
||||
|
||||
#else // __APPLE__
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
return btowc_l(__c, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return btowc(__c);
|
||||
#endif
|
||||
int
|
||||
__nolocale_sprintf(char* __restrict __str,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
va_list __ap;
|
||||
va_start(__ap, __format);
|
||||
int __result = vsprintf(__str, __format, __ap);
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
va_list __ap;
|
||||
va_start(__ap, __format);
|
||||
int __result = vsnprintf(__str, __size, __format, __ap);
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_asprintf(char** __ret,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
va_list __ap;
|
||||
va_start(__ap, __format);
|
||||
int __result = vasprintf(__ret, __format, __ap);
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_sscanf(const char* __restrict __str,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
va_list __ap;
|
||||
va_start(__ap, __format);
|
||||
int __result = vsscanf(__str, __format, __ap);
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isxdigit(int __c)
|
||||
{
|
||||
return isxdigit(__c);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isdigit(int __c)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __wctob_l(wint_t __c, locale_t __l)
|
||||
{
|
||||
return isdigit(__c);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return wctob_l(__c, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return wctob(__c);
|
||||
#endif
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
|
||||
size_t __len, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return wcsnrtombs_l(__dest, __src, __nwc, __len, __ps, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return wcrtomb_l(__s, __wc, __ps, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return wcrtomb(__s, __wc, __ps);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
|
||||
size_t __len, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return mbsnrtowcs_l(__dest, __src, __nms__len, __ps, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
|
||||
mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return mbrtowc_l(__pwc, __s, __n, __ps, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return mbrtowc(__pwc, __s, __n, __ps);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
|
||||
{
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return mbtowc(__pwc, __pmb, __max, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return mbtowc(__pwc, __pmb, __max);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return mbrlen_l(__s, __n, __ps, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return mbrlen(__s, __n, __ps);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
lconv *__localeconv_l(locale_t __l)
|
||||
{
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return localeconv_l(__l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return localeconv();
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
|
||||
mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return mbsrtowcs_l(__dest, __src, __len, __ps, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return mbsrtowcs(__dest, __src, __len, __ps);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __sprintf_l(char *__s, locale_t __l, const char *__format, ...) {
|
||||
va_list __va;
|
||||
va_start(__va, __format);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __res = vsprintf_l(__s, __l, __format, __va);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
int __res = vsprintf(__s, __format, __va);
|
||||
#endif
|
||||
va_end(__va);
|
||||
return __res;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
|
||||
va_list __va;
|
||||
va_start(__va, __format);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __res = vsnprintf_l(__s, __n, __l, __format, __va);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
int __res = vsnprintf(__s, __n, __format, __va);
|
||||
#endif
|
||||
va_end(__va);
|
||||
return __res;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
|
||||
va_list __va;
|
||||
va_start(__va, __format);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __res = vasprintf_l(__s, __l, __format, __va);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
int __res = vasprintf(__s, __format, __va);
|
||||
#endif
|
||||
va_end(__va);
|
||||
return __res;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
|
||||
va_list __va;
|
||||
va_start(__va, __format);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __res = vsscanf_l(__s, __l, __format, __va);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
int __res = vsscanf(__s, __format, __va);
|
||||
#endif
|
||||
va_end(__va);
|
||||
return __res;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STABLE_APPLE_ABI
|
||||
|
||||
// __scan_keyword
|
||||
// Scans [__b, __e) until a match is found in the basic_strings range
|
||||
@@ -753,7 +806,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
|
||||
int __save_errno = errno;
|
||||
errno = 0;
|
||||
char *__p2;
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
long long __ll = strtoll_l(__a, &__p2, __base, 0);
|
||||
#else
|
||||
long long __ll = strtoll_l(__a, &__p2, __base, __cloc());
|
||||
#endif
|
||||
int __current_errno = errno;
|
||||
if (__current_errno == 0)
|
||||
errno = __save_errno;
|
||||
@@ -793,7 +850,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
|
||||
int __save_errno = errno;
|
||||
errno = 0;
|
||||
char *__p2;
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
unsigned long long __ll = strtoull_l(__a, &__p2, __base, 0);
|
||||
#else
|
||||
unsigned long long __ll = strtoull_l(__a, &__p2, __base, __cloc());
|
||||
#endif
|
||||
int __current_errno = errno;
|
||||
if (__current_errno == 0)
|
||||
errno = __save_errno;
|
||||
@@ -821,7 +882,11 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
|
||||
if (__a != __a_end)
|
||||
{
|
||||
char *__p2;
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
long double __ld = strtold_l(__a, &__p2, 0);
|
||||
#else
|
||||
long double __ld = strtold_l(__a, &__p2, __cloc());
|
||||
#endif
|
||||
if (__p2 != __a_end)
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
@@ -1226,7 +1291,11 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
break;
|
||||
// Stage 3
|
||||
__a[sizeof(__a)-1] = 0;
|
||||
if (__nolocale_sscanf(__a, "%p", &__v) != 1)
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
if (sscanf_l(__a, 0, "%p", &__v) != 1)
|
||||
#else
|
||||
if (__sscanf_l(__a, __cloc(), "%p", &__v) != 1)
|
||||
#endif
|
||||
__err = ios_base::failbit;
|
||||
// EOF checked
|
||||
if (__b == __e)
|
||||
@@ -1331,13 +1400,21 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
|
||||
*__oe++ = __ct.widen(*__nf++);
|
||||
*__oe++ = __ct.widen(*__nf++);
|
||||
for (__ns = __nf; __ns < __ne; ++__ns)
|
||||
if (!__nolocale_isxdigit(*__ns))
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
if (!isxdigit_l(*__ns, 0))
|
||||
#else
|
||||
if (!isxdigit_l(*__ns, __cloc()))
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (__ns = __nf; __ns < __ne; ++__ns)
|
||||
if (!__nolocale_isdigit(*__ns))
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
if (!isdigit_l(*__ns, 0))
|
||||
#else
|
||||
if (!isdigit_l(*__ns, __cloc()))
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
if (__grouping.empty())
|
||||
@@ -1535,7 +1612,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ ((numeric_limits<long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
int __nc = sprintf_l(__nar, 0, __fmt, __v);
|
||||
#else
|
||||
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar while adding thousands separators
|
||||
@@ -1561,7 +1642,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ ((numeric_limits<long long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
int __nc = sprintf_l(__nar, 0, __fmt, __v);
|
||||
#else
|
||||
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar while adding thousands separators
|
||||
@@ -1587,7 +1672,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ ((numeric_limits<unsigned long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
int __nc = sprintf_l(__nar, 0, __fmt, __v);
|
||||
#else
|
||||
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar while adding thousands separators
|
||||
@@ -1613,7 +1702,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ ((numeric_limits<unsigned long long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
int __nc = sprintf_l(__nar, 0, __fmt, __v);
|
||||
#else
|
||||
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar while adding thousands separators
|
||||
@@ -1640,18 +1733,35 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
char* __nb = __nar;
|
||||
int __nc;
|
||||
if (__specify_precision)
|
||||
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = snprintf_l(__nb, __nbuf, 0, __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#endif
|
||||
else
|
||||
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = snprintf_l(__nb, __nbuf, 0, __fmt, __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
unique_ptr<char, void(*)(void*)> __nbh(0, free);
|
||||
if (__nc > static_cast<int>(__nbuf-1))
|
||||
{
|
||||
if (__specify_precision)
|
||||
__nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
|
||||
__v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = asprintf_l(&__nb, 0, __fmt, (int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt,
|
||||
(int)__iob.precision());
|
||||
#endif
|
||||
else
|
||||
__nc = __nolocale_asprintf(&__nb, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = asprintf_l(&__nb, 0, __fmt, __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision());
|
||||
#endif
|
||||
if (__nb == 0)
|
||||
__throw_bad_alloc();
|
||||
__nbh.reset(__nb);
|
||||
@@ -1692,18 +1802,35 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
char* __nb = __nar;
|
||||
int __nc;
|
||||
if (__specify_precision)
|
||||
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = snprintf_l(__nb, __nbuf, 0, __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#endif
|
||||
else
|
||||
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = snprintf_l(__nb, __nbuf, 0, __fmt, __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
unique_ptr<char, void(*)(void*)> __nbh(0, free);
|
||||
if (__nc > static_cast<int>(__nbuf-1))
|
||||
{
|
||||
if (__specify_precision)
|
||||
__nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
|
||||
__v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = asprintf_l(&__nb, 0, __fmt, (int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt,
|
||||
(int)__iob.precision());
|
||||
#endif
|
||||
else
|
||||
__nc = __nolocale_asprintf(&__nb, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = asprintf_l(&__nb, 0, __fmt, __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision());
|
||||
#endif
|
||||
if (__nb == 0)
|
||||
__throw_bad_alloc();
|
||||
__nbh.reset(__nb);
|
||||
@@ -1739,7 +1866,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
char __fmt[6] = "%p";
|
||||
const unsigned __nbuf = 20;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
int __nc = sprintf_l(__nar, 0, __fmt, __v);
|
||||
#else
|
||||
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar
|
||||
@@ -3423,7 +3554,11 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
|
||||
// secure memory for digit storage
|
||||
if (__n > __bs-1)
|
||||
{
|
||||
__n = __nolocale_asprintf(&__bb, "%.0Lf", __units);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__n = asprintf_l(&__bb, 0, "%.0Lf", __units);
|
||||
#else
|
||||
__n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units);
|
||||
#endif
|
||||
if (__bb == 0)
|
||||
__throw_bad_alloc();
|
||||
__hn.reset(__bb);
|
||||
|
@@ -595,6 +595,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
|
||||
#include <limits>
|
||||
#include <iterator>
|
||||
#include <__functional_base>
|
||||
#include <iosfwd>
|
||||
#if defined(_LIBCPP_NO_EXCEPTIONS)
|
||||
#include <cassert>
|
||||
#endif
|
||||
@@ -1293,7 +1294,7 @@ struct __has_allocate_hint
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#if !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
|
||||
template <class _Alloc, class _Tp, class ..._Args>
|
||||
decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Tp*>(),
|
||||
@@ -4148,6 +4149,11 @@ struct _LIBCPP_VISIBLE hash<shared_ptr<_Tp> >
|
||||
}
|
||||
};
|
||||
|
||||
template<class _CharT, class _Traits, class _Y>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p);
|
||||
|
||||
//enum class
|
||||
struct _LIBCPP_VISIBLE pointer_safety
|
||||
{
|
||||
|
167
include/string
167
include/string
@@ -1577,6 +1577,27 @@ private:
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__move_assign_alloc(const basic_string& __str)
|
||||
_NOEXCEPT_(
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value ||
|
||||
is_nothrow_move_assignable<allocator_type>::value)
|
||||
{__move_assign_alloc(__str, integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_move_assignment::value>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(const basic_string& __c, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
||||
{
|
||||
__alloc() = _VSTD::move(__c.__alloc());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(const basic_string& __c, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(allocator_type& __x, allocator_type& __y)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
@@ -2120,7 +2141,8 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
|
||||
{
|
||||
clear();
|
||||
shrink_to_fit();
|
||||
__r_ = _VSTD::move(__str.__r_);
|
||||
__r_.first() = __str.__r_.first();
|
||||
__move_assign_alloc(__str);
|
||||
__str.__zero();
|
||||
}
|
||||
|
||||
@@ -3392,7 +3414,17 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
int
|
||||
basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
|
||||
{
|
||||
return compare(0, npos, __str.data(), __str.size());
|
||||
size_t __lhs_sz = size();
|
||||
size_t __rhs_sz = __str.size();
|
||||
int __result = traits_type::compare(data(), __str.data(),
|
||||
_VSTD::min(__lhs_sz, __rhs_sz));
|
||||
if (__result != 0)
|
||||
return __result;
|
||||
if (__lhs_sz < __rhs_sz)
|
||||
return -1;
|
||||
if (__lhs_sz > __rhs_sz)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@@ -3507,24 +3539,6 @@ operator==(const _CharT* __lhs,
|
||||
return __rhs.compare(__lhs) == 0;
|
||||
}
|
||||
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator==(const char* __lhs,
|
||||
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
|
||||
{
|
||||
return strcmp(__lhs, __rhs.data()) == 0;
|
||||
}
|
||||
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator==(const wchar_t* __lhs,
|
||||
const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __rhs) _NOEXCEPT
|
||||
{
|
||||
return wcscmp(__lhs, __rhs.data()) == 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
@@ -3534,24 +3548,6 @@ operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
||||
return __lhs.compare(__rhs) == 0;
|
||||
}
|
||||
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
|
||||
const char* __rhs) _NOEXCEPT
|
||||
{
|
||||
return strcmp(__lhs.data(), __rhs) == 0;
|
||||
}
|
||||
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator==(const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __lhs,
|
||||
const wchar_t* __rhs) _NOEXCEPT
|
||||
{
|
||||
return wcscmp(__lhs.data(), __rhs) == 0;
|
||||
}
|
||||
|
||||
// operator!=
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
@@ -3589,25 +3585,7 @@ bool
|
||||
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
|
||||
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.cmpare(__rhs) < 0;
|
||||
}
|
||||
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator< (const basic_string<char, char_traits<char>, _Allocator>& __lhs,
|
||||
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
|
||||
{
|
||||
return strcmp(__lhs.data(), __rhs.data()) < 0;
|
||||
}
|
||||
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator< (const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __lhs,
|
||||
const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __rhs) _NOEXCEPT
|
||||
{
|
||||
return wcscmp(__lhs.data(), __rhs.data()) < 0;
|
||||
return __lhs.compare(__rhs) < 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
@@ -3616,25 +3594,7 @@ bool
|
||||
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
|
||||
const _CharT* __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs);
|
||||
}
|
||||
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator< (const basic_string<char, char_traits<char>, _Allocator>& __lhs,
|
||||
const char* __rhs) _NOEXCEPT
|
||||
{
|
||||
return strcmp(__lhs.data(), __rhs) < 0;
|
||||
}
|
||||
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator< (const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __lhs,
|
||||
const wchar_t* __rhs) _NOEXCEPT
|
||||
{
|
||||
return wcscmp(__lhs.data(), __rhs) < 0;
|
||||
return __lhs.compare(__rhs) < 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
@@ -3646,24 +3606,6 @@ operator< (const _CharT* __lhs,
|
||||
return __rhs.compare(__lhs) > 0;
|
||||
}
|
||||
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator< (const char* __lhs,
|
||||
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
|
||||
{
|
||||
return strcmp(__lhs, __rhs.data()) < 0;
|
||||
}
|
||||
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator< (const wchar_t* __lhs,
|
||||
const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __rhs) _NOEXCEPT
|
||||
{
|
||||
return wcscmp(__lhs, __rhs.data()) < 0;
|
||||
}
|
||||
|
||||
// operator>
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
@@ -3966,6 +3908,43 @@ hash<basic_string<_CharT, _Traits, _Allocator> >::operator()(
|
||||
return __r;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const basic_string<_CharT, _Traits, _Allocator>& __str);
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
basic_string<_CharT, _Traits, _Allocator>& __str);
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
getline(basic_istream<_CharT, _Traits>& __is,
|
||||
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
getline(basic_istream<_CharT, _Traits>& __is,
|
||||
basic_string<_CharT, _Traits, _Allocator>& __str);
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
getline(basic_istream<_CharT, _Traits>&& __is,
|
||||
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
getline(basic_istream<_CharT, _Traits>&& __is,
|
||||
basic_string<_CharT, _Traits, _Allocator>& __str);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
extern template class basic_string<char>;
|
||||
extern template class basic_string<wchar_t>;
|
||||
|
||||
|
@@ -3014,11 +3014,15 @@ struct __invoke_of
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
typename enable_if
|
||||
<
|
||||
is_move_constructible<_Tp>::value &&
|
||||
is_move_assignable<_Tp>::value
|
||||
>::type
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
|
||||
is_nothrow_move_assignable<_Tp>::value)
|
||||
{
|
||||
@@ -3092,6 +3096,26 @@ struct __is_nothrow_swappable
|
||||
|
||||
#endif // __has_feature(cxx_noexcept)
|
||||
|
||||
#ifdef _LIBCXX_UNDERLYING_TYPE
|
||||
|
||||
template <class _Tp>
|
||||
struct underlying_type
|
||||
{
|
||||
typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type;
|
||||
};
|
||||
|
||||
#else // _LIBCXX_UNDERLYING_TYPE
|
||||
|
||||
template <class _Tp, bool _Support = false>
|
||||
struct underlying_type
|
||||
{
|
||||
static_assert(_Support, "The underyling_type trait requires compiler "
|
||||
"support. Either no such support exists or "
|
||||
"libc++ does not know how to use it.");
|
||||
};
|
||||
|
||||
#endif // _LIBCXX_UNDERLYING_TYPE
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_TYPE_TRAITS
|
||||
|
@@ -560,9 +560,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;
|
||||
|
||||
|
@@ -226,9 +226,12 @@ struct _LIBCPP_VISIBLE pair
|
||||
|
||||
template<class _U1, class _U2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(const pair<_U1, _U2>& __p,
|
||||
typename enable_if<is_constructible<_T1, _U1>::value &&
|
||||
is_constructible<_T2, _U2>::value>::type* = 0)
|
||||
pair(const pair<_U1, _U2>& __p
|
||||
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
,typename enable_if<is_constructible<_T1, _U1>::value &&
|
||||
is_constructible<_T2, _U2>::value>::type* = 0
|
||||
#endif
|
||||
)
|
||||
: first(__p.first), second(__p.second) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@@ -817,6 +817,8 @@ public:
|
||||
valarray& operator=(const gslice_array<value_type>& __ga);
|
||||
valarray& operator=(const mask_array<value_type>& __ma);
|
||||
valarray& operator=(const indirect_array<value_type>& __ia);
|
||||
template <class _ValExpr>
|
||||
valarray& operator=(const __val_expr<_ValExpr>& __v);
|
||||
|
||||
// element access:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -2958,6 +2960,21 @@ valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _ValExpr>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
valarray<_Tp>&
|
||||
valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
|
||||
{
|
||||
size_t __n = __v.size();
|
||||
if (size() != __n)
|
||||
resize(__n);
|
||||
value_type* __t = __begin_;
|
||||
for (size_t __i = 0; __i != __n; ++__t, ++__i)
|
||||
*__t = result_type(__v[__i]);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__val_expr<__slice_expr<const valarray<_Tp>&> >
|
||||
|
@@ -56,6 +56,7 @@ std::get_terminate() _NOEXCEPT
|
||||
return __sync_fetch_and_add(&__terminate_handler, (std::terminate_handler)0);
|
||||
}
|
||||
|
||||
_ATTRIBUTE(noreturn)
|
||||
void
|
||||
std::terminate() _NOEXCEPT
|
||||
{
|
||||
|
313
src/locale.cpp
313
src/locale.cpp
@@ -22,101 +22,20 @@
|
||||
#include <langinfo.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
namespace {
|
||||
typedef std::remove_pointer<locale_t>::type locale_struct;
|
||||
typedef std::unique_ptr<locale_struct, decltype(&freelocale)> locale_unique_ptr;
|
||||
typedef std::unique_ptr<locale_struct, decltype(&uselocale)> locale_raii;
|
||||
}
|
||||
|
||||
namespace with_locale { namespace {
|
||||
#ifdef __APPLE__
|
||||
using ::btowc_l;
|
||||
using ::wctob_l;
|
||||
using ::wcsnrtombs_l;
|
||||
using ::wcrtomb_l;
|
||||
using ::mbsnrtowcs_l;
|
||||
using ::mbrtowc_l;
|
||||
using ::mbtowc_l;
|
||||
using ::mbrlen_l;
|
||||
using ::localeconv_l;
|
||||
using ::mbsrtowcs_l;
|
||||
|
||||
decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
mb_cur_max_l(locale_t loc)
|
||||
{
|
||||
return MB_CUR_MAX_L(loc);
|
||||
}
|
||||
#else
|
||||
template
|
||||
<typename Function, typename ...Args>
|
||||
auto using_locale(Function f, locale_t loc, Args&&... params) -> decltype(f(std::forward<Args>(params)...))
|
||||
{
|
||||
locale_raii current(uselocale(loc), uselocale);
|
||||
return f(std::forward<Args>(params)...);
|
||||
}
|
||||
|
||||
decltype(MB_CUR_MAX)
|
||||
mb_cur_max_l(locale_t loc)
|
||||
{
|
||||
locale_raii current(uselocale(loc), uselocale);
|
||||
return MB_CUR_MAX;
|
||||
}
|
||||
|
||||
wint_t btowc_l(int c, locale_t l) { return using_locale(&btowc, l, c); }
|
||||
int wctob_l(wint_t c, locale_t l) { return using_locale(&wctob, l, c); }
|
||||
size_t wcsnrtombs_l(char * dest,
|
||||
const wchar_t * * src,
|
||||
size_t nwc,
|
||||
size_t len,
|
||||
mbstate_t * ps,
|
||||
locale_t l)
|
||||
{
|
||||
return using_locale(&wcsnrtombs, l, dest, src, nwc, len, ps);
|
||||
}
|
||||
size_t wcrtomb_l(char *s, wchar_t wc, mbstate_t *ps, locale_t l)
|
||||
{
|
||||
return using_locale(&wcrtomb, l, s, wc, ps);
|
||||
}
|
||||
size_t mbsnrtowcs_l(wchar_t * dest,
|
||||
const char * * src,
|
||||
size_t nms,
|
||||
size_t len,
|
||||
mbstate_t * ps,
|
||||
locale_t l)
|
||||
{
|
||||
return using_locale(&mbsnrtowcs, l, dest, src, nms, len, ps);
|
||||
}
|
||||
size_t mbrtowc_l(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps, locale_t l)
|
||||
{
|
||||
return using_locale(&mbrtowc, l, pwc, s, n, ps);
|
||||
}
|
||||
int mbtowc_l(wchar_t * pwc, const char * pmb, size_t max, locale_t l)
|
||||
{
|
||||
return using_locale(&mbtowc, l, pwc, pmb, max);
|
||||
}
|
||||
size_t mbrlen_l(const char *s, size_t n, mbstate_t *ps, locale_t l)
|
||||
{
|
||||
return using_locale(&mbrlen, l, s, n, ps);
|
||||
}
|
||||
struct lconv *localeconv_l(locale_t l)
|
||||
{
|
||||
return using_locale(&localeconv, l);
|
||||
}
|
||||
size_t mbsrtowcs_l(wchar_t * dest,
|
||||
const char * * src,
|
||||
size_t len,
|
||||
mbstate_t * ps,
|
||||
locale_t l)
|
||||
{
|
||||
return using_locale(&mbsrtowcs, l, dest, src, len, ps);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} }
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_APPLE_STABLE_ABI
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
locale_t __cloc() {
|
||||
// In theory this could create a race condition. In practice
|
||||
// the race condition is non-fatal since it will just create
|
||||
@@ -128,7 +47,7 @@ locale_t __cloc() {
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
#endif // _LIBCPP_APPLE_STABLE_ABI
|
||||
#endif // _LIBCPP_STABLE_APPLE_ABI
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -1023,7 +942,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
#endif // _LIBCPP_APPLE_STABLE_ABI
|
||||
#endif // _LIBCPP_STABLE_APPLE_ABI
|
||||
|
||||
// template <> class ctype_byname<char>
|
||||
|
||||
@@ -1245,21 +1164,33 @@ ctype_byname<wchar_t>::do_tolower(char_type* low, const char_type* high) const
|
||||
wchar_t
|
||||
ctype_byname<wchar_t>::do_widen(char c) const
|
||||
{
|
||||
return with_locale::btowc_l(c, __l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
return btowc_l(c, __l);
|
||||
#else
|
||||
return __btowc_l(c, __l);
|
||||
#endif
|
||||
}
|
||||
|
||||
const char*
|
||||
ctype_byname<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const
|
||||
{
|
||||
for (; low != high; ++low, ++dest)
|
||||
*dest = with_locale::btowc_l(*low, __l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
*dest = btowc_l(*low, __l);
|
||||
#else
|
||||
*dest = __btowc_l(*low, __l);
|
||||
#endif
|
||||
return low;
|
||||
}
|
||||
|
||||
char
|
||||
ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const
|
||||
{
|
||||
int r = with_locale::wctob_l(c, __l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
int r = wctob_l(c, __l);
|
||||
#else
|
||||
int r = __wctob_l(c, __l);
|
||||
#endif
|
||||
return r != WEOF ? static_cast<char>(r) : dfault;
|
||||
}
|
||||
|
||||
@@ -1268,7 +1199,11 @@ ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, ch
|
||||
{
|
||||
for (; low != high; ++low, ++dest)
|
||||
{
|
||||
int r = with_locale::wctob_l(*low, __l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
int r = wctob_l(*low, __l);
|
||||
#else
|
||||
int r = __wctob_l(*low, __l);
|
||||
#endif
|
||||
*dest = r != WEOF ? static_cast<char>(r) : dfault;
|
||||
}
|
||||
return low;
|
||||
@@ -1378,13 +1313,21 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
|
||||
{
|
||||
// save state in case needed to reover to_nxt on error
|
||||
mbstate_t save_state = st;
|
||||
size_t n = with_locale::wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
size_t n = wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
|
||||
#else
|
||||
size_t n = __wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
|
||||
#endif
|
||||
if (n == size_t(-1))
|
||||
{
|
||||
// need to recover to_nxt
|
||||
for (to_nxt = to; frm != frm_nxt; ++frm)
|
||||
{
|
||||
n = with_locale::wcrtomb_l(to_nxt, *frm, &save_state, __l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
n = wcrtomb_l(to_nxt, *frm, &save_state, __l);
|
||||
#else
|
||||
n = __wcrtomb_l(to_nxt, *frm, &save_state, __l);
|
||||
#endif
|
||||
if (n == size_t(-1))
|
||||
break;
|
||||
to_nxt += n;
|
||||
@@ -1401,7 +1344,11 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
|
||||
{
|
||||
// Try to write the terminating null
|
||||
extern_type tmp[MB_LEN_MAX];
|
||||
n = with_locale::wcrtomb_l(tmp, intern_type(), &st, __l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
n = wcrtomb_l(tmp, intern_type(), &st, __l);
|
||||
#else
|
||||
n = __wcrtomb_l(tmp, intern_type(), &st, __l);
|
||||
#endif
|
||||
if (n == size_t(-1)) // on error
|
||||
return error;
|
||||
if (n > to_end-to_nxt) // is there room?
|
||||
@@ -1434,13 +1381,21 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
|
||||
{
|
||||
// save state in case needed to reover to_nxt on error
|
||||
mbstate_t save_state = st;
|
||||
size_t n = with_locale::mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
size_t n = mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
|
||||
#else
|
||||
size_t n = __mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
|
||||
#endif
|
||||
if (n == size_t(-1))
|
||||
{
|
||||
// need to recover to_nxt
|
||||
for (to_nxt = to; frm != frm_nxt; ++to_nxt)
|
||||
{
|
||||
n = with_locale::mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
n = mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
|
||||
#else
|
||||
n = __mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
|
||||
#endif
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
@@ -1468,7 +1423,11 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
|
||||
if (fend != frm_end) // set up next null terminated sequence
|
||||
{
|
||||
// Try to write the terminating null
|
||||
n = with_locale::mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
n = mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
|
||||
#else
|
||||
n = __mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
|
||||
#endif
|
||||
if (n != 0) // on error
|
||||
return error;
|
||||
++to_nxt;
|
||||
@@ -1488,7 +1447,11 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
|
||||
{
|
||||
to_nxt = to;
|
||||
extern_type tmp[MB_LEN_MAX];
|
||||
size_t n = with_locale::wcrtomb_l(tmp, intern_type(), &st, __l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
size_t n = wcrtomb_l(tmp, intern_type(), &st, __l);
|
||||
#else
|
||||
size_t n = __wcrtomb_l(tmp, intern_type(), &st, __l);
|
||||
#endif
|
||||
if (n == size_t(-1) || n == 0) // on error
|
||||
return error;
|
||||
--n;
|
||||
@@ -1502,10 +1465,18 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
|
||||
int
|
||||
codecvt<wchar_t, char, mbstate_t>::do_encoding() const _NOEXCEPT
|
||||
{
|
||||
if (with_locale::mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
if (mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
|
||||
#else
|
||||
if (__mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
|
||||
#endif
|
||||
{
|
||||
// stateless encoding
|
||||
if (__l == 0 || with_locale::mb_cur_max_l(__l) == 1) // there are no known constant length encodings
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
if (__l == 0 || MB_CUR_MAX_L(__l) == 1) // there are no known constant length encodings
|
||||
#else
|
||||
if (__l == 0 || __mb_cur_max_l(__l) == 1) // there are no known constant length encodings
|
||||
#endif
|
||||
return 1; // which take more than 1 char to form a wchar_t
|
||||
return 0;
|
||||
}
|
||||
@@ -1525,7 +1496,11 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
|
||||
int nbytes = 0;
|
||||
for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t)
|
||||
{
|
||||
size_t n = with_locale::mbrlen_l(frm, frm_end-frm, &st, __l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
size_t n = mbrlen_l(frm, frm_end-frm, &st, __l);
|
||||
#else
|
||||
size_t n = __mbrlen_l(frm, frm_end-frm, &st, __l);
|
||||
#endif
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
@@ -1547,7 +1522,11 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
|
||||
int
|
||||
codecvt<wchar_t, char, mbstate_t>::do_max_length() const _NOEXCEPT
|
||||
{
|
||||
return __l == 0 ? 1 : with_locale::mb_cur_max_l(__l);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
return __l == 0 ? 1 : MB_CUR_MAX_L(__l);
|
||||
#else
|
||||
return __l == 0 ? 1 : __mb_cur_max_l(__l);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Valid UTF ranges
|
||||
@@ -4090,13 +4069,17 @@ numpunct_byname<char>::__init(const char* nm)
|
||||
{
|
||||
if (strcmp(nm, "C") != 0)
|
||||
{
|
||||
locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
|
||||
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (loc == 0)
|
||||
throw runtime_error("numpunct_byname<char>::numpunct_byname"
|
||||
" failed to construct for " + string(nm));
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
lconv* lc = with_locale::localeconv_l(loc.get());
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
lconv* lc = localeconv_l(loc.get());
|
||||
#else
|
||||
lconv* lc = __localeconv_l(loc.get());
|
||||
#endif
|
||||
if (*lc->decimal_point)
|
||||
__decimal_point_ = *lc->decimal_point;
|
||||
if (*lc->thousands_sep)
|
||||
@@ -4129,13 +4112,17 @@ numpunct_byname<wchar_t>::__init(const char* nm)
|
||||
{
|
||||
if (strcmp(nm, "C") != 0)
|
||||
{
|
||||
locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
|
||||
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (loc == 0)
|
||||
throw runtime_error("numpunct_byname<char>::numpunct_byname"
|
||||
" failed to construct for " + string(nm));
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
lconv* lc = with_locale::localeconv_l(loc.get());
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
lconv* lc = localeconv_l(loc.get());
|
||||
#else
|
||||
lconv* lc = __localeconv_l(loc.get());
|
||||
#endif
|
||||
if (*lc->decimal_point)
|
||||
__decimal_point_ = *lc->decimal_point;
|
||||
if (*lc->thousands_sep)
|
||||
@@ -4726,7 +4713,11 @@ __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
|
||||
wchar_t* wbb = wbuf;
|
||||
mbstate_t mb = {0};
|
||||
const char* bb = buf;
|
||||
size_t i = with_locale::mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
size_t i = mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#else
|
||||
size_t i = __mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#endif
|
||||
if (i == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wchar_t* wbe = wbb + i;
|
||||
@@ -4907,7 +4898,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
be = strftime_l(buf, 100, "%A", &t, __loc_);
|
||||
mb = mbstate_t();
|
||||
const char* bb = buf;
|
||||
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#else
|
||||
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -4915,7 +4910,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
be = strftime_l(buf, 100, "%a", &t, __loc_);
|
||||
mb = mbstate_t();
|
||||
bb = buf;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#else
|
||||
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -4928,7 +4927,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
be = strftime_l(buf, 100, "%B", &t, __loc_);
|
||||
mb = mbstate_t();
|
||||
const char* bb = buf;
|
||||
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#else
|
||||
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -4936,7 +4939,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
be = strftime_l(buf, 100, "%b", &t, __loc_);
|
||||
mb = mbstate_t();
|
||||
bb = buf;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#else
|
||||
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -4947,7 +4954,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
be = strftime_l(buf, 100, "%p", &t, __loc_);
|
||||
mb = mbstate_t();
|
||||
const char* bb = buf;
|
||||
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#else
|
||||
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -4956,7 +4967,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
be = strftime_l(buf, 100, "%p", &t, __loc_);
|
||||
mb = mbstate_t();
|
||||
bb = buf;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#else
|
||||
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -5231,7 +5246,11 @@ __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
|
||||
__do_put(__nar, __ne, __tm, __fmt, __mod);
|
||||
mbstate_t mb = {0};
|
||||
const char* __nb = __nar;
|
||||
size_t j = with_locale::mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
size_t j = mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
|
||||
#else
|
||||
size_t j = __mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
__we = __wb + j;
|
||||
@@ -5480,13 +5499,17 @@ void
|
||||
moneypunct_byname<char, false>::init(const char* nm)
|
||||
{
|
||||
typedef moneypunct<char, false> base;
|
||||
locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
|
||||
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (loc == 0)
|
||||
throw runtime_error("moneypunct_byname"
|
||||
" failed to construct for " + string(nm));
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
lconv* lc = with_locale::localeconv_l(loc.get());
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
lconv* lc = localeconv_l(loc.get());
|
||||
#else
|
||||
lconv* lc = __localeconv_l(loc.get());
|
||||
#endif
|
||||
if (*lc->mon_decimal_point)
|
||||
__decimal_point_ = *lc->mon_decimal_point;
|
||||
else
|
||||
@@ -5518,13 +5541,17 @@ void
|
||||
moneypunct_byname<char, true>::init(const char* nm)
|
||||
{
|
||||
typedef moneypunct<char, true> base;
|
||||
locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
|
||||
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (loc == 0)
|
||||
throw runtime_error("moneypunct_byname"
|
||||
" failed to construct for " + string(nm));
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
lconv* lc = with_locale::localeconv_l(loc.get());
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
lconv* lc = localeconv_l(loc.get());
|
||||
#else
|
||||
lconv* lc = __localeconv_l(loc.get());
|
||||
#endif
|
||||
if (*lc->mon_decimal_point)
|
||||
__decimal_point_ = *lc->mon_decimal_point;
|
||||
else
|
||||
@@ -5556,13 +5583,17 @@ void
|
||||
moneypunct_byname<wchar_t, false>::init(const char* nm)
|
||||
{
|
||||
typedef moneypunct<wchar_t, false> base;
|
||||
locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
|
||||
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (loc == 0)
|
||||
throw runtime_error("moneypunct_byname"
|
||||
" failed to construct for " + string(nm));
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
lconv* lc = with_locale::localeconv_l(loc.get());
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
lconv* lc = localeconv_l(loc.get());
|
||||
#else
|
||||
lconv* lc = __localeconv_l(loc.get());
|
||||
#endif
|
||||
if (*lc->mon_decimal_point)
|
||||
__decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
|
||||
else
|
||||
@@ -5575,7 +5606,11 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
|
||||
wchar_t wbuf[100];
|
||||
mbstate_t mb = {0};
|
||||
const char* bb = lc->currency_symbol;
|
||||
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#else
|
||||
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wchar_t* wbe = wbuf + j;
|
||||
@@ -5590,7 +5625,11 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
|
||||
{
|
||||
mb = mbstate_t();
|
||||
bb = lc->positive_sign;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#else
|
||||
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -5602,7 +5641,11 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
|
||||
{
|
||||
mb = mbstate_t();
|
||||
bb = lc->negative_sign;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#else
|
||||
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -5617,13 +5660,17 @@ void
|
||||
moneypunct_byname<wchar_t, true>::init(const char* nm)
|
||||
{
|
||||
typedef moneypunct<wchar_t, true> base;
|
||||
locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
|
||||
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (loc == 0)
|
||||
throw runtime_error("moneypunct_byname"
|
||||
" failed to construct for " + string(nm));
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
lconv* lc = with_locale::localeconv_l(loc.get());
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
lconv* lc = localeconv_l(loc.get());
|
||||
#else
|
||||
lconv* lc = __localeconv_l(loc.get());
|
||||
#endif
|
||||
if (*lc->mon_decimal_point)
|
||||
__decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
|
||||
else
|
||||
@@ -5636,7 +5683,11 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
|
||||
wchar_t wbuf[100];
|
||||
mbstate_t mb = {0};
|
||||
const char* bb = lc->int_curr_symbol;
|
||||
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#else
|
||||
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wchar_t* wbe = wbuf + j;
|
||||
@@ -5651,7 +5702,11 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
|
||||
{
|
||||
mb = mbstate_t();
|
||||
bb = lc->positive_sign;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#else
|
||||
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -5663,7 +5718,11 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
|
||||
{
|
||||
mb = mbstate_t();
|
||||
bb = lc->negative_sign;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#else
|
||||
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#endif
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
|
@@ -32,10 +32,14 @@ int main()
|
||||
{
|
||||
mbstate_t mb = {0};
|
||||
size_t s = 0;
|
||||
tm tm = {0};
|
||||
tm *tm = 0;
|
||||
wint_t w = 0;
|
||||
::FILE* fp = 0;
|
||||
#ifdef __APPLE__
|
||||
__darwin_va_list va;
|
||||
#else
|
||||
__builtin_va_list va;
|
||||
#endif
|
||||
char* ns = 0;
|
||||
wchar_t* ws = 0;
|
||||
static_assert((std::is_same<decltype(fwprintf(fp, L"")), int>::value), "");
|
||||
@@ -88,7 +92,7 @@ int main()
|
||||
static_assert((std::is_same<decltype(wmemcpy(ws, L"", s)), wchar_t*>::value), "");
|
||||
static_assert((std::is_same<decltype(wmemmove(ws, L"", s)), wchar_t*>::value), "");
|
||||
static_assert((std::is_same<decltype(wmemset(ws, L' ', s)), wchar_t*>::value), "");
|
||||
static_assert((std::is_same<decltype(wcsftime(ws, s, L"", &tm)), size_t>::value), "");
|
||||
static_assert((std::is_same<decltype(wcsftime(ws, s, L"", tm)), size_t>::value), "");
|
||||
static_assert((std::is_same<decltype(btowc(0)), wint_t>::value), "");
|
||||
static_assert((std::is_same<decltype(wctob(w)), int>::value), "");
|
||||
static_assert((std::is_same<decltype(mbsinit(&mb)), int>::value), "");
|
||||
|
@@ -19,10 +19,12 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::filebuf f;
|
||||
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.open(temp, std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.is_open());
|
||||
assert(f.sputn("123", 3) == 3);
|
||||
f.pubseekoff(1, std::ios_base::beg);
|
||||
@@ -33,11 +35,11 @@ int main()
|
||||
assert(f2.is_open());
|
||||
assert(f2.sgetc() == '2');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wfilebuf f;
|
||||
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.open(temp, std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.is_open());
|
||||
assert(f.sputn(L"123", 3) == 3);
|
||||
f.pubseekoff(1, std::ios_base::beg);
|
||||
@@ -48,5 +50,5 @@ int main()
|
||||
assert(f2.is_open());
|
||||
assert(f2.sgetc() == L'2');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
}
|
||||
|
@@ -20,10 +20,12 @@
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::filebuf f;
|
||||
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.open(temp, std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.is_open());
|
||||
assert(f.sputn("123", 3) == 3);
|
||||
f.pubseekoff(1, std::ios_base::beg);
|
||||
@@ -34,11 +36,11 @@ int main()
|
||||
assert(f2.is_open());
|
||||
assert(f2.sgetc() == '2');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wfilebuf f;
|
||||
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.open(temp, std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.is_open());
|
||||
assert(f.sputn(L"123", 3) == 3);
|
||||
f.pubseekoff(1, std::ios_base::beg);
|
||||
@@ -49,6 +51,6 @@ int main()
|
||||
assert(f2.is_open());
|
||||
assert(f2.sgetc() == L'2');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -21,10 +21,12 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::filebuf f;
|
||||
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.open(temp, std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.is_open());
|
||||
assert(f.sputn("123", 3) == 3);
|
||||
f.pubseekoff(1, std::ios_base::beg);
|
||||
@@ -35,11 +37,11 @@ int main()
|
||||
assert(f2.is_open());
|
||||
assert(f2.sgetc() == '2');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wfilebuf f;
|
||||
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.open(temp, std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.is_open());
|
||||
assert(f.sputn(L"123", 3) == 3);
|
||||
f.pubseekoff(1, std::ios_base::beg);
|
||||
@@ -50,5 +52,5 @@ int main()
|
||||
assert(f2.is_open());
|
||||
assert(f2.sgetc() == L'2');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
}
|
||||
|
@@ -20,10 +20,12 @@
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::filebuf f;
|
||||
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.open(temp, std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.is_open());
|
||||
assert(f.sputn("123", 3) == 3);
|
||||
f.pubseekoff(1, std::ios_base::beg);
|
||||
@@ -33,11 +35,11 @@ int main()
|
||||
assert(f2.is_open());
|
||||
assert(f2.sgetc() == '2');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wfilebuf f;
|
||||
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.open(temp, std::ios_base::out | std::ios_base::in
|
||||
| std::ios_base::trunc) != 0);
|
||||
assert(f.is_open());
|
||||
assert(f.sputn(L"123", 3) == 3);
|
||||
f.pubseekoff(1, std::ios_base::beg);
|
||||
@@ -47,6 +49,6 @@ int main()
|
||||
assert(f2.is_open());
|
||||
assert(f2.sgetc() == L'2');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -16,34 +16,36 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::filebuf f;
|
||||
assert(f.open("test.dat", std::ios_base::out) != 0);
|
||||
assert(f.open(temp, std::ios_base::out) != 0);
|
||||
assert(f.is_open());
|
||||
assert(f.sputn("123", 3) == 3);
|
||||
}
|
||||
{
|
||||
std::filebuf f;
|
||||
assert(f.open("test.dat", std::ios_base::in) != 0);
|
||||
assert(f.open(temp, std::ios_base::in) != 0);
|
||||
assert(f.is_open());
|
||||
assert(f.sbumpc() == '1');
|
||||
assert(f.sbumpc() == '2');
|
||||
assert(f.sbumpc() == '3');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wfilebuf f;
|
||||
assert(f.open("test.dat", std::ios_base::out) != 0);
|
||||
assert(f.open(temp, std::ios_base::out) != 0);
|
||||
assert(f.is_open());
|
||||
assert(f.sputn(L"123", 3) == 3);
|
||||
}
|
||||
{
|
||||
std::wfilebuf f;
|
||||
assert(f.open("test.dat", std::ios_base::in) != 0);
|
||||
assert(f.open(temp, std::ios_base::in) != 0);
|
||||
assert(f.is_open());
|
||||
assert(f.sbumpc() == L'1');
|
||||
assert(f.sbumpc() == L'2');
|
||||
assert(f.sbumpc() == L'3');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
}
|
||||
|
@@ -19,11 +19,14 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp1[L_tmpnam], temp2[L_tmpnam];
|
||||
tmpnam(temp1);
|
||||
tmpnam(temp2);
|
||||
{
|
||||
std::fstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::fstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::fstream fs1(temp1, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::fstream fs2(temp2, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
fs1 << 1 << ' ' << 2;
|
||||
fs2 << 2 << ' ' << 1;
|
||||
fs1.seekg(0);
|
||||
@@ -40,13 +43,13 @@ int main()
|
||||
fs2 >> i;
|
||||
assert(i == 2);
|
||||
}
|
||||
std::remove("test1.dat");
|
||||
std::remove("test2.dat");
|
||||
std::remove(temp1);
|
||||
std::remove(temp2);
|
||||
{
|
||||
std::wfstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::wfstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::wfstream fs1(temp1, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::wfstream fs2(temp2, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
fs1 << 1 << ' ' << 2;
|
||||
fs2 << 2 << ' ' << 1;
|
||||
fs1.seekg(0);
|
||||
@@ -63,6 +66,6 @@ int main()
|
||||
fs2 >> i;
|
||||
assert(i == 2);
|
||||
}
|
||||
std::remove("test1.dat");
|
||||
std::remove("test2.dat");
|
||||
std::remove(temp1);
|
||||
std::remove(temp2);
|
||||
}
|
||||
|
@@ -20,9 +20,11 @@
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::fstream fso("test.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::fstream fso(temp, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::fstream fs;
|
||||
fs = move(fso);
|
||||
double x = 0;
|
||||
@@ -31,10 +33,10 @@ int main()
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
std::remove("test.dat");
|
||||
std::remove(temp);
|
||||
{
|
||||
std::wfstream fso("test.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::wfstream fs;
|
||||
fs = move(fso);
|
||||
double x = 0;
|
||||
@@ -43,6 +45,6 @@ int main()
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
std::remove("test.dat");
|
||||
std::remove(temp);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -20,11 +20,14 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp1[L_tmpnam], temp2[L_tmpnam];
|
||||
tmpnam(temp1);
|
||||
tmpnam(temp2);
|
||||
{
|
||||
std::fstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::fstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::fstream fs1(temp1, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::fstream fs2(temp2, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
fs1 << 1 << ' ' << 2;
|
||||
fs2 << 2 << ' ' << 1;
|
||||
fs1.seekg(0);
|
||||
@@ -41,13 +44,13 @@ int main()
|
||||
fs2 >> i;
|
||||
assert(i == 2);
|
||||
}
|
||||
std::remove("test1.dat");
|
||||
std::remove("test2.dat");
|
||||
std::remove(temp1);
|
||||
std::remove(temp2);
|
||||
{
|
||||
std::wfstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::wfstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::wfstream fs1(temp1, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::wfstream fs2(temp2, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
fs1 << 1 << ' ' << 2;
|
||||
fs2 << 2 << ' ' << 1;
|
||||
fs1.seekg(0);
|
||||
@@ -64,6 +67,6 @@ int main()
|
||||
fs2 >> i;
|
||||
assert(i == 2);
|
||||
}
|
||||
std::remove("test1.dat");
|
||||
std::remove("test2.dat");
|
||||
std::remove(temp1);
|
||||
std::remove(temp2);
|
||||
}
|
||||
|
@@ -20,9 +20,11 @@
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::fstream fso("test.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::fstream fso(temp, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::fstream fs = move(fso);
|
||||
double x = 0;
|
||||
fs << 3.25;
|
||||
@@ -32,8 +34,8 @@ int main()
|
||||
}
|
||||
std::remove("test.dat");
|
||||
{
|
||||
std::wfstream fso("test.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::wfstream fs = move(fso);
|
||||
double x = 0;
|
||||
fs << 3.25;
|
||||
@@ -41,6 +43,6 @@ int main()
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
std::remove("test.dat");
|
||||
std::remove(temp);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -19,24 +19,26 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::fstream fs("test.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::fstream fs(temp, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
double x = 0;
|
||||
fs << 3.25;
|
||||
fs.seekg(0);
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
std::remove("test.dat");
|
||||
std::remove(temp);
|
||||
{
|
||||
std::wfstream fs("test.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
std::wfstream fs(temp, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
double x = 0;
|
||||
fs << 3.25;
|
||||
fs.seekg(0);
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
std::remove("test.dat");
|
||||
std::remove(temp);
|
||||
}
|
||||
|
@@ -19,8 +19,10 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::fstream fs(std::string("test.dat"),
|
||||
std::fstream fs(std::string(temp),
|
||||
std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
double x = 0;
|
||||
@@ -29,9 +31,9 @@ int main()
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
std::remove("test.dat");
|
||||
std::remove(temp);
|
||||
{
|
||||
std::wfstream fs(std::string("test.dat"),
|
||||
std::wfstream fs(std::string(temp),
|
||||
std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
double x = 0;
|
||||
@@ -40,5 +42,5 @@ int main()
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
std::remove("test.dat");
|
||||
std::remove(temp);
|
||||
}
|
||||
|
@@ -19,22 +19,24 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::fstream fs;
|
||||
assert(!fs.is_open());
|
||||
fs.open("test.dat", std::ios_base::out);
|
||||
fs.open(temp, std::ios_base::out);
|
||||
assert(fs.is_open());
|
||||
fs.close();
|
||||
assert(!fs.is_open());
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wfstream fs;
|
||||
assert(!fs.is_open());
|
||||
fs.open("test.dat", std::ios_base::out);
|
||||
fs.open(temp, std::ios_base::out);
|
||||
assert(fs.is_open());
|
||||
fs.close();
|
||||
assert(!fs.is_open());
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
}
|
||||
|
@@ -19,11 +19,13 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::fstream fs;
|
||||
assert(!fs.is_open());
|
||||
fs.open("test.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
fs.open(temp, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
assert(fs.is_open());
|
||||
double x = 0;
|
||||
fs << 3.25;
|
||||
@@ -31,12 +33,12 @@ int main()
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
std::remove("test.dat");
|
||||
std::remove(temp);
|
||||
{
|
||||
std::wfstream fs;
|
||||
assert(!fs.is_open());
|
||||
fs.open("test.dat", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
fs.open(temp, std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
assert(fs.is_open());
|
||||
double x = 0;
|
||||
fs << 3.25;
|
||||
@@ -44,5 +46,5 @@ int main()
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
std::remove("test.dat");
|
||||
std::remove(temp);
|
||||
}
|
||||
|
@@ -19,11 +19,13 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::fstream fs;
|
||||
assert(!fs.is_open());
|
||||
fs.open(std::string("test.dat"), std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
fs.open(std::string(temp), std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
assert(fs.is_open());
|
||||
double x = 0;
|
||||
fs << 3.25;
|
||||
@@ -31,12 +33,12 @@ int main()
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
std::remove("test.dat");
|
||||
std::remove(temp);
|
||||
{
|
||||
std::wfstream fs;
|
||||
assert(!fs.is_open());
|
||||
fs.open(std::string("test.dat"), std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
fs.open(std::string(temp), std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc);
|
||||
assert(fs.is_open());
|
||||
double x = 0;
|
||||
fs << 3.25;
|
||||
@@ -44,5 +46,5 @@ int main()
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
std::remove("test.dat");
|
||||
std::remove(temp);
|
||||
}
|
||||
|
@@ -19,9 +19,12 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp1[L_tmpnam], temp2[L_tmpnam];
|
||||
tmpnam(temp1);
|
||||
tmpnam(temp2);
|
||||
{
|
||||
std::ofstream fs1("test1.dat");
|
||||
std::ofstream fs2("test2.dat");
|
||||
std::ofstream fs1(temp1);
|
||||
std::ofstream fs2(temp2);
|
||||
fs1 << 3.25;
|
||||
fs2 << 4.5;
|
||||
fs1.swap(fs2);
|
||||
@@ -29,26 +32,26 @@ int main()
|
||||
fs2 << ' ' << 4.5;
|
||||
}
|
||||
{
|
||||
std::ifstream fs("test1.dat");
|
||||
std::ifstream fs(temp1);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
fs >> x;
|
||||
assert(x == 4.5);
|
||||
}
|
||||
remove("test1.dat");
|
||||
remove(temp1);
|
||||
{
|
||||
std::ifstream fs("test2.dat");
|
||||
std::ifstream fs(temp2);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 4.5);
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
remove("test2.dat");
|
||||
remove(temp2);
|
||||
{
|
||||
std::wofstream fs1("test1.dat");
|
||||
std::wofstream fs2("test2.dat");
|
||||
std::wofstream fs1(temp1);
|
||||
std::wofstream fs2(temp2);
|
||||
fs1 << 3.25;
|
||||
fs2 << 4.5;
|
||||
fs1.swap(fs2);
|
||||
@@ -56,21 +59,21 @@ int main()
|
||||
fs2 << ' ' << 4.5;
|
||||
}
|
||||
{
|
||||
std::wifstream fs("test1.dat");
|
||||
std::wifstream fs(temp1);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
fs >> x;
|
||||
assert(x == 4.5);
|
||||
}
|
||||
remove("test1.dat");
|
||||
remove(temp1);
|
||||
{
|
||||
std::wifstream fs("test2.dat");
|
||||
std::wifstream fs(temp2);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 4.5);
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
remove("test2.dat");
|
||||
remove(temp2);
|
||||
}
|
||||
|
@@ -20,31 +20,33 @@
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::ofstream fso("test.dat");
|
||||
std::ofstream fso(temp);
|
||||
std::ofstream fs;
|
||||
fs = move(fso);
|
||||
fs << 3.25;
|
||||
}
|
||||
{
|
||||
std::ifstream fs("test.dat");
|
||||
std::ifstream fs(temp);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wofstream fso("test.dat");
|
||||
std::wofstream fso(temp);
|
||||
std::wofstream fs;
|
||||
fs = move(fso);
|
||||
fs << 3.25;
|
||||
}
|
||||
{
|
||||
std::wifstream fs("test.dat");
|
||||
std::wifstream fs(temp);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -20,9 +20,12 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp1[L_tmpnam], temp2[L_tmpnam];
|
||||
tmpnam(temp1);
|
||||
tmpnam(temp2);
|
||||
{
|
||||
std::ofstream fs1("test1.dat");
|
||||
std::ofstream fs2("test2.dat");
|
||||
std::ofstream fs1(temp1);
|
||||
std::ofstream fs2(temp2);
|
||||
fs1 << 3.25;
|
||||
fs2 << 4.5;
|
||||
swap(fs1, fs2);
|
||||
@@ -30,26 +33,26 @@ int main()
|
||||
fs2 << ' ' << 4.5;
|
||||
}
|
||||
{
|
||||
std::ifstream fs("test1.dat");
|
||||
std::ifstream fs(temp1);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
fs >> x;
|
||||
assert(x == 4.5);
|
||||
}
|
||||
remove("test1.dat");
|
||||
remove(temp1);
|
||||
{
|
||||
std::ifstream fs("test2.dat");
|
||||
std::ifstream fs(temp2);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 4.5);
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
remove("test2.dat");
|
||||
remove(temp2);
|
||||
{
|
||||
std::wofstream fs1("test1.dat");
|
||||
std::wofstream fs2("test2.dat");
|
||||
std::wofstream fs1(temp1);
|
||||
std::wofstream fs2(temp2);
|
||||
fs1 << 3.25;
|
||||
fs2 << 4.5;
|
||||
swap(fs1, fs2);
|
||||
@@ -57,21 +60,21 @@ int main()
|
||||
fs2 << ' ' << 4.5;
|
||||
}
|
||||
{
|
||||
std::wifstream fs("test1.dat");
|
||||
std::wifstream fs(temp1);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
fs >> x;
|
||||
assert(x == 4.5);
|
||||
}
|
||||
remove("test1.dat");
|
||||
remove(temp1);
|
||||
{
|
||||
std::wifstream fs("test2.dat");
|
||||
std::wifstream fs(temp2);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 4.5);
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
remove("test2.dat");
|
||||
remove(temp2);
|
||||
}
|
||||
|
@@ -20,29 +20,31 @@
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::ofstream fso("test.dat");
|
||||
std::ofstream fso(temp);
|
||||
std::ofstream fs = move(fso);
|
||||
fs << 3.25;
|
||||
}
|
||||
{
|
||||
std::ifstream fs("test.dat");
|
||||
std::ifstream fs(temp);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wofstream fso("test.dat");
|
||||
std::wofstream fso(temp);
|
||||
std::wofstream fs = move(fso);
|
||||
fs << 3.25;
|
||||
}
|
||||
{
|
||||
std::wifstream fs("test.dat");
|
||||
std::wifstream fs(temp);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -19,26 +19,28 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::ofstream fs("test.dat");
|
||||
std::ofstream fs(temp);
|
||||
fs << 3.25;
|
||||
}
|
||||
{
|
||||
std::ifstream fs("test.dat");
|
||||
std::ifstream fs(temp);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wofstream fs("test.dat");
|
||||
std::wofstream fs(temp);
|
||||
fs << 3.25;
|
||||
}
|
||||
{
|
||||
std::wifstream fs("test.dat");
|
||||
std::wifstream fs(temp);
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
}
|
||||
|
@@ -19,26 +19,28 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::ofstream fs(std::string("test.dat"));
|
||||
std::ofstream fs((std::string(temp)));
|
||||
fs << 3.25;
|
||||
}
|
||||
{
|
||||
std::ifstream fs(std::string("test.dat"));
|
||||
std::ifstream fs((std::string(temp)));
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wofstream fs(std::string("test.dat"));
|
||||
std::wofstream fs((std::string(temp)));
|
||||
fs << 3.25;
|
||||
}
|
||||
{
|
||||
std::wifstream fs(std::string("test.dat"));
|
||||
std::wifstream fs((std::string(temp)));
|
||||
double x = 0;
|
||||
fs >> x;
|
||||
assert(x == 3.25);
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
}
|
||||
|
@@ -19,22 +19,24 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::ofstream fs;
|
||||
assert(!fs.is_open());
|
||||
fs.open("test.dat");
|
||||
fs.open(temp);
|
||||
assert(fs.is_open());
|
||||
fs.close();
|
||||
assert(!fs.is_open());
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wofstream fs;
|
||||
assert(!fs.is_open());
|
||||
fs.open("test.dat");
|
||||
fs.open(temp);
|
||||
assert(fs.is_open());
|
||||
fs.close();
|
||||
assert(!fs.is_open());
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
}
|
||||
|
@@ -19,38 +19,40 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::ofstream fs;
|
||||
assert(!fs.is_open());
|
||||
char c = 'a';
|
||||
fs << c;
|
||||
assert(fs.fail());
|
||||
fs.open("test.dat");
|
||||
fs.open(temp);
|
||||
assert(fs.is_open());
|
||||
fs << c;
|
||||
}
|
||||
{
|
||||
std::ifstream fs("test.dat");
|
||||
std::ifstream fs(temp);
|
||||
char c = 0;
|
||||
fs >> c;
|
||||
assert(c == 'a');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wofstream fs;
|
||||
assert(!fs.is_open());
|
||||
wchar_t c = L'a';
|
||||
fs << c;
|
||||
assert(fs.fail());
|
||||
fs.open("test.dat");
|
||||
fs.open(temp);
|
||||
assert(fs.is_open());
|
||||
fs << c;
|
||||
}
|
||||
{
|
||||
std::wifstream fs("test.dat");
|
||||
std::wifstream fs(temp);
|
||||
wchar_t c = 0;
|
||||
fs >> c;
|
||||
assert(c == L'a');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
}
|
||||
|
@@ -19,38 +19,40 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::ofstream fs;
|
||||
assert(!fs.is_open());
|
||||
char c = 'a';
|
||||
fs << c;
|
||||
assert(fs.fail());
|
||||
fs.open(std::string("test.dat"));
|
||||
fs.open(std::string(temp));
|
||||
assert(fs.is_open());
|
||||
fs << c;
|
||||
}
|
||||
{
|
||||
std::ifstream fs("test.dat");
|
||||
std::ifstream fs(temp);
|
||||
char c = 0;
|
||||
fs >> c;
|
||||
assert(c == 'a');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wofstream fs;
|
||||
assert(!fs.is_open());
|
||||
wchar_t c = L'a';
|
||||
fs << c;
|
||||
assert(fs.fail());
|
||||
fs.open(std::string("test.dat"));
|
||||
fs.open(std::string(temp));
|
||||
assert(fs.is_open());
|
||||
fs << c;
|
||||
}
|
||||
{
|
||||
std::wifstream fs("test.dat");
|
||||
std::wifstream fs(temp);
|
||||
wchar_t c = 0;
|
||||
fs >> c;
|
||||
assert(c == L'a');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
}
|
||||
|
@@ -19,16 +19,18 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
{
|
||||
std::ofstream fs("test.dat");
|
||||
std::ofstream fs(temp);
|
||||
std::filebuf* fb = fs.rdbuf();
|
||||
assert(fb->sputc('r') == 'r');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
{
|
||||
std::wofstream fs("test.dat");
|
||||
std::wofstream fs(temp);
|
||||
std::wfilebuf* fb = fs.rdbuf();
|
||||
assert(fb->sputc(L'r') == L'r');
|
||||
}
|
||||
remove("test.dat");
|
||||
remove(temp);
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ class A
|
||||
int data_;
|
||||
public:
|
||||
explicit A(int data) : data_(data) {}
|
||||
virtual ~A() {}
|
||||
virtual ~A() _NOEXCEPT {}
|
||||
|
||||
friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;}
|
||||
};
|
||||
|
@@ -32,10 +32,14 @@ int main()
|
||||
{
|
||||
std::mbstate_t mb = {0};
|
||||
std::size_t s = 0;
|
||||
std::tm tm = {0};
|
||||
std::tm *tm = 0;
|
||||
std::wint_t w = 0;
|
||||
::FILE* fp = 0;
|
||||
#ifdef __APPLE__
|
||||
__darwin_va_list va;
|
||||
#else
|
||||
__builtin_va_list va;
|
||||
#endif
|
||||
char* ns = 0;
|
||||
wchar_t* ws = 0;
|
||||
static_assert((std::is_same<decltype(std::fwprintf(fp, L"")), int>::value), "");
|
||||
@@ -93,7 +97,7 @@ int main()
|
||||
static_assert((std::is_same<decltype(std::wmemcpy(ws, L"", s)), wchar_t*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::wmemmove(ws, L"", s)), wchar_t*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::wmemset(ws, L' ', s)), wchar_t*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::wcsftime(ws, s, L"", &tm)), std::size_t>::value), "");
|
||||
static_assert((std::is_same<decltype(std::wcsftime(ws, s, L"", tm)), std::size_t>::value), "");
|
||||
static_assert((std::is_same<decltype(std::btowc(0)), wint_t>::value), "");
|
||||
static_assert((std::is_same<decltype(std::wctob(w)), int>::value), "");
|
||||
static_assert((std::is_same<decltype(std::mbsinit(&mb)), int>::value), "");
|
||||
|
@@ -42,6 +42,7 @@ int A::count = 0;
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
std::shared_ptr<A> pA(new A);
|
||||
A* ptrA = pA.get();
|
||||
@@ -118,4 +119,5 @@ int main()
|
||||
}
|
||||
assert(B::count == 0);
|
||||
assert(A::count == 0);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@ int A::count = 0;
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
std::shared_ptr<A> pA(new A);
|
||||
A* ptrA = pA.get();
|
||||
@@ -118,4 +119,5 @@ int main()
|
||||
}
|
||||
assert(B::count == 0);
|
||||
assert(A::count == 0);
|
||||
#endif // _LIBCXX_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -85,9 +85,17 @@ int main()
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
assert(A::count == 1);
|
||||
assert(B::count == 1);
|
||||
assert(ptr.get() == raw_ptr);
|
||||
#else
|
||||
// Without rvalue references, ptr got copied into
|
||||
// the shared_ptr destructor and the copy was
|
||||
// destroyed during unwinding.
|
||||
assert(A::count == 0);
|
||||
assert(B::count == 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
assert(A::count == 0);
|
||||
|
@@ -77,9 +77,15 @@ int main()
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
assert(A::count == 1);
|
||||
assert(B::count == 1);
|
||||
assert(ptr.get() == raw_ptr);
|
||||
#else
|
||||
assert(A::count == 0);
|
||||
assert(B::count == 0);
|
||||
assert(ptr.get() == 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
assert(A::count == 0);
|
||||
|
@@ -12,8 +12,22 @@
|
||||
// underlying_type
|
||||
|
||||
#include <type_traits>
|
||||
#include <climits>
|
||||
|
||||
int main()
|
||||
{
|
||||
#error underlying_type is not implemented
|
||||
enum E { V = INT_MIN };
|
||||
enum F { W = UINT_MAX };
|
||||
|
||||
static_assert((std::is_same<std::underlying_type<E>::type, int>::value),
|
||||
"E has the wrong underlying type");
|
||||
static_assert((std::is_same<std::underlying_type<F>::type, unsigned>::value),
|
||||
"F has the wrong underlying type");
|
||||
|
||||
#if __has_feature(cxx_strong_enums)
|
||||
enum G : char { };
|
||||
|
||||
static_assert((std::is_same<std::underlying_type<G>::type, char>::value),
|
||||
"G has the wrong underlying type");
|
||||
#endif // __has_feature(cxx_strong_enums)
|
||||
}
|
||||
|
159
trunk/CMakeLists.txt
Normal file
159
trunk/CMakeLists.txt
Normal file
@@ -0,0 +1,159 @@
|
||||
# See www/CMake.html for instructions on how to build libcxx with CMake.
|
||||
|
||||
#===============================================================================
|
||||
# Setup Project
|
||||
#===============================================================================
|
||||
|
||||
project(libcxx CXX C)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION trunk-svn)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
|
||||
|
||||
# Add path for custom modules
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_MODULE_PATH}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
|
||||
)
|
||||
|
||||
# Require out of source build.
|
||||
include(MacroEnsureOutOfSourceBuild)
|
||||
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
|
||||
"${PROJECT_NAME} requires an out of source build. Please create a separate
|
||||
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
# Setup CMake Options
|
||||
#===============================================================================
|
||||
|
||||
# Define options.
|
||||
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
|
||||
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
|
||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
||||
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
|
||||
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
||||
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
|
||||
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
||||
|
||||
#===============================================================================
|
||||
# Configure System
|
||||
#===============================================================================
|
||||
|
||||
# Get triples.
|
||||
include(GetTriple)
|
||||
get_host_triple(LIBCXX_HOST_TRIPLE
|
||||
LIBCXX_HOST_ARCH
|
||||
LIBCXX_HOST_VENDOR
|
||||
LIBCXX_HOST_OS
|
||||
)
|
||||
set(LIBCXX_HOST_TRIPLE ${LIBCXX_HOST_TRIPLE} CACHE STRING "Host triple.")
|
||||
get_target_triple(LIBCXX_TARGET_TRIPLE
|
||||
LIBCXX_TARGET_ARCH
|
||||
LIBCXX_TARGET_VENDOR
|
||||
LIBCXX_TARGET_OS
|
||||
)
|
||||
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
|
||||
|
||||
# Configure compiler.
|
||||
include(config-ix)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Compiler Flags
|
||||
#===============================================================================
|
||||
|
||||
# Get required flags.
|
||||
# On all systems the system c++ standard library headers need to be excluded.
|
||||
if (MSVC)
|
||||
# MSVC only has -X, which disables all default includes; including the crt.
|
||||
# Thus, we do nothing and hope we don't accidentally include any of the C++
|
||||
# headers.
|
||||
else()
|
||||
if (LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||
set(LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++)
|
||||
endif()
|
||||
if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro(append_if list condition var)
|
||||
if (${condition})
|
||||
list(APPEND ${list} ${var})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Get warning flags
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
|
||||
if (LIBCXX_ENABLE_WERROR)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
|
||||
endif()
|
||||
if (LIBCXX_ENABLE_PEDANTIC)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
||||
endif()
|
||||
|
||||
# Get feature flags.
|
||||
# Exceptions
|
||||
if (LIBCXX_ENABLE_EXCEPTIONS)
|
||||
# Catches C++ exceptions only and tells the compiler to assume that extern C
|
||||
# functions never throw a C++ exception.
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
|
||||
else()
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
|
||||
endif()
|
||||
# RTTI
|
||||
if (NOT LIBCXX_ENABLE_RTTI)
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_RTTI)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
|
||||
endif()
|
||||
# Assert
|
||||
if (LLVM_ENABLE_ASSERTIONS)
|
||||
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
||||
if (NOT MSVC)
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
|
||||
endif()
|
||||
# On Release builds cmake automatically defines NDEBUG, so we
|
||||
# explicitly undefine it:
|
||||
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -UNDEBUG)
|
||||
endif()
|
||||
else()
|
||||
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# This is the _ONLY_ place where add_definitions is called.
|
||||
add_definitions(
|
||||
${LIBCXX_CXX_REQUIRED_FLAGS}
|
||||
${LIBCXX_CXX_WARNING_FLAGS}
|
||||
${LIBCXX_CXX_FEATURE_FLAGS}
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Source Code
|
||||
#===============================================================================
|
||||
|
||||
include_directories(include)
|
||||
|
||||
# Add source code. This also contains all of the logic for deciding linker flags
|
||||
# soname, etc...
|
||||
add_subdirectory(lib)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Tests
|
||||
#===============================================================================
|
||||
|
||||
add_subdirectory(test)
|
41
trunk/CREDITS.TXT
Normal file
41
trunk/CREDITS.TXT
Normal file
@@ -0,0 +1,41 @@
|
||||
This file is a partial list of people who have contributed to the LLVM/libc++
|
||||
project. If you have contributed a patch or made some other contribution to
|
||||
LLVM/libc++, please submit a patch to this file to add yourself, and it will be
|
||||
done!
|
||||
|
||||
The list is sorted by surname and formatted to allow easy grepping and
|
||||
beautification by scripts. The fields are: name (N), email (E), web-address
|
||||
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
|
||||
(S).
|
||||
|
||||
N: Howard Hinnant
|
||||
E: hhinnant@apple.com
|
||||
D: Architect and primary author of libc++
|
||||
|
||||
N: Marshall Clow
|
||||
E: marshall@idio.com
|
||||
E: mclow@qualcomm.com
|
||||
D: Minor patches and bug fixes.
|
||||
|
||||
N: Bjorn Reese
|
||||
E: breese@users.sourceforge.net
|
||||
D: Initial regex prototype
|
||||
|
||||
N: David Chisnall
|
||||
E: theraven at theravensnest dot org
|
||||
D: FreeBSD port and libcxxrt support.
|
||||
|
||||
N: Ruben Van Boxem
|
||||
E: vanboxem dot ruben at gmail dot com
|
||||
D: Initial Windows patches.
|
||||
|
||||
N: Arvid Picciani
|
||||
E: aep at exys dot org
|
||||
D: Minor patches and musl port.
|
||||
|
||||
N: Craig Silverstein
|
||||
E: csilvers@google.com
|
||||
D: Implemented Cityhash as the string hash function on 64-bit machines
|
||||
|
||||
N: Google Inc.
|
||||
D: Copyright owner and contributor of the CityHash algorithm
|
76
trunk/LICENSE.TXT
Normal file
76
trunk/LICENSE.TXT
Normal file
@@ -0,0 +1,76 @@
|
||||
==============================================================================
|
||||
libc++ License
|
||||
==============================================================================
|
||||
|
||||
The libc++ library is dual licensed under both the University of Illinois
|
||||
"BSD-Like" license and the MIT license. As a user of this code you may choose
|
||||
to use it under either license. As a contributor, you agree to allow your code
|
||||
to be used under both.
|
||||
|
||||
Full text of the relevant licenses is included below.
|
||||
|
||||
==============================================================================
|
||||
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
|
||||
LLVM Team
|
||||
|
||||
University of Illinois at Urbana-Champaign
|
||||
|
||||
http://llvm.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the LLVM Team, University of Illinois at
|
||||
Urbana-Champaign, nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this Software without specific
|
||||
prior written permission.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
61
trunk/Makefile
Normal file
61
trunk/Makefile
Normal file
@@ -0,0 +1,61 @@
|
||||
##
|
||||
# libcpp Makefile
|
||||
##
|
||||
|
||||
SRCDIRS = .
|
||||
DESTDIR = $(DSTROOT)
|
||||
|
||||
OBJROOT=.
|
||||
SYMROOT=.
|
||||
export TRIPLE=-apple-
|
||||
|
||||
ifeq (,$(RC_INDIGO))
|
||||
INSTALL_PREFIX=""
|
||||
else
|
||||
INSTALL_PREFIX="$(SDKROOT)"
|
||||
endif
|
||||
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
|
||||
|
||||
.PHONY: help installsrc clean installhdrs do-installhdrs install
|
||||
|
||||
help::
|
||||
echo Use make install DSTROOT=<destination>
|
||||
|
||||
installsrc:: $(SRCROOT)
|
||||
|
||||
ditto $(SRCDIRS)/include $(SRCROOT)/include
|
||||
ditto $(SRCDIRS)/lib $(SRCROOT)/lib
|
||||
ditto $(SRCDIRS)/src $(SRCROOT)/src
|
||||
ditto $(SRCDIRS)/Makefile $(SRCROOT)/Makefile
|
||||
|
||||
clean::
|
||||
|
||||
installhdrs::
|
||||
|
||||
$(MAKE) HEADER_DIR=$(INSTALL_DIR)/usr/include do-installhdrs
|
||||
$(MAKE) HEADER_DIR=$(INSTALL_DIR)/usr/lib do-installhdrs
|
||||
$(MAKE) HEADER_DIR=$(INSTALL_DIR)/usr/clang-ide/lib do-installhdrs
|
||||
$(MAKE) HEADER_DIR=$(INSTALL_DIR)/Developer/usr/lib do-installhdrs
|
||||
$(MAKE) HEADER_DIR=$(INSTALL_DIR)/Developer/Platforms/iPhoneOS.platform/usr/lib do-installhdrs
|
||||
|
||||
# The do-installhdrs target is also used by clang's runtime/libcxx makefile.
|
||||
do-installhdrs:
|
||||
mkdir -p $(HEADER_DIR)/c++/v1/ext
|
||||
rsync -r --exclude=".*" --exclude="support" $(SRCDIRS)/include/* \
|
||||
$(HEADER_DIR)/c++/v1/
|
||||
chown -R root:wheel $(HEADER_DIR)/c++
|
||||
chmod 755 $(HEADER_DIR)/c++/v1
|
||||
chmod 644 $(HEADER_DIR)/c++/v1/*
|
||||
chmod 755 $(HEADER_DIR)/c++/v1/ext
|
||||
chmod 644 $(HEADER_DIR)/c++/v1/ext/*
|
||||
|
||||
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 $(INSTALL_DIR)/usr/lib
|
||||
strip -S -o $(INSTALL_DIR)/usr/lib/libc++.1.dylib \
|
||||
$(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd $(INSTALL_DIR)/usr/lib && ln -s libc++.1.dylib libc++.dylib
|
53
trunk/cmake/Modules/GetTriple.cmake
Normal file
53
trunk/cmake/Modules/GetTriple.cmake
Normal file
@@ -0,0 +1,53 @@
|
||||
# Define functions to get the host and target triple.
|
||||
|
||||
function(get_host_triple out out_arch out_vendor out_os)
|
||||
# Get the architecture.
|
||||
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
||||
if (arch STREQUAL "x86")
|
||||
set(arch "i686")
|
||||
endif()
|
||||
# Get the vendor.
|
||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set(vendor "apple")
|
||||
else()
|
||||
set(vendor "pc")
|
||||
endif()
|
||||
# Get os.
|
||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(os "win32")
|
||||
else()
|
||||
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} os)
|
||||
endif()
|
||||
set(triple "${arch}-${vendor}-${os}")
|
||||
set(${out} ${triple} PARENT_SCOPE)
|
||||
set(${out_arch} ${arch} PARENT_SCOPE)
|
||||
set(${out_vendor} ${vendor} PARENT_SCOPE)
|
||||
set(${out_os} ${os} PARENT_SCOPE)
|
||||
message(STATUS "Host triple: ${triple}")
|
||||
endfunction()
|
||||
|
||||
function(get_target_triple out out_arch out_vendor out_os)
|
||||
# Get the architecture.
|
||||
set(arch ${CMAKE_SYSTEM_PROCESSOR})
|
||||
if (arch STREQUAL "x86")
|
||||
set(arch "i686")
|
||||
endif()
|
||||
# Get the vendor.
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set(vendor "apple")
|
||||
else()
|
||||
set(vendor "pc")
|
||||
endif()
|
||||
# Get os.
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(os "win32")
|
||||
else()
|
||||
string(TOLOWER ${CMAKE_SYSTEM_NAME} os)
|
||||
endif()
|
||||
set(triple "${arch}-${vendor}-${os}")
|
||||
set(${out} ${triple} PARENT_SCOPE)
|
||||
set(${out_arch} ${arch} PARENT_SCOPE)
|
||||
set(${out_vendor} ${vendor} PARENT_SCOPE)
|
||||
set(${out_os} ${os} PARENT_SCOPE)
|
||||
message(STATUS "Target triple: ${triple}")
|
||||
endfunction()
|
18
trunk/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
Normal file
18
trunk/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
|
||||
|
||||
macro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage )
|
||||
|
||||
string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource )
|
||||
if( _insource )
|
||||
message( SEND_ERROR "${_errorMessage}" )
|
||||
message( FATAL_ERROR
|
||||
"In-source builds are not allowed.
|
||||
CMake would overwrite the makefiles distributed with Compiler-RT.
|
||||
Please create a directory and run cmake from there, passing the path
|
||||
to this source directory as the last argument.
|
||||
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
|
||||
Please delete them."
|
||||
)
|
||||
endif( _insource )
|
||||
|
||||
endmacro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD )
|
38
trunk/cmake/config-ix.cmake
Normal file
38
trunk/cmake/config-ix.cmake
Normal file
@@ -0,0 +1,38 @@
|
||||
include(CheckLibraryExists)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
# Check compiler flags
|
||||
check_cxx_compiler_flag(-std=c++0x LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG)
|
||||
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG)
|
||||
check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||
check_cxx_compiler_flag(-Wall LIBCXX_HAS_WALL_FLAG)
|
||||
check_cxx_compiler_flag(-W LIBCXX_HAS_W_FLAG)
|
||||
check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
|
||||
check_cxx_compiler_flag(-Wwrite-strings LIBCXX_HAS_WWRITE_STRINGS_FLAG)
|
||||
check_cxx_compiler_flag(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG)
|
||||
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
|
||||
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
|
||||
check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
|
||||
check_cxx_compiler_flag(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG)
|
||||
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
|
||||
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
|
||||
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
|
||||
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
|
||||
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
|
||||
|
||||
# Check libraries
|
||||
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
|
||||
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
|
||||
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
|
||||
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
|
||||
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
||||
|
||||
# Check C++0x features
|
||||
if (LIBCXX_ENABLE_CXX0X)
|
||||
if (LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -std=c++0x)
|
||||
endif()
|
||||
else()
|
||||
set(LIBCXX_HAS_STDCXX0X_FLAG FALSE)
|
||||
endif()
|
1248
trunk/include/__bit_reference
Normal file
1248
trunk/include/__bit_reference
Normal file
File diff suppressed because it is too large
Load Diff
422
trunk/include/__config
Normal file
422
trunk/include/__config
Normal file
@@ -0,0 +1,422 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- __config ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CONFIG
|
||||
#define _LIBCPP_CONFIG
|
||||
|
||||
#if !_MSC_VER // explicit macro necessary because it is only defined below in this file
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 1001
|
||||
|
||||
#define _LIBCPP_ABI_VERSION 1
|
||||
|
||||
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
|
||||
#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
|
||||
|
||||
#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
|
||||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#if __LITTLE_ENDIAN__
|
||||
#define _LIBCPP_LITTLE_ENDIAN 1
|
||||
#define _LIBCPP_BIG_ENDIAN 0
|
||||
#endif // __LITTLE_ENDIAN__
|
||||
#endif // __LITTLE_ENDIAN__
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#if __BIG_ENDIAN__
|
||||
#define _LIBCPP_LITTLE_ENDIAN 0
|
||||
#define _LIBCPP_BIG_ENDIAN 1
|
||||
#endif // __BIG_ENDIAN__
|
||||
#endif // __BIG_ENDIAN__
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
# include <sys/endian.h>
|
||||
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# else // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#endif // __FreeBSD__
|
||||
|
||||
#ifdef _WIN32
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
// Compiler intrinsics (GCC or MSVC)
|
||||
# if (defined(_MSC_VER) && _MSC_VER >= 1400) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3)
|
||||
# define _LIBCP_HAS_IS_BASE_OF
|
||||
# endif
|
||||
#endif // _WIN32
|
||||
|
||||
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
# include <endian.h>
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# else // __BYTE_ORDER == __BIG_ENDIAN
|
||||
# error unable to determine endian
|
||||
# endif
|
||||
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
|
||||
#if _WIN32
|
||||
|
||||
// only really useful for a DLL
|
||||
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
|
||||
# ifdef cxx_EXPORTS
|
||||
# define _LIBCPP_HIDDEN
|
||||
# define _LIBCPP_VISIBLE __declspec(dllexport)
|
||||
# else
|
||||
# define _LIBCPP_HIDDEN
|
||||
# define _LIBCPP_VISIBLE __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define _LIBCPP_HIDDEN
|
||||
# define _LIBCPP_VISIBLE
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_INLINE_VISIBILITY
|
||||
# if _MSC_VER
|
||||
# define _LIBCPP_INLINE_VISIBILITY __forceinline
|
||||
# else // MinGW GCC and Clang
|
||||
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXCEPTION_ABI
|
||||
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBLE
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_ALWAYS_INLINE
|
||||
# if _MSC_VER
|
||||
# define _LIBCPP_ALWAYS_INLINE __forceinline
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
#ifndef _LIBCPP_HIDDEN
|
||||
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_VISIBLE
|
||||
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_INLINE_VISIBILITY
|
||||
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXCEPTION_ABI
|
||||
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CANTTHROW
|
||||
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_ALWAYS_INLINE
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
|
||||
#if __has_feature(cxx_alignas)
|
||||
# define _ALIGNAS(x) alignas(x)
|
||||
#else
|
||||
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_alias_templates)
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#endif
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
#ifdef __linux__
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#else
|
||||
typedef __char16_t char16_t;
|
||||
typedef __char32_t char32_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_exceptions))
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_rtti))
|
||||
#define _LIBCPP_NO_RTTI
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_strong_enums))
|
||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_decltype))
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_attributes)
|
||||
# define _ATTRIBUTE(x) [[x]]
|
||||
#else
|
||||
# define _ATTRIBUTE(x) __attribute__ ((x))
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
|
||||
#if !(__has_feature(cxx_deleted_functions))
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#endif // !(__has_feature(cxx_deleted_functions))
|
||||
|
||||
#if !(__has_feature(cxx_lambdas))
|
||||
#define _LIBCPP_HAS_NO_LAMBDAS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_nullptr))
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_rvalue_references))
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_static_assert))
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_auto_type))
|
||||
#define _LIBCPP_HAS_NO_AUTO_TYPE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_variadic_templates))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_trailing_return))
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_generalized_initializers))
|
||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif
|
||||
|
||||
#if __has_feature(is_base_of)
|
||||
# define _LIBCP_HAS_IS_BASE_OF
|
||||
#endif
|
||||
|
||||
// Objective-C++ features (opt-in)
|
||||
#if __has_feature(objc_arc)
|
||||
#define _LIBCPP_HAS_OBJC_ARC
|
||||
#endif
|
||||
|
||||
#if __has_feature(objc_arc_weak)
|
||||
#define _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_constexpr))
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#endif
|
||||
|
||||
#if (__has_feature(cxx_noexcept))
|
||||
# define _NOEXCEPT noexcept
|
||||
# define _NOEXCEPT_(x) noexcept(x)
|
||||
#else
|
||||
# define _NOEXCEPT throw()
|
||||
# define _NOEXCEPT_(x)
|
||||
#endif
|
||||
|
||||
#if __has_feature(underlying_type)
|
||||
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
|
||||
#endif
|
||||
|
||||
// Inline namespaces are available in Clang regardless of C++ dialect.
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
inline namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
|
||||
#define _ATTRIBUTE(x) __attribute__((x))
|
||||
|
||||
#if !__EXCEPTIONS
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
|
||||
#define _NOEXCEPT throw()
|
||||
#define _NOEXCEPT_(x)
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
|
||||
#else // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||
}
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define __alignof__ __alignof
|
||||
#define _ATTRIBUTE __declspec
|
||||
#define _ALIGNAS(x) __declspec(align(x))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#define _NOEXCEPT throw()
|
||||
#define _NOEXCEPT_(x)
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
|
||||
#define _LIBCPP_END_NAMESPACE_STD }
|
||||
#define _VSTD std
|
||||
|
||||
namespace std {
|
||||
}
|
||||
|
||||
#endif // __clang__ || __GNUC___ || _MSC_VER
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef unsigned short char16_t;
|
||||
typedef unsigned int char32_t;
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
|
||||
template <bool> struct __static_assert_test;
|
||||
template <> struct __static_assert_test<true> {};
|
||||
template <unsigned> struct __static_assert_check {};
|
||||
#define static_assert(__b, __m) \
|
||||
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
|
||||
_LIBCPP_CONCAT(__t, __LINE__)
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define decltype(x) __typeof__(x)
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#define constexpr const
|
||||
#endif
|
||||
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_VISIBLE x { enum _
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
|
||||
_ __v_; \
|
||||
_LIBCPP_ALWAYS_INLINE x(_ __v) : __v_(__v) {} \
|
||||
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
|
||||
};
|
||||
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_VISIBLE x
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
|
||||
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
|
||||
#if __APPLE__ || __FreeBSD__ || _WIN32
|
||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
||||
#endif
|
||||
#if __FreeBSD__
|
||||
#define _DECLARE_C99_LDBL_MATH 1
|
||||
#endif
|
||||
|
||||
#if __APPLE__ || __FreeBSD__
|
||||
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
#endif
|
||||
|
||||
#if __APPLE__ || __FreeBSD__
|
||||
#define _LIBCPP_WCTYPE_IS_MASK
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
# if _LIBCPP_DEBUG2 == 0
|
||||
# define _LIBCPP_DEBUG_LEVEL 1
|
||||
# elif _LIBCPP_DEBUG2 == 1
|
||||
# define _LIBCPP_DEBUG_LEVEL 2
|
||||
# else
|
||||
# error Supported values for _LIBCPP_DEBUG2 are 0 and 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
# include <__debug>
|
||||
#else
|
||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
191
trunk/include/__debug
Normal file
191
trunk/include/__debug
Normal file
@@ -0,0 +1,191 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- __debug ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_DEBUG_H
|
||||
#define _LIBCPP_DEBUG_H
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 1
|
||||
|
||||
# include <cstdlib>
|
||||
# include <cstdio>
|
||||
# include <cstddef>
|
||||
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
|
||||
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
struct _LIBCPP_VISIBLE __c_node;
|
||||
|
||||
struct _LIBCPP_VISIBLE __i_node
|
||||
{
|
||||
void* __i_;
|
||||
__i_node* __next_;
|
||||
__c_node* __c_;
|
||||
|
||||
__i_node(const __i_node&) = delete;
|
||||
__i_node& operator=(const __i_node&) = delete;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__i_node(void* __i, __i_node* __next, __c_node* __c)
|
||||
: __i_(__i), __next_(__next), __c_(__c) {}
|
||||
~__i_node();
|
||||
};
|
||||
|
||||
struct _LIBCPP_VISIBLE __c_node
|
||||
{
|
||||
void* __c_;
|
||||
__c_node* __next_;
|
||||
__i_node** beg_;
|
||||
__i_node** end_;
|
||||
__i_node** cap_;
|
||||
|
||||
__c_node(const __c_node&) = delete;
|
||||
__c_node& operator=(const __c_node&) = delete;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__c_node(void* __c, __c_node* __next)
|
||||
: __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
|
||||
virtual ~__c_node();
|
||||
|
||||
virtual bool __dereferenceable(const void*) const = 0;
|
||||
virtual bool __decrementable(const void*) const = 0;
|
||||
virtual bool __addable(const void*, ptrdiff_t) const = 0;
|
||||
virtual bool __subscriptable(const void*, ptrdiff_t) const = 0;
|
||||
|
||||
void __add(__i_node* __i);
|
||||
_LIBCPP_HIDDEN void __remove(__i_node* __i);
|
||||
};
|
||||
|
||||
template <class _Cont>
|
||||
struct _C_node
|
||||
: public __c_node
|
||||
{
|
||||
_C_node(void* __c, __c_node* __n)
|
||||
: __c_node(__c, __n) {}
|
||||
|
||||
virtual bool __dereferenceable(const void*) const;
|
||||
virtual bool __decrementable(const void*) const;
|
||||
virtual bool __addable(const void*, ptrdiff_t) const;
|
||||
virtual bool __subscriptable(const void*, ptrdiff_t) const;
|
||||
};
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__dereferenceable(const void* __i) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__dereferenceable(__j);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__decrementable(const void* __i) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__decrementable(__j);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__addable(__j, __n);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__subscriptable(__j, __n);
|
||||
}
|
||||
|
||||
class _LIBCPP_VISIBLE __libcpp_db
|
||||
{
|
||||
__c_node** __cbeg_;
|
||||
__c_node** __cend_;
|
||||
size_t __csz_;
|
||||
__i_node** __ibeg_;
|
||||
__i_node** __iend_;
|
||||
size_t __isz_;
|
||||
|
||||
__libcpp_db();
|
||||
public:
|
||||
__libcpp_db(const __libcpp_db&) = delete;
|
||||
__libcpp_db& operator=(const __libcpp_db&) = delete;
|
||||
~__libcpp_db();
|
||||
|
||||
class __db_c_iterator;
|
||||
class __db_c_const_iterator;
|
||||
class __db_i_iterator;
|
||||
class __db_i_const_iterator;
|
||||
|
||||
__db_c_const_iterator __c_end() const;
|
||||
__db_i_const_iterator __i_end() const;
|
||||
|
||||
template <class _Cont>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __insert_c(_Cont* __c)
|
||||
{
|
||||
__c_node* __n = __insert_c(static_cast<void*>(__c));
|
||||
::new(__n) _C_node<_Cont>(__n->__c_, __n->__next_);
|
||||
}
|
||||
|
||||
void __insert_i(void* __i);
|
||||
__c_node* __insert_c(void* __c);
|
||||
void __erase_c(void* __c);
|
||||
|
||||
void __insert_ic(void* __i, const void* __c);
|
||||
void __iterator_copy(void* __i, const void* __i0);
|
||||
void __erase_i(void* __i);
|
||||
|
||||
void* __find_c_from_i(void* __i) const;
|
||||
void __invalidate_all(void* __c);
|
||||
__c_node* __find_c_and_lock(void* __c) const;
|
||||
__c_node* __find_c(void* __c) const;
|
||||
void unlock() const;
|
||||
|
||||
void swap(void* __c1, void* __c2);
|
||||
|
||||
|
||||
bool __dereferenceable(const void* __i) const;
|
||||
bool __decrementable(const void* __i) const;
|
||||
bool __addable(const void* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const void* __i, ptrdiff_t __n) const;
|
||||
bool __comparable(const void* __i, const void* __j) const;
|
||||
private:
|
||||
_LIBCPP_HIDDEN
|
||||
__i_node* __insert_iterator(void* __i);
|
||||
_LIBCPP_HIDDEN
|
||||
__i_node* __find_iterator(const void* __i) const;
|
||||
|
||||
friend _LIBCPP_VISIBLE __libcpp_db* __get_db();
|
||||
};
|
||||
|
||||
_LIBCPP_VISIBLE __libcpp_db* __get_db();
|
||||
_LIBCPP_VISIBLE const __libcpp_db* __get_const_db();
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_DEBUG_H
|
||||
|
2130
trunk/include/__functional_03
Normal file
2130
trunk/include/__functional_03
Normal file
File diff suppressed because it is too large
Load Diff
430
trunk/include/__functional_base
Normal file
430
trunk/include/__functional_base
Normal file
@@ -0,0 +1,430 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_FUNCTIONAL_BASE
|
||||
#define _LIBCPP_FUNCTIONAL_BASE
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
#include <typeinfo>
|
||||
#include <exception>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
struct _LIBCPP_VISIBLE unary_function
|
||||
{
|
||||
typedef _Arg argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct _LIBCPP_VISIBLE binary_function
|
||||
{
|
||||
typedef _Arg1 first_argument_type;
|
||||
typedef _Arg2 second_argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Tp> struct _LIBCPP_VISIBLE hash;
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_result_type
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::result_type* = 0);
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
};
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#include <__functional_base_03>
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
// __weak_result_type
|
||||
|
||||
template <class _Tp>
|
||||
struct __derives_from_unary_function
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
static __two __test(...);
|
||||
template <class _Ap, class _Rp>
|
||||
static unary_function<_Ap, _Rp>
|
||||
__test(const volatile unary_function<_Ap, _Rp>*);
|
||||
public:
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __derives_from_binary_function
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
static __two __test(...);
|
||||
template <class _A1, class _A2, class _Rp>
|
||||
static binary_function<_A1, _A2, _Rp>
|
||||
__test(const volatile binary_function<_A1, _A2, _Rp>*);
|
||||
public:
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
};
|
||||
|
||||
template <class _Tp, bool = __derives_from_unary_function<_Tp>::value>
|
||||
struct __maybe_derive_from_unary_function // bool is true
|
||||
: public __derives_from_unary_function<_Tp>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __maybe_derive_from_unary_function<_Tp, false>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, bool = __derives_from_binary_function<_Tp>::value>
|
||||
struct __maybe_derive_from_binary_function // bool is true
|
||||
: public __derives_from_binary_function<_Tp>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __maybe_derive_from_binary_function<_Tp, false>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, bool = __has_result_type<_Tp>::value>
|
||||
struct __weak_result_type_imp // bool is true
|
||||
: public __maybe_derive_from_unary_function<_Tp>,
|
||||
public __maybe_derive_from_binary_function<_Tp>
|
||||
{
|
||||
typedef typename _Tp::result_type result_type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __weak_result_type_imp<_Tp, false>
|
||||
: public __maybe_derive_from_unary_function<_Tp>,
|
||||
public __maybe_derive_from_binary_function<_Tp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __weak_result_type
|
||||
: public __weak_result_type_imp<_Tp>
|
||||
{
|
||||
};
|
||||
|
||||
// 0 argument case
|
||||
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp ()>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp (&)()>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp (*)()>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
// 1 argument case
|
||||
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (_A1)>
|
||||
: public unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (&)(_A1)>
|
||||
: public unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (*)(_A1)>
|
||||
: public unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)()>
|
||||
: public unary_function<_Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const>
|
||||
: public unary_function<const _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() volatile>
|
||||
: public unary_function<volatile _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const volatile>
|
||||
: public unary_function<const volatile _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
// 2 argument case
|
||||
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1)>
|
||||
: public binary_function<_Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
|
||||
: public binary_function<const _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
|
||||
: public binary_function<volatile _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
|
||||
: public binary_function<const volatile _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
// 3 or more arguments
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
|
||||
{
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
// __invoke
|
||||
|
||||
// bullets 1 and 2
|
||||
|
||||
template <class _Fp, class _A0, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _Fp, class _A0, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
// bullets 3 and 4
|
||||
|
||||
template <class _Fp, class _A0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_Fp&& __f, _A0&& __a0)
|
||||
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
|
||||
{
|
||||
return _VSTD::forward<_A0>(__a0).*__f;
|
||||
}
|
||||
|
||||
template <class _Fp, class _A0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_Fp&& __f, _A0&& __a0)
|
||||
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
|
||||
{
|
||||
return (*_VSTD::forward<_A0>(__a0)).*__f;
|
||||
}
|
||||
|
||||
// bullet 5
|
||||
|
||||
template <class _Fp, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_Fp&& __f, _Args&& ...__args)
|
||||
-> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _Tp, class ..._Args>
|
||||
struct __invoke_return
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE reference_wrapper
|
||||
: public __weak_result_type<_Tp>
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef _Tp type;
|
||||
private:
|
||||
type* __f_;
|
||||
|
||||
public:
|
||||
// construct/copy/destroy
|
||||
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
|
||||
#endif
|
||||
|
||||
// access
|
||||
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
|
||||
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_of<type&, _ArgTypes...>::type
|
||||
operator() (_ArgTypes&&... __args) const
|
||||
{
|
||||
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp> struct ____is_reference_wrapper : public false_type {};
|
||||
template <class _Tp> struct ____is_reference_wrapper<reference_wrapper<_Tp> > : public true_type {};
|
||||
template <class _Tp> struct __is_reference_wrapper
|
||||
: public ____is_reference_wrapper<typename remove_cv<_Tp>::type> {};
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<_Tp>
|
||||
ref(_Tp& __t) _NOEXCEPT
|
||||
{
|
||||
return reference_wrapper<_Tp>(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<_Tp>
|
||||
ref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
return ref(__t.get());
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<const _Tp>
|
||||
cref(const _Tp& __t) _NOEXCEPT
|
||||
{
|
||||
return reference_wrapper<const _Tp>(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<const _Tp>
|
||||
cref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
return cref(__t.get());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
template <class _Tp> void ref(const _Tp&&) = delete;
|
||||
template <class _Tp> void cref(const _Tp&&) = delete;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
template <class _Tp> void ref(const _Tp&&);// = delete;
|
||||
template <class _Tp> void cref(const _Tp&&);// = delete;
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_FUNCTIONAL_BASE
|
1087
trunk/include/__functional_base_03
Normal file
1087
trunk/include/__functional_base_03
Normal file
File diff suppressed because it is too large
Load Diff
1920
trunk/include/__hash_table
Normal file
1920
trunk/include/__hash_table
Normal file
File diff suppressed because it is too large
Load Diff
1414
trunk/include/__locale
Normal file
1414
trunk/include/__locale
Normal file
File diff suppressed because it is too large
Load Diff
439
trunk/include/__mutex_base
Normal file
439
trunk/include/__mutex_base
Normal file
@@ -0,0 +1,439 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___MUTEX_BASE
|
||||
#define _LIBCPP___MUTEX_BASE
|
||||
|
||||
#include <__config>
|
||||
#include <chrono>
|
||||
#include <system_error>
|
||||
#include <pthread.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_SHARED_LOCK
|
||||
|
||||
namespace ting {
|
||||
template <class _Mutex> class shared_lock;
|
||||
template <class _Mutex> class upgrade_lock;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_SHARED_LOCK
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_VISIBLE mutex
|
||||
{
|
||||
pthread_mutex_t __m_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
|
||||
~mutex();
|
||||
|
||||
private:
|
||||
mutex(const mutex&);// = delete;
|
||||
mutex& operator=(const mutex&);// = delete;
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
|
||||
};
|
||||
|
||||
struct _LIBCPP_VISIBLE defer_lock_t {};
|
||||
struct _LIBCPP_VISIBLE try_to_lock_t {};
|
||||
struct _LIBCPP_VISIBLE adopt_lock_t {};
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
defer_lock_t defer_lock;
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
try_to_lock_t try_to_lock;
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
adopt_lock_t adopt_lock;
|
||||
|
||||
template <class _Mutex>
|
||||
class _LIBCPP_VISIBLE lock_guard
|
||||
{
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
|
||||
private:
|
||||
mutex_type& __m_;
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit lock_guard(mutex_type& __m)
|
||||
: __m_(__m) {__m_.lock();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
lock_guard(mutex_type& __m, adopt_lock_t)
|
||||
: __m_(__m) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~lock_guard() {__m_.unlock();}
|
||||
|
||||
private:
|
||||
lock_guard(lock_guard const&);// = delete;
|
||||
lock_guard& operator=(lock_guard const&);// = delete;
|
||||
};
|
||||
|
||||
template <class _Mutex>
|
||||
class _LIBCPP_VISIBLE unique_lock
|
||||
{
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
|
||||
private:
|
||||
mutex_type* __m_;
|
||||
bool __owns_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock() : __m_(nullptr), __owns_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit unique_lock(mutex_type& __m)
|
||||
: __m_(&__m), __owns_(true) {__m_->lock();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, defer_lock_t)
|
||||
: __m_(&__m), __owns_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, try_to_lock_t)
|
||||
: __m_(&__m), __owns_(__m.try_lock()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, adopt_lock_t)
|
||||
: __m_(&__m), __owns_(true) {}
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t)
|
||||
: __m_(&__m), __owns_(__m.try_lock_until(__t)) {}
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d)
|
||||
: __m_(&__m), __owns_(__m.try_lock_for(__d)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~unique_lock()
|
||||
{
|
||||
if (__owns_)
|
||||
__m_->unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
unique_lock(unique_lock const&); // = delete;
|
||||
unique_lock& operator=(unique_lock const&); // = delete;
|
||||
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(unique_lock&& __u)
|
||||
: __m_(__u.__m_), __owns_(__u.__owns_)
|
||||
{__u.__m_ = nullptr; __u.__owns_ = false;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock& operator=(unique_lock&& __u)
|
||||
{
|
||||
if (__owns_)
|
||||
__m_->unlock();
|
||||
__m_ = __u.__m_;
|
||||
__owns_ = __u.__owns_;
|
||||
__u.__m_ = nullptr;
|
||||
__u.__owns_ = false;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_SHARED_LOCK
|
||||
|
||||
unique_lock(ting::shared_lock<mutex_type>&&, try_to_lock_t);
|
||||
template <class _Clock, class _Duration>
|
||||
unique_lock(ting::shared_lock<mutex_type>&&,
|
||||
const chrono::time_point<_Clock, _Duration>&);
|
||||
template <class _Rep, class _Period>
|
||||
unique_lock(ting::shared_lock<mutex_type>&&,
|
||||
const chrono::duration<_Rep, _Period>&);
|
||||
|
||||
explicit unique_lock(ting::upgrade_lock<mutex_type>&&);
|
||||
unique_lock(ting::upgrade_lock<mutex_type>&&, try_to_lock_t);
|
||||
template <class _Clock, class _Duration>
|
||||
unique_lock(ting::upgrade_lock<mutex_type>&&,
|
||||
const chrono::time_point<_Clock, _Duration>&);
|
||||
template <class _Rep, class _Period>
|
||||
unique_lock(ting::upgrade_lock<mutex_type>&&,
|
||||
const chrono::duration<_Rep, _Period>&);
|
||||
|
||||
#endif // _LIBCPP_SHARED_LOCK
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d);
|
||||
template <class _Clock, class _Duration>
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
||||
void unlock();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(unique_lock& __u)
|
||||
{
|
||||
_VSTD::swap(__m_, __u.__m_);
|
||||
_VSTD::swap(__owns_, __u.__owns_);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* release()
|
||||
{
|
||||
mutex_type* __m = __m_;
|
||||
__m_ = nullptr;
|
||||
__owns_ = false;
|
||||
return __m;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool owns_lock() const {return __owns_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
// explicit
|
||||
operator bool () const {return __owns_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* mutex() const {return __m_;}
|
||||
};
|
||||
|
||||
template <class _Mutex>
|
||||
void
|
||||
unique_lock<_Mutex>::lock()
|
||||
{
|
||||
if (__m_ == nullptr)
|
||||
__throw_system_error(EPERM, "unique_lock::lock: references null mutex");
|
||||
if (__owns_)
|
||||
__throw_system_error(EDEADLK, "unique_lock::lock: already locked");
|
||||
__m_->lock();
|
||||
__owns_ = true;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
bool
|
||||
unique_lock<_Mutex>::try_lock()
|
||||
{
|
||||
if (__m_ == nullptr)
|
||||
__throw_system_error(EPERM, "unique_lock::try_lock: references null mutex");
|
||||
if (__owns_)
|
||||
__throw_system_error(EDEADLK, "unique_lock::try_lock: already locked");
|
||||
__owns_ = __m_->try_lock();
|
||||
return __owns_;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
template <class _Rep, class _Period>
|
||||
bool
|
||||
unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
if (__m_ == nullptr)
|
||||
__throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex");
|
||||
if (__owns_)
|
||||
__throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked");
|
||||
__owns_ = __m_->try_lock_for(__d);
|
||||
return __owns_;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
template <class _Clock, class _Duration>
|
||||
bool
|
||||
unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
if (__m_ == nullptr)
|
||||
__throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex");
|
||||
if (__owns_)
|
||||
__throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked");
|
||||
__owns_ = __m_->try_lock_until(__t);
|
||||
return __owns_;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
void
|
||||
unique_lock<_Mutex>::unlock()
|
||||
{
|
||||
if (!__owns_)
|
||||
__throw_system_error(EPERM, "unique_lock::unlock: not locked");
|
||||
__m_->unlock();
|
||||
__owns_ = false;
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);}
|
||||
|
||||
struct _LIBCPP_VISIBLE cv_status
|
||||
{
|
||||
enum _ {
|
||||
no_timeout,
|
||||
timeout
|
||||
};
|
||||
|
||||
_ __v_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
|
||||
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
|
||||
|
||||
};
|
||||
|
||||
class _LIBCPP_VISIBLE condition_variable
|
||||
{
|
||||
pthread_cond_t __cv_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
|
||||
~condition_variable();
|
||||
|
||||
private:
|
||||
condition_variable(const condition_variable&); // = delete;
|
||||
condition_variable& operator=(const condition_variable&); // = delete;
|
||||
|
||||
public:
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
|
||||
void wait(unique_lock<mutex>& __lk);
|
||||
template <class _Predicate>
|
||||
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
|
||||
|
||||
template <class _Duration>
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<chrono::system_clock, _Duration>& __t);
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
||||
template <class _Clock, class _Duration, class _Predicate>
|
||||
bool
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred);
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
cv_status
|
||||
wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d);
|
||||
|
||||
template <class _Rep, class _Period, class _Predicate>
|
||||
bool
|
||||
wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred);
|
||||
|
||||
typedef pthread_cond_t* native_handle_type;
|
||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;}
|
||||
|
||||
private:
|
||||
void __do_timed_wait(unique_lock<mutex>& __lk,
|
||||
chrono::time_point<chrono::system_clock, chrono::nanoseconds>);
|
||||
};
|
||||
|
||||
template <class _To, class _Rep, class _Period>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
chrono::__is_duration<_To>::value,
|
||||
_To
|
||||
>::type
|
||||
__ceil(chrono::duration<_Rep, _Period> __d)
|
||||
{
|
||||
using namespace chrono;
|
||||
_To __r = duration_cast<_To>(__d);
|
||||
if (__r < __d)
|
||||
++__r;
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Predicate>
|
||||
void
|
||||
condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
|
||||
{
|
||||
while (!__pred())
|
||||
wait(__lk);
|
||||
}
|
||||
|
||||
template <class _Duration>
|
||||
cv_status
|
||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<chrono::system_clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
typedef time_point<system_clock, nanoseconds> __nano_sys_tmpt;
|
||||
__do_timed_wait(__lk,
|
||||
__nano_sys_tmpt(__ceil<nanoseconds>(__t.time_since_epoch())));
|
||||
return system_clock::now() < __t ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
}
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
cv_status
|
||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
system_clock::time_point __s_now = system_clock::now();
|
||||
typename _Clock::time_point __c_now = _Clock::now();
|
||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__t - __c_now));
|
||||
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
|
||||
}
|
||||
|
||||
template <class _Clock, class _Duration, class _Predicate>
|
||||
bool
|
||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred)
|
||||
{
|
||||
while (!__pred())
|
||||
{
|
||||
if (wait_until(__lk, __t) == cv_status::timeout)
|
||||
return __pred();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
cv_status
|
||||
condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
using namespace chrono;
|
||||
system_clock::time_point __s_now = system_clock::now();
|
||||
steady_clock::time_point __c_now = steady_clock::now();
|
||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
||||
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
}
|
||||
|
||||
template <class _Rep, class _Period, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lk, chrono::steady_clock::now() + __d,
|
||||
_VSTD::move(__pred));
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___MUTEX_BASE
|
652
trunk/include/__split_buffer
Normal file
652
trunk/include/__split_buffer
Normal file
@@ -0,0 +1,652 @@
|
||||
// -*- C++ -*-
|
||||
#ifndef _LIBCPP_SPLIT_BUFFER
|
||||
#define _LIBCPP_SPLIT_BUFFER
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <bool>
|
||||
class __split_buffer_common
|
||||
{
|
||||
protected:
|
||||
void __throw_length_error() const;
|
||||
void __throw_out_of_range() const;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Allocator = allocator<_Tp> >
|
||||
struct __split_buffer
|
||||
: private __split_buffer_common<true>
|
||||
{
|
||||
private:
|
||||
__split_buffer(const __split_buffer&);
|
||||
__split_buffer& operator=(const __split_buffer&);
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef typename remove_reference<allocator_type>::type __alloc_rr;
|
||||
typedef allocator_traits<__alloc_rr> __alloc_traits;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef typename __alloc_traits::size_type size_type;
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
typedef typename __alloc_traits::pointer pointer;
|
||||
typedef typename __alloc_traits::const_pointer const_pointer;
|
||||
typedef pointer iterator;
|
||||
typedef const_pointer const_iterator;
|
||||
|
||||
pointer __first_;
|
||||
pointer __begin_;
|
||||
pointer __end_;
|
||||
__compressed_pair<pointer, allocator_type> __end_cap_;
|
||||
|
||||
typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref;
|
||||
typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
|
||||
|
||||
__split_buffer()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
||||
explicit __split_buffer(__alloc_rr& __a);
|
||||
explicit __split_buffer(const __alloc_rr& __a);
|
||||
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
|
||||
~__split_buffer();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
|
||||
__split_buffer& operator=(__split_buffer&& __c)
|
||||
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value) ||
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __end_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __end_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT
|
||||
{__destruct_at_end(__begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type __front_spare() const {return static_cast<size_type>(__begin_ - __first_);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type __back_spare() const {return static_cast<size_type>(__end_cap() - __end_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference front() {return *__begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return *__begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference back() {return *(__end_ - 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);}
|
||||
|
||||
void reserve(size_type __n);
|
||||
void shrink_to_fit() _NOEXCEPT;
|
||||
void push_front(const_reference __x);
|
||||
void push_back(const_reference __x);
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
void push_front(value_type&& __x);
|
||||
void push_back(value_type&& __x);
|
||||
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class... _Args>
|
||||
void emplace_back(_Args&&... __args);
|
||||
#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
|
||||
|
||||
void __construct_at_end(size_type __n);
|
||||
void __construct_at_end(size_type __n, const_reference __x);
|
||||
template <class _InputIter>
|
||||
typename enable_if
|
||||
<
|
||||
__is_input_iterator<_InputIter>::value &&
|
||||
!__is_forward_iterator<_InputIter>::value,
|
||||
void
|
||||
>::type
|
||||
__construct_at_end(_InputIter __first, _InputIter __last);
|
||||
template <class _ForwardIterator>
|
||||
typename enable_if
|
||||
<
|
||||
__is_forward_iterator<_ForwardIterator>::value,
|
||||
void
|
||||
>::type
|
||||
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
|
||||
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
|
||||
void __destruct_at_begin(pointer __new_begin, false_type);
|
||||
void __destruct_at_begin(pointer __new_begin, true_type);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __destruct_at_end(pointer __new_last) _NOEXCEPT
|
||||
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
|
||||
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
|
||||
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
|
||||
|
||||
void swap(__split_buffer& __x)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value);
|
||||
|
||||
bool __invariants() const;
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__split_buffer& __c, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
||||
{
|
||||
__alloc() = _VSTD::move(__c.__alloc());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_swap::value>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
bool
|
||||
__split_buffer<_Tp, _Allocator>::__invariants() const
|
||||
{
|
||||
if (__first_ == nullptr)
|
||||
{
|
||||
if (__begin_ != nullptr)
|
||||
return false;
|
||||
if (__end_ != nullptr)
|
||||
return false;
|
||||
if (__end_cap() != nullptr)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__begin_ < __first_)
|
||||
return false;
|
||||
if (__end_ < __begin_)
|
||||
return false;
|
||||
if (__end_cap() < __end_)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Default constructs __n objects starting at __end_
|
||||
// throws if construction throws
|
||||
// Precondition: __n > 0
|
||||
// Precondition: size() + __n <= capacity()
|
||||
// Postcondition: size() == size() + __n
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
do
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
|
||||
++this->__end_;
|
||||
--__n;
|
||||
} while (__n > 0);
|
||||
}
|
||||
|
||||
// Copy constructs __n objects starting at __end_ from __x
|
||||
// throws if construction throws
|
||||
// Precondition: __n > 0
|
||||
// Precondition: size() + __n <= capacity()
|
||||
// Postcondition: size() == old size() + __n
|
||||
// Postcondition: [i] == __x for all i in [size() - __n, __n)
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
do
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
|
||||
++this->__end_;
|
||||
--__n;
|
||||
} while (__n > 0);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _InputIter>
|
||||
typename enable_if
|
||||
<
|
||||
__is_input_iterator<_InputIter>::value &&
|
||||
!__is_forward_iterator<_InputIter>::value,
|
||||
void
|
||||
>::type
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
for (; __first != __last; ++__first)
|
||||
{
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
size_type __old_cap = __end_cap() - __first_;
|
||||
size_type __new_cap = _VSTD::max<size_type>(2 * __old_cap, 8);
|
||||
__split_buffer __buf(__new_cap, 0, __a);
|
||||
for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
|
||||
__alloc_traits::construct(__buf.__alloc(),
|
||||
_VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));
|
||||
swap(__buf);
|
||||
}
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
|
||||
++this->__end_;
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _ForwardIterator>
|
||||
typename enable_if
|
||||
<
|
||||
__is_forward_iterator<_ForwardIterator>::value,
|
||||
void
|
||||
>::type
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
for (; __first != __last; ++__first)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
|
||||
++this->__end_;
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
|
||||
{
|
||||
while (__begin_ < __new_begin)
|
||||
__alloc_traits::destroy(__alloc(), __begin_++);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
|
||||
{
|
||||
__begin_ = __new_begin;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
|
||||
{
|
||||
while (__new_last < __end_)
|
||||
__alloc_traits::destroy(__alloc(), --__end_);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
|
||||
{
|
||||
__end_ = __new_last;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
|
||||
: __end_cap_(0, __a)
|
||||
{
|
||||
__first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
|
||||
__begin_ = __end_ = __first_ + __start;
|
||||
__end_cap() = __first_ + __cap;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __first_(0), __begin_(0), __end_(0), __end_cap_(0)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
|
||||
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
|
||||
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::~__split_buffer()
|
||||
{
|
||||
clear();
|
||||
if (__first_)
|
||||
__alloc_traits::deallocate(__alloc(), __first_, capacity());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
: __first_(_VSTD::move(__c.__first_)),
|
||||
__begin_(_VSTD::move(__c.__begin_)),
|
||||
__end_(_VSTD::move(__c.__end_)),
|
||||
__end_cap_(_VSTD::move(__c.__end_cap_))
|
||||
{
|
||||
__c.__first_ = nullptr;
|
||||
__c.__begin_ = nullptr;
|
||||
__c.__end_ = nullptr;
|
||||
__c.__end_cap() = nullptr;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
|
||||
: __end_cap_(__a)
|
||||
{
|
||||
if (__a == __c.__alloc())
|
||||
{
|
||||
__first_ = __c.__first_;
|
||||
__begin_ = __c.__begin_;
|
||||
__end_ = __c.__end_;
|
||||
__end_cap() = __c.__end_cap();
|
||||
__c.__first_ = nullptr;
|
||||
__c.__begin_ = nullptr;
|
||||
__c.__end_ = nullptr;
|
||||
__c.__end_cap() = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __cap = __c.size();
|
||||
__first_ = __alloc_traits::allocate(__alloc(), __cap);
|
||||
__begin_ = __end_ = __first_;
|
||||
__end_cap() = __first_ + __cap;
|
||||
typedef move_iterator<iterator> _Ip;
|
||||
__construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>&
|
||||
__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
|
||||
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value) ||
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value)
|
||||
{
|
||||
clear();
|
||||
shrink_to_fit();
|
||||
__first_ = __c.__first_;
|
||||
__begin_ = __c.__begin_;
|
||||
__end_ = __c.__end_;
|
||||
__end_cap() = __c.__end_cap();
|
||||
__move_assign_alloc(__c,
|
||||
integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_move_assignment::value>());
|
||||
__c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{
|
||||
_VSTD::swap(__first_, __x.__first_);
|
||||
_VSTD::swap(__begin_, __x.__begin_);
|
||||
_VSTD::swap(__end_, __x.__end_);
|
||||
_VSTD::swap(__end_cap(), __x.__end_cap());
|
||||
__swap_alloc(__alloc(), __x.__alloc());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::reserve(size_type __n)
|
||||
{
|
||||
if (__n < capacity())
|
||||
{
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
|
||||
{
|
||||
if (capacity() > size())
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
__t.__end_ = __t.__begin_ + (__end_ - __begin_);
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
||||
{
|
||||
if (__begin_ == __first_)
|
||||
{
|
||||
if (__end_ < __end_cap())
|
||||
{
|
||||
difference_type __d = __end_cap() - __end_;
|
||||
__d = (__d + 1) / 2;
|
||||
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__end_ += __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x);
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
{
|
||||
if (__begin_ == __first_)
|
||||
{
|
||||
if (__end_ < __end_cap())
|
||||
{
|
||||
difference_type __d = __end_cap() - __end_;
|
||||
__d = (__d + 1) / 2;
|
||||
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__end_ += __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1),
|
||||
_VSTD::move(__x));
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
{
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
if (__begin_ > __first_)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x);
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
||||
{
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
if (__begin_ > __first_)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
|
||||
_VSTD::move(__x));
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
{
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
if (__begin_ > __first_)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_SPLIT_BUFFER
|
77
trunk/include/__sso_allocator
Normal file
77
trunk/include/__sso_allocator
Normal file
@@ -0,0 +1,77 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___SSO_ALLOCATOR
|
||||
#define _LIBCPP___SSO_ALLOCATOR
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
#include <new>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, size_t _Np> class _LIBCPP_HIDDEN __sso_allocator;
|
||||
|
||||
template <size_t _Np>
|
||||
class _LIBCPP_HIDDEN __sso_allocator<void, _Np>
|
||||
{
|
||||
public:
|
||||
typedef const void* const_pointer;
|
||||
typedef void value_type;
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Np>
|
||||
class _LIBCPP_HIDDEN __sso_allocator
|
||||
{
|
||||
typename aligned_storage<sizeof(_Tp) * _Np>::type buf_;
|
||||
bool __allocated_;
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef _Tp* pointer;
|
||||
typedef _Tp value_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _Np>&) throw()
|
||||
: __allocated_(false) {}
|
||||
private:
|
||||
__sso_allocator& operator=(const __sso_allocator&);
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = 0)
|
||||
{
|
||||
if (!__allocated_ && __n <= _Np)
|
||||
{
|
||||
__allocated_ = true;
|
||||
return (pointer)&buf_;
|
||||
}
|
||||
return static_cast<pointer>(::operator new(__n * sizeof(_Tp)));
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type)
|
||||
{
|
||||
if (__p == (pointer)&buf_)
|
||||
__allocated_ = false;
|
||||
else
|
||||
::operator delete(__p);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(__sso_allocator& __a) const {return &buf_ == &__a.buf_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(__sso_allocator& __a) const {return &buf_ != &__a.buf_;}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___SSO_ALLOCATOR
|
317
trunk/include/__std_stream
Normal file
317
trunk/include/__std_stream
Normal file
@@ -0,0 +1,317 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___STD_STREAM
|
||||
#define _LIBCPP___STD_STREAM
|
||||
|
||||
#include <__config>
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
#include <__locale>
|
||||
#include <cstdio>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
static const int __limit = 8;
|
||||
|
||||
// __stdinbuf
|
||||
|
||||
template <class _CharT>
|
||||
class _LIBCPP_HIDDEN __stdinbuf
|
||||
: public basic_streambuf<_CharT, char_traits<_CharT> >
|
||||
{
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
typedef char_traits<char_type> traits_type;
|
||||
typedef typename traits_type::int_type int_type;
|
||||
typedef typename traits_type::pos_type pos_type;
|
||||
typedef typename traits_type::off_type off_type;
|
||||
typedef typename traits_type::state_type state_type;
|
||||
|
||||
explicit __stdinbuf(FILE* __fp);
|
||||
|
||||
protected:
|
||||
virtual int_type underflow();
|
||||
virtual int_type uflow();
|
||||
virtual int_type pbackfail(int_type __c = traits_type::eof());
|
||||
virtual void imbue(const locale& __loc);
|
||||
|
||||
private:
|
||||
|
||||
FILE* __file_;
|
||||
const codecvt<char_type, char, state_type>* __cv_;
|
||||
state_type __st_;
|
||||
int __encoding_;
|
||||
bool __always_noconv_;
|
||||
|
||||
__stdinbuf(const __stdinbuf&);
|
||||
__stdinbuf& operator=(const __stdinbuf&);
|
||||
|
||||
int_type __getchar(bool __consume);
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp)
|
||||
: __file_(__fp),
|
||||
__st_()
|
||||
{
|
||||
imbue(this->getloc());
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
void
|
||||
__stdinbuf<_CharT>::imbue(const locale& __loc)
|
||||
{
|
||||
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
|
||||
__encoding_ = __cv_->encoding();
|
||||
__always_noconv_ = __cv_->always_noconv();
|
||||
if (__encoding_ > __limit)
|
||||
__throw_runtime_error("unsupported locale for standard input");
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::underflow()
|
||||
{
|
||||
return __getchar(false);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::uflow()
|
||||
{
|
||||
return __getchar(true);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::__getchar(bool __consume)
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
int __nread = _VSTD::max(1, __encoding_);
|
||||
for (int __i = 0; __i < __nread; ++__i)
|
||||
{
|
||||
int __c = getc(__file_);
|
||||
if (__c == EOF)
|
||||
return traits_type::eof();
|
||||
__extbuf[__i] = static_cast<char>(__c);
|
||||
}
|
||||
char_type __1buf;
|
||||
if (__always_noconv_)
|
||||
__1buf = static_cast<char_type>(__extbuf[0]);
|
||||
else
|
||||
{
|
||||
const char* __enxt;
|
||||
char_type* __inxt;
|
||||
codecvt_base::result __r;
|
||||
do
|
||||
{
|
||||
state_type __sv_st = __st_;
|
||||
__r = __cv_->in(__st_, __extbuf, __extbuf + __nread, __enxt,
|
||||
&__1buf, &__1buf + 1, __inxt);
|
||||
switch (__r)
|
||||
{
|
||||
case _VSTD::codecvt_base::ok:
|
||||
break;
|
||||
case codecvt_base::partial:
|
||||
__st_ = __sv_st;
|
||||
if (__nread == sizeof(__extbuf))
|
||||
return traits_type::eof();
|
||||
{
|
||||
int __c = getc(__file_);
|
||||
if (__c == EOF)
|
||||
return traits_type::eof();
|
||||
__extbuf[__nread] = static_cast<char>(__c);
|
||||
}
|
||||
++__nread;
|
||||
break;
|
||||
case codecvt_base::error:
|
||||
return traits_type::eof();
|
||||
case _VSTD::codecvt_base::noconv:
|
||||
__1buf = static_cast<char_type>(__extbuf[0]);
|
||||
break;
|
||||
}
|
||||
} while (__r == _VSTD::codecvt_base::partial);
|
||||
}
|
||||
if (!__consume)
|
||||
{
|
||||
for (int __i = __nread; __i > 0;)
|
||||
{
|
||||
if (ungetc(__extbuf[--__i], __file_) == EOF)
|
||||
return traits_type::eof();
|
||||
}
|
||||
}
|
||||
return traits_type::to_int_type(__1buf);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::pbackfail(int_type __c)
|
||||
{
|
||||
if (traits_type::eq_int_type(__c, traits_type::eof()))
|
||||
return __c;
|
||||
char __extbuf[__limit];
|
||||
char* __enxt;
|
||||
const char_type __ci = traits_type::to_char_type(__c);
|
||||
const char_type* __inxt;
|
||||
switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
|
||||
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
|
||||
{
|
||||
case _VSTD::codecvt_base::ok:
|
||||
break;
|
||||
case _VSTD::codecvt_base::noconv:
|
||||
__extbuf[0] = static_cast<char>(__c);
|
||||
__enxt = __extbuf + 1;
|
||||
break;
|
||||
case codecvt_base::partial:
|
||||
case codecvt_base::error:
|
||||
return traits_type::eof();
|
||||
}
|
||||
while (__enxt > __extbuf)
|
||||
if (ungetc(*--__enxt, __file_) == EOF)
|
||||
return traits_type::eof();
|
||||
return traits_type::not_eof(__c);
|
||||
}
|
||||
|
||||
// __stdoutbuf
|
||||
|
||||
template <class _CharT>
|
||||
class _LIBCPP_HIDDEN __stdoutbuf
|
||||
: public basic_streambuf<_CharT, char_traits<_CharT> >
|
||||
{
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
typedef char_traits<char_type> traits_type;
|
||||
typedef typename traits_type::int_type int_type;
|
||||
typedef typename traits_type::pos_type pos_type;
|
||||
typedef typename traits_type::off_type off_type;
|
||||
typedef typename traits_type::state_type state_type;
|
||||
|
||||
explicit __stdoutbuf(FILE* __fp);
|
||||
|
||||
protected:
|
||||
virtual int_type overflow (int_type __c = traits_type::eof());
|
||||
virtual int sync();
|
||||
virtual void imbue(const locale& __loc);
|
||||
|
||||
private:
|
||||
FILE* __file_;
|
||||
const codecvt<char_type, char, state_type>* __cv_;
|
||||
state_type __st_;
|
||||
bool __always_noconv_;
|
||||
|
||||
__stdoutbuf(const __stdoutbuf&);
|
||||
__stdoutbuf& operator=(const __stdoutbuf&);
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp)
|
||||
: __file_(__fp),
|
||||
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
|
||||
__st_(),
|
||||
__always_noconv_(__cv_->always_noconv())
|
||||
{
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
typename __stdoutbuf<_CharT>::int_type
|
||||
__stdoutbuf<_CharT>::overflow(int_type __c)
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
char_type __1buf;
|
||||
if (!traits_type::eq_int_type(__c, traits_type::eof()))
|
||||
{
|
||||
this->setp(&__1buf, &__1buf+1);
|
||||
*this->pptr() = traits_type::to_char_type(__c);
|
||||
this->pbump(1);
|
||||
if (__always_noconv_)
|
||||
{
|
||||
if (fwrite(this->pbase(), sizeof(char_type), 1, __file_) != 1)
|
||||
return traits_type::eof();
|
||||
}
|
||||
else
|
||||
{
|
||||
char* __extbe = __extbuf;
|
||||
codecvt_base::result __r;
|
||||
do
|
||||
{
|
||||
const char_type* __e;
|
||||
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
|
||||
__extbuf,
|
||||
__extbuf + sizeof(__extbuf),
|
||||
__extbe);
|
||||
if (__e == this->pbase())
|
||||
return traits_type::eof();
|
||||
if (__r == codecvt_base::noconv)
|
||||
{
|
||||
if (fwrite(this->pbase(), 1, 1, __file_) != 1)
|
||||
return traits_type::eof();
|
||||
}
|
||||
else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
|
||||
{
|
||||
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
|
||||
if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
|
||||
return traits_type::eof();
|
||||
if (__r == codecvt_base::partial)
|
||||
{
|
||||
this->setp((char_type*)__e, this->pptr());
|
||||
this->pbump(static_cast<int>(this->epptr() - this->pbase()));
|
||||
}
|
||||
}
|
||||
else
|
||||
return traits_type::eof();
|
||||
} while (__r == codecvt_base::partial);
|
||||
}
|
||||
this->setp(0, 0);
|
||||
}
|
||||
return traits_type::not_eof(__c);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
int
|
||||
__stdoutbuf<_CharT>::sync()
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
codecvt_base::result __r;
|
||||
do
|
||||
{
|
||||
char* __extbe;
|
||||
__r = __cv_->unshift(__st_, __extbuf,
|
||||
__extbuf + sizeof(__extbuf),
|
||||
__extbe);
|
||||
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
|
||||
if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
|
||||
return -1;
|
||||
} while (__r == codecvt_base::partial);
|
||||
if (__r == codecvt_base::error)
|
||||
return -1;
|
||||
if (fflush(__file_))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
void
|
||||
__stdoutbuf<_CharT>::imbue(const locale& __loc)
|
||||
{
|
||||
sync();
|
||||
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
|
||||
__always_noconv_ = __cv_->always_noconv();
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___STD_STREAM
|
2293
trunk/include/__tree
Normal file
2293
trunk/include/__tree
Normal file
File diff suppressed because it is too large
Load Diff
269
trunk/include/__tuple
Normal file
269
trunk/include/__tuple
Normal file
@@ -0,0 +1,269 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___TUPLE
|
||||
#define _LIBCPP___TUPLE
|
||||
|
||||
#include <__config>
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#include <__tuple_03>
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<const _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<volatile _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<const volatile _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, volatile _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const volatile _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
|
||||
template <class _T1, class _T2> struct _LIBCPP_VISIBLE pair;
|
||||
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
|
||||
|
||||
template <class _Tp> struct __tuple_like : false_type {};
|
||||
|
||||
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
|
||||
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
|
||||
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
|
||||
|
||||
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
|
||||
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
|
||||
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(tuple<_Tp...>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(const tuple<_Tp...>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||
get(tuple<_Tp...>&&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(const pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||
get(pair<_T1, _T2>&&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_Tp&
|
||||
get(array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&&) _NOEXCEPT;
|
||||
|
||||
// __make_tuple_indices
|
||||
|
||||
template <size_t...> struct __tuple_indices {};
|
||||
|
||||
template <size_t _Sp, class _IntTuple, size_t _Ep>
|
||||
struct __make_indices_imp;
|
||||
|
||||
template <size_t _Sp, size_t ..._Indices, size_t _Ep>
|
||||
struct __make_indices_imp<_Sp, __tuple_indices<_Indices...>, _Ep>
|
||||
{
|
||||
typedef typename __make_indices_imp<_Sp+1, __tuple_indices<_Indices..., _Sp>, _Ep>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ep, size_t ..._Indices>
|
||||
struct __make_indices_imp<_Ep, __tuple_indices<_Indices...>, _Ep>
|
||||
{
|
||||
typedef __tuple_indices<_Indices...> type;
|
||||
};
|
||||
|
||||
template <size_t _Ep, size_t _Sp = 0>
|
||||
struct __make_tuple_indices
|
||||
{
|
||||
static_assert(_Sp <= _Ep, "__make_tuple_indices input error");
|
||||
typedef typename __make_indices_imp<_Sp, __tuple_indices<>, _Ep>::type type;
|
||||
};
|
||||
|
||||
// __tuple_types
|
||||
|
||||
template <class ..._Tp> struct __tuple_types {};
|
||||
|
||||
template <size_t _Ip>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<> >
|
||||
{
|
||||
public:
|
||||
static_assert(_Ip == 0, "tuple_element index out of range");
|
||||
static_assert(_Ip != 0, "tuple_element index out of range");
|
||||
};
|
||||
|
||||
template <class _Hp, class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<0, __tuple_types<_Hp, _Tp...> >
|
||||
{
|
||||
public:
|
||||
typedef _Hp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Hp, class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
|
||||
{
|
||||
public:
|
||||
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
|
||||
};
|
||||
|
||||
template <class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...> >
|
||||
: public integral_constant<size_t, sizeof...(_Tp)>
|
||||
{
|
||||
};
|
||||
|
||||
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {};
|
||||
|
||||
// __make_tuple_types
|
||||
|
||||
// __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a
|
||||
// __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep).
|
||||
// _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a
|
||||
// lvalue_reference type, then __tuple_types<_Types&...> is the result.
|
||||
|
||||
template <class _TupleTypes, class _Tp, size_t _Sp, size_t _Ep>
|
||||
struct __make_tuple_types_imp;
|
||||
|
||||
template <class ..._Types, class _Tp, size_t _Sp, size_t _Ep>
|
||||
struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
|
||||
{
|
||||
typedef typename remove_reference<_Tp>::type _Tpr;
|
||||
typedef typename __make_tuple_types_imp<__tuple_types<_Types...,
|
||||
typename conditional<is_lvalue_reference<_Tp>::value,
|
||||
typename tuple_element<_Sp, _Tpr>::type&,
|
||||
typename tuple_element<_Sp, _Tpr>::type>::type>,
|
||||
_Tp, _Sp+1, _Ep>::type type;
|
||||
};
|
||||
|
||||
template <class ..._Types, class _Tp, size_t _Ep>
|
||||
struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Ep, _Ep>
|
||||
{
|
||||
typedef __tuple_types<_Types...> type;
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, size_t _Sp = 0>
|
||||
struct __make_tuple_types
|
||||
{
|
||||
static_assert(_Sp <= _Ep, "__make_tuple_types input error");
|
||||
typedef typename __make_tuple_types_imp<__tuple_types<>, _Tp, _Sp, _Ep>::type type;
|
||||
};
|
||||
|
||||
// __tuple_convertible
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
struct __tuple_convertible_imp : public false_type {};
|
||||
|
||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
: public integral_constant<bool,
|
||||
is_constructible<_Up0, _Tp0>::value &&
|
||||
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
bool = __tuple_like<_Up>::value>
|
||||
struct __tuple_convertible
|
||||
: public false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_convertible<_Tp, _Up, true, true>
|
||||
: public __tuple_convertible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
{};
|
||||
|
||||
// __tuple_assignable
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
struct __tuple_assignable_imp : public false_type {};
|
||||
|
||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||
struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
: public integral_constant<bool,
|
||||
is_assignable<_Up0&, _Tp0>::value &&
|
||||
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
bool = __tuple_like<_Up>::value>
|
||||
struct __tuple_assignable
|
||||
: public false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_assignable<_Tp, _Up, true, true>
|
||||
: public __tuple_assignable_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
{};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#endif // _LIBCPP___TUPLE
|
27
trunk/include/__tuple_03
Normal file
27
trunk/include/__tuple_03
Normal file
@@ -0,0 +1,27 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___TUPLE_03
|
||||
#define _LIBCPP___TUPLE_03
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
|
||||
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___TUPLE_03
|
19
trunk/include/__undef_min_max
Normal file
19
trunk/include/__undef_min_max
Normal file
@@ -0,0 +1,19 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifdef min
|
||||
#warning: macro min is incompatible with C++. #undef'ing min
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
#ifdef max
|
||||
#warning: macro max is incompatible with C++. #undef'ing max
|
||||
#undef max
|
||||
#endif
|
5394
trunk/include/algorithm
Normal file
5394
trunk/include/algorithm
Normal file
File diff suppressed because it is too large
Load Diff
338
trunk/include/array
Normal file
338
trunk/include/array
Normal file
@@ -0,0 +1,338 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- array -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_ARRAY
|
||||
#define _LIBCPP_ARRAY
|
||||
|
||||
/*
|
||||
array synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <class T, size_t N >
|
||||
struct array
|
||||
{
|
||||
// types:
|
||||
typedef T & reference;
|
||||
typedef const T & const_reference;
|
||||
typedef implementation defined iterator;
|
||||
typedef implementation defined const_iterator;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
void fill(const T& u);
|
||||
void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>())));
|
||||
|
||||
// iterators:
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// capacity:
|
||||
constexpr size_type size() const noexcept;
|
||||
constexpr size_type max_size() const noexcept;
|
||||
bool empty() const noexcept;
|
||||
|
||||
// element access:
|
||||
reference operator[](size_type n);
|
||||
const_reference operator[](size_type n) const;
|
||||
const_reference at(size_type n) const;
|
||||
reference at(size_type n);
|
||||
|
||||
reference front();
|
||||
const_reference front() const;
|
||||
reference back();
|
||||
const_reference back() const;
|
||||
|
||||
T* data() noexcept;
|
||||
const T* data() const noexcept;
|
||||
};
|
||||
|
||||
template <class T, size_t N>
|
||||
bool operator==(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator!=(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator<(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator>(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator<=(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator>=(const array<T,N>& x, const array<T,N>& y);
|
||||
|
||||
template <class T, size_t N >
|
||||
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class T> class tuple_size;
|
||||
template <int I, class T> class tuple_element;
|
||||
template <class T, size_t N> struct tuple_size<array<T, N>>;
|
||||
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
|
||||
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept;
|
||||
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept;
|
||||
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
#if defined(_LIBCPP_NO_EXCEPTIONS)
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
struct _LIBCPP_VISIBLE array
|
||||
{
|
||||
// types:
|
||||
typedef array __self;
|
||||
typedef _Tp value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef value_type* iterator;
|
||||
typedef const value_type* const_iterator;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
value_type __elems_[_Size > 0 ? _Size : 1];
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
|
||||
{_VSTD::fill_n(__elems_, _Size, __u);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{_VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
|
||||
|
||||
// iterators:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT {return iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const _NOEXCEPT {return begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const _NOEXCEPT {return end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
|
||||
|
||||
// capacity:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/ size_type size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const _NOEXCEPT {return _Size == 0;}
|
||||
|
||||
// element access:
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const {return __elems_[__n];}
|
||||
reference at(size_type __n);
|
||||
const_reference at(size_type __n) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return __elems_[0];}
|
||||
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type* data() _NOEXCEPT {return __elems_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const value_type* data() const _NOEXCEPT {return __elems_;}
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
typename array<_Tp, _Size>::reference
|
||||
array<_Tp, _Size>::at(size_type __n)
|
||||
{
|
||||
if (__n >= _Size)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw out_of_range("array::at");
|
||||
#else
|
||||
assert(!"array::at out_of_range");
|
||||
#endif
|
||||
return __elems_[__n];
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
typename array<_Tp, _Size>::const_reference
|
||||
array<_Tp, _Size>::at(size_type __n) const
|
||||
{
|
||||
if (__n >= _Size)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw out_of_range("array::at");
|
||||
#else
|
||||
assert(!"array::at out_of_range");
|
||||
#endif
|
||||
return __elems_[__n];
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return _VSTD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return _VSTD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
typename enable_if
|
||||
<
|
||||
__is_swappable<_Tp>::value,
|
||||
void
|
||||
>::type
|
||||
swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
class _LIBCPP_VISIBLE tuple_size<array<_Tp, _Size> >
|
||||
: public integral_constant<size_t, _Size> {};
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
class _LIBCPP_VISIBLE tuple_size<const array<_Tp, _Size> >
|
||||
: public integral_constant<size_t, _Size> {};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, array<_Tp, _Size> >
|
||||
{
|
||||
public:
|
||||
typedef _Tp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const array<_Tp, _Size> >
|
||||
{
|
||||
public:
|
||||
typedef const _Tp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
_Tp&
|
||||
get(array<_Tp, _Size>& __a) _NOEXCEPT
|
||||
{
|
||||
return __a[_Ip];
|
||||
}
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>& __a) _NOEXCEPT
|
||||
{
|
||||
return __a[_Ip];
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&& __a) _NOEXCEPT
|
||||
{
|
||||
return _VSTD::move(__a[_Ip]);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_ARRAY
|
1515
trunk/include/atomic
Normal file
1515
trunk/include/atomic
Normal file
File diff suppressed because it is too large
Load Diff
1050
trunk/include/bitset
Normal file
1050
trunk/include/bitset
Normal file
File diff suppressed because it is too large
Load Diff
25
trunk/include/cassert
Normal file
25
trunk/include/cassert
Normal file
@@ -0,0 +1,25 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- cassert -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/*
|
||||
cassert synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
assert
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <assert.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
29
trunk/include/ccomplex
Normal file
29
trunk/include/ccomplex
Normal file
@@ -0,0 +1,29 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- ccomplex ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CCOMPLEX
|
||||
#define _LIBCPP_CCOMPLEX
|
||||
|
||||
/*
|
||||
ccomplex synopsis
|
||||
|
||||
#include <complex>
|
||||
|
||||
*/
|
||||
|
||||
#include <complex>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
// hh 080623 Created
|
||||
|
||||
#endif // _LIBCPP_CCOMPLEX
|
164
trunk/include/cctype
Normal file
164
trunk/include/cctype
Normal file
@@ -0,0 +1,164 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- cctype ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CCTYPE
|
||||
#define _LIBCPP_CCTYPE
|
||||
|
||||
/*
|
||||
cctype synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
int isalnum(int c);
|
||||
int isalpha(int c);
|
||||
int isblank(int c); // C99
|
||||
int iscntrl(int c);
|
||||
int isdigit(int c);
|
||||
int isgraph(int c);
|
||||
int islower(int c);
|
||||
int isprint(int c);
|
||||
int ispunct(int c);
|
||||
int isspace(int c);
|
||||
int isupper(int c);
|
||||
int isxdigit(int c);
|
||||
int tolower(int c);
|
||||
int toupper(int c);
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <ctype.h>
|
||||
#if defined(_MSC_VER)
|
||||
#include "support/win32/support.h"
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifdef isalnum
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalnum(int __c) {return isalnum(__c);}
|
||||
#undef isalnum
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isalnum(int __c) {return __libcpp_isalnum(__c);}
|
||||
#else // isalnum
|
||||
using ::isalnum;
|
||||
#endif // isalnum
|
||||
|
||||
#ifdef isalpha
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalpha(int __c) {return isalpha(__c);}
|
||||
#undef isalpha
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isalpha(int __c) {return __libcpp_isalpha(__c);}
|
||||
#else // isalpha
|
||||
using ::isalpha;
|
||||
#endif // isalpha
|
||||
|
||||
#ifdef isblank
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isblank(int __c) {return isblank(__c);}
|
||||
#undef isblank
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isblank(int __c) {return __libcpp_isblank(__c);}
|
||||
#else // isblank
|
||||
using ::isblank;
|
||||
#endif // isblank
|
||||
|
||||
#ifdef iscntrl
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iscntrl(int __c) {return iscntrl(__c);}
|
||||
#undef iscntrl
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iscntrl(int __c) {return __libcpp_iscntrl(__c);}
|
||||
#else // iscntrl
|
||||
using ::iscntrl;
|
||||
#endif // iscntrl
|
||||
|
||||
#ifdef isdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isdigit(int __c) {return isdigit(__c);}
|
||||
#undef isdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isdigit(int __c) {return __libcpp_isdigit(__c);}
|
||||
#else // isdigit
|
||||
using ::isdigit;
|
||||
#endif // isdigit
|
||||
|
||||
#ifdef isgraph
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isgraph(int __c) {return isgraph(__c);}
|
||||
#undef isgraph
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isgraph(int __c) {return __libcpp_isgraph(__c);}
|
||||
#else // isgraph
|
||||
using ::isgraph;
|
||||
#endif // isgraph
|
||||
|
||||
#ifdef islower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_islower(int __c) {return islower(__c);}
|
||||
#undef islower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int islower(int __c) {return __libcpp_islower(__c);}
|
||||
#else // islower
|
||||
using ::islower;
|
||||
#endif // islower
|
||||
|
||||
#ifdef isprint
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isprint(int __c) {return isprint(__c);}
|
||||
#undef isprint
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isprint(int __c) {return __libcpp_isprint(__c);}
|
||||
#else // isprint
|
||||
using ::isprint;
|
||||
#endif // isprint
|
||||
|
||||
#ifdef ispunct
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ispunct(int __c) {return ispunct(__c);}
|
||||
#undef ispunct
|
||||
inline _LIBCPP_INLINE_VISIBILITY int ispunct(int __c) {return __libcpp_ispunct(__c);}
|
||||
#else // ispunct
|
||||
using ::ispunct;
|
||||
#endif // ispunct
|
||||
|
||||
#ifdef isspace
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isspace(int __c) {return isspace(__c);}
|
||||
#undef isspace
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isspace(int __c) {return __libcpp_isspace(__c);}
|
||||
#else // isspace
|
||||
using ::isspace;
|
||||
#endif // isspace
|
||||
|
||||
#ifdef isupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isupper(int __c) {return isupper(__c);}
|
||||
#undef isupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isupper(int __c) {return __libcpp_isupper(__c);}
|
||||
#else // isupper
|
||||
using ::isupper;
|
||||
#endif // isupper
|
||||
|
||||
#ifdef isxdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isxdigit(int __c) {return isxdigit(__c);}
|
||||
#undef isxdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int isxdigit(int __c) {return __libcpp_isxdigit(__c);}
|
||||
#else // isxdigit
|
||||
using ::isxdigit;
|
||||
#endif // isxdigit
|
||||
|
||||
#ifdef tolower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_tolower(int __c) {return tolower(__c);}
|
||||
#undef tolower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int tolower(int __c) {return __libcpp_tolower(__c);}
|
||||
#else // tolower
|
||||
using ::tolower;
|
||||
#endif // tolower
|
||||
|
||||
#ifdef toupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_toupper(int __c) {return toupper(__c);}
|
||||
#undef toupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int toupper(int __c) {return __libcpp_toupper(__c);}
|
||||
#else // toupper
|
||||
using ::toupper;
|
||||
#endif // toupper
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CCTYPE
|
393
trunk/include/cerrno
Normal file
393
trunk/include/cerrno
Normal file
@@ -0,0 +1,393 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- cerrno ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CERRNO
|
||||
#define _LIBCPP_CERRNO
|
||||
|
||||
/*
|
||||
cerrno synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
EDOM
|
||||
EILSEQ // C99
|
||||
ERANGE
|
||||
errno
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <errno.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||
|
||||
#ifdef ELAST
|
||||
|
||||
const int __elast1 = ELAST+1;
|
||||
const int __elast2 = ELAST+2;
|
||||
|
||||
#else
|
||||
|
||||
const int __elast1 = 104;
|
||||
const int __elast2 = 105;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENOTRECOVERABLE
|
||||
|
||||
#define EOWNERDEAD __elast1
|
||||
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST EOWNERDEAD
|
||||
#endif
|
||||
|
||||
#elif defined(EOWNERDEAD)
|
||||
|
||||
#define ENOTRECOVERABLE __elast1
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST ENOTRECOVERABLE
|
||||
#endif
|
||||
|
||||
#else // defined(EOWNERDEAD)
|
||||
|
||||
#define EOWNERDEAD __elast1
|
||||
#define ENOTRECOVERABLE __elast2
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST ENOTRECOVERABLE
|
||||
#endif
|
||||
|
||||
#endif // defined(EOWNERDEAD)
|
||||
|
||||
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||
|
||||
// supply errno values likely to be missing, particularly on Windows
|
||||
|
||||
#ifndef EAFNOSUPPORT
|
||||
#define EAFNOSUPPORT 9901
|
||||
#endif
|
||||
|
||||
#ifndef EADDRINUSE
|
||||
#define EADDRINUSE 9902
|
||||
#endif
|
||||
|
||||
#ifndef EADDRNOTAVAIL
|
||||
#define EADDRNOTAVAIL 9903
|
||||
#endif
|
||||
|
||||
#ifndef EISCONN
|
||||
#define EISCONN 9904
|
||||
#endif
|
||||
|
||||
#ifndef EBADMSG
|
||||
#define EBADMSG 9905
|
||||
#endif
|
||||
|
||||
#ifndef ECONNABORTED
|
||||
#define ECONNABORTED 9906
|
||||
#endif
|
||||
|
||||
#ifndef EALREADY
|
||||
#define EALREADY 9907
|
||||
#endif
|
||||
|
||||
#ifndef ECONNREFUSED
|
||||
#define ECONNREFUSED 9908
|
||||
#endif
|
||||
|
||||
#ifndef ECONNRESET
|
||||
#define ECONNRESET 9909
|
||||
#endif
|
||||
|
||||
#ifndef EDESTADDRREQ
|
||||
#define EDESTADDRREQ 9910
|
||||
#endif
|
||||
|
||||
#ifndef EHOSTUNREACH
|
||||
#define EHOSTUNREACH 9911
|
||||
#endif
|
||||
|
||||
#ifndef EIDRM
|
||||
#define EIDRM 9912
|
||||
#endif
|
||||
|
||||
#ifndef EMSGSIZE
|
||||
#define EMSGSIZE 9913
|
||||
#endif
|
||||
|
||||
#ifndef ENETDOWN
|
||||
#define ENETDOWN 9914
|
||||
#endif
|
||||
|
||||
#ifndef ENETRESET
|
||||
#define ENETRESET 9915
|
||||
#endif
|
||||
|
||||
#ifndef ENETUNREACH
|
||||
#define ENETUNREACH 9916
|
||||
#endif
|
||||
|
||||
#ifndef ENOBUFS
|
||||
#define ENOBUFS 9917
|
||||
#endif
|
||||
|
||||
#ifndef ENOLINK
|
||||
#define ENOLINK 9918
|
||||
#endif
|
||||
|
||||
#ifndef ENODATA
|
||||
#define ENODATA 9919
|
||||
#endif
|
||||
|
||||
#ifndef ENOMSG
|
||||
#define ENOMSG 9920
|
||||
#endif
|
||||
|
||||
#ifndef ENOPROTOOPT
|
||||
#define ENOPROTOOPT 9921
|
||||
#endif
|
||||
|
||||
#ifndef ENOSR
|
||||
#define ENOSR 9922
|
||||
#endif
|
||||
|
||||
#ifndef ENOTSOCK
|
||||
#define ENOTSOCK 9923
|
||||
#endif
|
||||
|
||||
#ifndef ENOSTR
|
||||
#define ENOSTR 9924
|
||||
#endif
|
||||
|
||||
#ifndef ENOTCONN
|
||||
#define ENOTCONN 9925
|
||||
#endif
|
||||
|
||||
#ifndef ENOTSUP
|
||||
#define ENOTSUP 9926
|
||||
#endif
|
||||
|
||||
#ifndef ECANCELED
|
||||
#define ECANCELED 9927
|
||||
#endif
|
||||
|
||||
#ifndef EINPROGRESS
|
||||
#define EINPROGRESS 9928
|
||||
#endif
|
||||
|
||||
#ifndef EOPNOTSUPP
|
||||
#define EOPNOTSUPP 9929
|
||||
#endif
|
||||
|
||||
#ifndef EWOULDBLOCK
|
||||
#define EWOULDBLOCK 9930
|
||||
#endif
|
||||
|
||||
#ifndef EOWNERDEAD
|
||||
#define EOWNERDEAD 9931
|
||||
#endif
|
||||
|
||||
#ifndef EPROTO
|
||||
#define EPROTO 9932
|
||||
#endif
|
||||
|
||||
#ifndef EPROTONOSUPPORT
|
||||
#define EPROTONOSUPPORT 9933
|
||||
#endif
|
||||
|
||||
#ifndef ENOTRECOVERABLE
|
||||
#define ENOTRECOVERABLE 9934
|
||||
#endif
|
||||
|
||||
#ifndef ETIME
|
||||
#define ETIME 9935
|
||||
#endif
|
||||
|
||||
#ifndef ETXTBSY
|
||||
#define ETXTBSY 9936
|
||||
#endif
|
||||
|
||||
#ifndef ETIMEDOUT
|
||||
#define ETIMEDOUT 9938
|
||||
#endif
|
||||
|
||||
#ifndef ELOOP
|
||||
#define ELOOP 9939
|
||||
#endif
|
||||
|
||||
#ifndef EOVERFLOW
|
||||
#define EOVERFLOW 9940
|
||||
#endif
|
||||
|
||||
#ifndef EPROTOTYPE
|
||||
#define EPROTOTYPE 9941
|
||||
#endif
|
||||
|
||||
#ifndef ENOSYS
|
||||
#define ENOSYS 9942
|
||||
#endif
|
||||
|
||||
#ifndef EINVAL
|
||||
#define EINVAL 9943
|
||||
#endif
|
||||
|
||||
#ifndef ERANGE
|
||||
#define ERANGE 9944
|
||||
#endif
|
||||
|
||||
#ifndef EILSEQ
|
||||
#define EILSEQ 9945
|
||||
#endif
|
||||
|
||||
// Windows Mobile doesn't appear to define these:
|
||||
|
||||
#ifndef E2BIG
|
||||
#define E2BIG 9946
|
||||
#endif
|
||||
|
||||
#ifndef EDOM
|
||||
#define EDOM 9947
|
||||
#endif
|
||||
|
||||
#ifndef EFAULT
|
||||
#define EFAULT 9948
|
||||
#endif
|
||||
|
||||
#ifndef EBADF
|
||||
#define EBADF 9949
|
||||
#endif
|
||||
|
||||
#ifndef EPIPE
|
||||
#define EPIPE 9950
|
||||
#endif
|
||||
|
||||
#ifndef EXDEV
|
||||
#define EXDEV 9951
|
||||
#endif
|
||||
|
||||
#ifndef EBUSY
|
||||
#define EBUSY 9952
|
||||
#endif
|
||||
|
||||
#ifndef ENOTEMPTY
|
||||
#define ENOTEMPTY 9953
|
||||
#endif
|
||||
|
||||
#ifndef ENOEXEC
|
||||
#define ENOEXEC 9954
|
||||
#endif
|
||||
|
||||
#ifndef EEXIST
|
||||
#define EEXIST 9955
|
||||
#endif
|
||||
|
||||
#ifndef EFBIG
|
||||
#define EFBIG 9956
|
||||
#endif
|
||||
|
||||
#ifndef ENAMETOOLONG
|
||||
#define ENAMETOOLONG 9957
|
||||
#endif
|
||||
|
||||
#ifndef ENOTTY
|
||||
#define ENOTTY 9958
|
||||
#endif
|
||||
|
||||
#ifndef EINTR
|
||||
#define EINTR 9959
|
||||
#endif
|
||||
|
||||
#ifndef ESPIPE
|
||||
#define ESPIPE 9960
|
||||
#endif
|
||||
|
||||
#ifndef EIO
|
||||
#define EIO 9961
|
||||
#endif
|
||||
|
||||
#ifndef EISDIR
|
||||
#define EISDIR 9962
|
||||
#endif
|
||||
|
||||
#ifndef ECHILD
|
||||
#define ECHILD 9963
|
||||
#endif
|
||||
|
||||
#ifndef ENOLCK
|
||||
#define ENOLCK 9964
|
||||
#endif
|
||||
|
||||
#ifndef ENOSPC
|
||||
#define ENOSPC 9965
|
||||
#endif
|
||||
|
||||
#ifndef ENXIO
|
||||
#define ENXIO 9966
|
||||
#endif
|
||||
|
||||
#ifndef ENODEV
|
||||
#define ENODEV 9967
|
||||
#endif
|
||||
|
||||
#ifndef ENOENT
|
||||
#define ENOENT 9968
|
||||
#endif
|
||||
|
||||
#ifndef ESRCH
|
||||
#define ESRCH 9969
|
||||
#endif
|
||||
|
||||
#ifndef ENOTDIR
|
||||
#define ENOTDIR 9970
|
||||
#endif
|
||||
|
||||
#ifndef ENOMEM
|
||||
#define ENOMEM 9971
|
||||
#endif
|
||||
|
||||
#ifndef EPERM
|
||||
#define EPERM 9972
|
||||
#endif
|
||||
|
||||
#ifndef EACCES
|
||||
#define EACCES 9973
|
||||
#endif
|
||||
|
||||
#ifndef EROFS
|
||||
#define EROFS 9974
|
||||
#endif
|
||||
|
||||
#ifndef EDEADLK
|
||||
#define EDEADLK 9975
|
||||
#endif
|
||||
|
||||
#ifndef EAGAIN
|
||||
#define EAGAIN 9976
|
||||
#endif
|
||||
|
||||
#ifndef ENFILE
|
||||
#define ENFILE 9977
|
||||
#endif
|
||||
|
||||
#ifndef EMFILE
|
||||
#define EMFILE 9978
|
||||
#endif
|
||||
|
||||
#ifndef EMLINK
|
||||
#define EMLINK 9979
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CERRNO
|
82
trunk/include/cfenv
Normal file
82
trunk/include/cfenv
Normal file
@@ -0,0 +1,82 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- cctype ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CFENV
|
||||
#define _LIBCPP_CFENV
|
||||
|
||||
/*
|
||||
cfenv synopsis
|
||||
|
||||
This entire header is C99 / C++0X
|
||||
|
||||
Macros:
|
||||
|
||||
FE_DIVBYZERO
|
||||
FE_INEXACT
|
||||
FE_INVALID
|
||||
FE_OVERFLOW
|
||||
FE_UNDERFLOW
|
||||
FE_ALL_EXCEPT
|
||||
FE_DOWNWARD
|
||||
FE_TONEAREST
|
||||
FE_TOWARDZERO
|
||||
FE_UPWARD
|
||||
FE_DFL_ENV
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
fenv_t
|
||||
fexcept_t
|
||||
|
||||
int feclearexcept(int excepts);
|
||||
int fegetexceptflag(fexcept_t* flagp, int excepts);
|
||||
int feraiseexcept(int excepts);
|
||||
int fesetexceptflag(const fexcept_t* flagp, int excepts);
|
||||
int fetestexcept(int excepts);
|
||||
int fegetround();
|
||||
int fesetround(int round);
|
||||
int fegetenv(fenv_t* envp);
|
||||
int feholdexcept(fenv_t* envp);
|
||||
int fesetenv(const fenv_t* envp);
|
||||
int feupdateenv(const fenv_t* envp);
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <fenv.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::fenv_t;
|
||||
using ::fexcept_t;
|
||||
|
||||
using ::feclearexcept;
|
||||
using ::fegetexceptflag;
|
||||
using ::feraiseexcept;
|
||||
using ::fesetexceptflag;
|
||||
using ::fetestexcept;
|
||||
using ::fegetround;
|
||||
using ::fesetround;
|
||||
using ::fegetenv;
|
||||
using ::feholdexcept;
|
||||
using ::fesetenv;
|
||||
using ::feupdateenv;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CFENV
|
78
trunk/include/cfloat
Normal file
78
trunk/include/cfloat
Normal file
@@ -0,0 +1,78 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cfloat -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CFLOAT
|
||||
#define _LIBCPP_CFLOAT
|
||||
|
||||
/*
|
||||
cfloat synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
FLT_ROUNDS
|
||||
FLT_EVAL_METHOD // C99
|
||||
FLT_RADIX
|
||||
|
||||
FLT_MANT_DIG
|
||||
DBL_MANT_DIG
|
||||
LDBL_MANT_DIG
|
||||
|
||||
DECIMAL_DIG // C99
|
||||
|
||||
FLT_DIG
|
||||
DBL_DIG
|
||||
LDBL_DIG
|
||||
|
||||
FLT_MIN_EXP
|
||||
DBL_MIN_EXP
|
||||
LDBL_MIN_EXP
|
||||
|
||||
FLT_MIN_10_EXP
|
||||
DBL_MIN_10_EXP
|
||||
LDBL_MIN_10_EXP
|
||||
|
||||
FLT_MAX_EXP
|
||||
DBL_MAX_EXP
|
||||
LDBL_MAX_EXP
|
||||
|
||||
FLT_MAX_10_EXP
|
||||
DBL_MAX_10_EXP
|
||||
LDBL_MAX_10_EXP
|
||||
|
||||
FLT_MAX
|
||||
DBL_MAX
|
||||
LDBL_MAX
|
||||
|
||||
FLT_EPSILON
|
||||
DBL_EPSILON
|
||||
LDBL_EPSILON
|
||||
|
||||
FLT_MIN
|
||||
DBL_MIN
|
||||
LDBL_MIN
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <float.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef FLT_EVAL_METHOD
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
#endif
|
||||
|
||||
#ifndef DECIMAL_DIG
|
||||
#define DECIMAL_DIG __DECIMAL_DIG__
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CFLOAT
|
875
trunk/include/chrono
Normal file
875
trunk/include/chrono
Normal file
@@ -0,0 +1,875 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- chrono ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CHRONO
|
||||
#define _LIBCPP_CHRONO
|
||||
|
||||
/*
|
||||
chrono synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
namespace chrono
|
||||
{
|
||||
|
||||
template <class ToDuration, class Rep, class Period>
|
||||
ToDuration
|
||||
duration_cast(const duration<Rep, Period>& fd);
|
||||
|
||||
template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {};
|
||||
|
||||
template <class Rep>
|
||||
struct duration_values
|
||||
{
|
||||
public:
|
||||
static Rep zero();
|
||||
static Rep max();
|
||||
static Rep min();
|
||||
};
|
||||
|
||||
// duration
|
||||
|
||||
template <class Rep, class Period = ratio<1>>
|
||||
class duration
|
||||
{
|
||||
static_assert(!__is_duration<Rep>::value, "A duration representation can not be a duration");
|
||||
static_assert(__is_ratio<Period>::value, "Second template parameter of duration must be a std::ratio");
|
||||
static_assert(Period::num > 0, "duration period must be positive");
|
||||
public:
|
||||
typedef Rep rep;
|
||||
typedef Period period;
|
||||
|
||||
duration() = default;
|
||||
template <class Rep2>
|
||||
explicit duration(const Rep2& r,
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<Rep2, rep>::value &&
|
||||
(treat_as_floating_point<rep>::value ||
|
||||
!treat_as_floating_point<rep>::value && !treat_as_floating_point<Rep2>::value)
|
||||
>::type* = 0);
|
||||
|
||||
// conversions
|
||||
template <class Rep2, class Period2>
|
||||
duration(const duration<Rep2, Period2>& d,
|
||||
typename enable_if
|
||||
<
|
||||
treat_as_floating_point<rep>::value ||
|
||||
ratio_divide<Period2, period>::type::den == 1
|
||||
>::type* = 0);
|
||||
|
||||
// observer
|
||||
|
||||
rep count() const;
|
||||
|
||||
// arithmetic
|
||||
|
||||
duration operator+() const;
|
||||
duration operator-() const;
|
||||
duration& operator++();
|
||||
duration operator++(int);
|
||||
duration& operator--();
|
||||
duration operator--(int);
|
||||
|
||||
duration& operator+=(const duration& d);
|
||||
duration& operator-=(const duration& d);
|
||||
|
||||
duration& operator*=(const rep& rhs);
|
||||
duration& operator/=(const rep& rhs);
|
||||
|
||||
// special values
|
||||
|
||||
static duration zero();
|
||||
static duration min();
|
||||
static duration max();
|
||||
};
|
||||
|
||||
typedef duration<long long, nano> nanoseconds;
|
||||
typedef duration<long long, micro> microseconds;
|
||||
typedef duration<long long, milli> milliseconds;
|
||||
typedef duration<long long > seconds;
|
||||
typedef duration< long, ratio< 60> > minutes;
|
||||
typedef duration< long, ratio<3600> > hours;
|
||||
|
||||
template <class Clock, class Duration = typename Clock::duration>
|
||||
class time_point
|
||||
{
|
||||
public:
|
||||
typedef Clock clock;
|
||||
typedef Duration duration;
|
||||
typedef typename duration::rep rep;
|
||||
typedef typename duration::period period;
|
||||
private:
|
||||
duration d_; // exposition only
|
||||
|
||||
public:
|
||||
time_point(); // has value "epoch"
|
||||
explicit time_point(const duration& d); // same as time_point() + d
|
||||
|
||||
// conversions
|
||||
template <class Duration2>
|
||||
time_point(const time_point<clock, Duration2>& t);
|
||||
|
||||
// observer
|
||||
|
||||
duration time_since_epoch() const;
|
||||
|
||||
// arithmetic
|
||||
|
||||
time_point& operator+=(const duration& d);
|
||||
time_point& operator-=(const duration& d);
|
||||
|
||||
// special values
|
||||
|
||||
static constexpr time_point min();
|
||||
static constexpr time_point max();
|
||||
};
|
||||
|
||||
} // chrono
|
||||
|
||||
// common_type traits
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>;
|
||||
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>;
|
||||
|
||||
namespace chrono {
|
||||
|
||||
// duration arithmetic
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
||||
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
||||
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period, class Rep2>
|
||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||
operator*(const duration<Rep1, Period>& d, const Rep2& s);
|
||||
template <class Rep1, class Period, class Rep2>
|
||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||
operator*(const Rep1& s, const duration<Rep2, Period>& d);
|
||||
template <class Rep1, class Period, class Rep2>
|
||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||
operator/(const duration<Rep1, Period>& d, const Rep2& s);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
typename common_type<Rep1, Rep2>::type
|
||||
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
|
||||
// duration comparisons
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
|
||||
// duration_cast
|
||||
template <class ToDuration, class Rep, class Period>
|
||||
ToDuration duration_cast(const duration<Rep, Period>& d);
|
||||
|
||||
// time_point arithmetic
|
||||
template <class Clock, class Duration1, class Rep2, class Period2>
|
||||
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
|
||||
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Clock, class Duration2>
|
||||
time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type>
|
||||
operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
template <class Clock, class Duration1, class Rep2, class Period2>
|
||||
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
|
||||
operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
typename common_type<Duration1, Duration2>::type
|
||||
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
|
||||
// time_point comparisons
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
bool operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
bool operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
bool operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
bool operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
template <class Clock, class Duration1, class Duration2>
|
||||
bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
|
||||
// time_point_cast
|
||||
|
||||
template <class ToDuration, class Clock, class Duration>
|
||||
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
|
||||
|
||||
// Clocks
|
||||
|
||||
class system_clock
|
||||
{
|
||||
public:
|
||||
typedef microseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<system_clock> time_point;
|
||||
static const bool is_steady = false;
|
||||
|
||||
static time_point now() noexcept;
|
||||
static time_t to_time_t (const time_point& __t) noexcept;
|
||||
static time_point from_time_t(time_t __t) noexcept;
|
||||
};
|
||||
|
||||
class steady_clock
|
||||
{
|
||||
public:
|
||||
typedef nanoseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||
static const bool is_steady = true;
|
||||
|
||||
static time_point now() noexcept;
|
||||
};
|
||||
|
||||
typedef steady_clock high_resolution_clock;
|
||||
|
||||
} // chrono
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <ctime>
|
||||
#include <type_traits>
|
||||
#include <ratio>
|
||||
#include <limits>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
namespace chrono
|
||||
{
|
||||
|
||||
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_VISIBLE duration;
|
||||
|
||||
template <class _Tp>
|
||||
struct __is_duration : false_type {};
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
struct __is_duration<duration<_Rep, _Period> > : true_type {};
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
struct __is_duration<const duration<_Rep, _Period> > : true_type {};
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
struct __is_duration<volatile duration<_Rep, _Period> > : true_type {};
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
|
||||
|
||||
} // chrono
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
struct _LIBCPP_VISIBLE common_type<chrono::duration<_Rep1, _Period1>,
|
||||
chrono::duration<_Rep2, _Period2> >
|
||||
{
|
||||
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
|
||||
typename __ratio_gcd<_Period1, _Period2>::type> type;
|
||||
};
|
||||
|
||||
namespace chrono {
|
||||
|
||||
// duration_cast
|
||||
|
||||
template <class _FromDuration, class _ToDuration,
|
||||
class _Period = typename ratio_divide<typename _FromDuration::period, typename _ToDuration::period>::type,
|
||||
bool = _Period::num == 1,
|
||||
bool = _Period::den == 1>
|
||||
struct __duration_cast;
|
||||
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||
return _ToDuration(static_cast<typename _ToDuration::rep>(
|
||||
static_cast<_Ct>(__fd.count()) / static_cast<_Ct>(_Period::den)));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||
return _ToDuration(static_cast<typename _ToDuration::rep>(
|
||||
static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||
return _ToDuration(static_cast<typename _ToDuration::rep>(
|
||||
static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)
|
||||
/ static_cast<_Ct>(_Period::den)));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _ToDuration, class _Rep, class _Period>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
__is_duration<_ToDuration>::value,
|
||||
_ToDuration
|
||||
>::type
|
||||
duration_cast(const duration<_Rep, _Period>& __fd)
|
||||
{
|
||||
return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
|
||||
}
|
||||
|
||||
template <class _Rep>
|
||||
struct _LIBCPP_VISIBLE treat_as_floating_point : is_floating_point<_Rep> {};
|
||||
|
||||
template <class _Rep>
|
||||
struct _LIBCPP_VISIBLE duration_values
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _Rep max() {return numeric_limits<_Rep>::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _Rep min() {return numeric_limits<_Rep>::lowest();}
|
||||
};
|
||||
|
||||
// duration
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
class _LIBCPP_VISIBLE duration
|
||||
{
|
||||
static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
|
||||
static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
|
||||
static_assert(_Period::num > 0, "duration period must be positive");
|
||||
public:
|
||||
typedef _Rep rep;
|
||||
typedef _Period period;
|
||||
private:
|
||||
rep __rep_;
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration() {} // = default;
|
||||
template <class _Rep2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit duration(const _Rep2& __r,
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Rep2, rep>::value &&
|
||||
(treat_as_floating_point<rep>::value ||
|
||||
!treat_as_floating_point<_Rep2>::value)
|
||||
>::type* = 0)
|
||||
: __rep_(__r) {}
|
||||
|
||||
// conversions
|
||||
template <class _Rep2, class _Period2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
duration(const duration<_Rep2, _Period2>& __d,
|
||||
typename enable_if
|
||||
<
|
||||
treat_as_floating_point<rep>::value ||
|
||||
(ratio_divide<_Period2, period>::type::den == 1 &&
|
||||
!treat_as_floating_point<_Rep2>::value)
|
||||
>::type* = 0)
|
||||
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
|
||||
|
||||
// observer
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
|
||||
|
||||
// arithmetic
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator--(int) {return duration(__rep_--);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator+=(const duration& __d) {__rep_ += __d.count(); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator-=(const duration& __d) {__rep_ -= __d.count(); return *this;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator*=(const rep& rhs) {__rep_ *= rhs; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator/=(const rep& rhs) {__rep_ /= rhs; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator%=(const rep& rhs) {__rep_ %= rhs; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator%=(const duration& rhs) {__rep_ %= rhs.count(); return *this;}
|
||||
|
||||
// special values
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values<rep>::zero());}
|
||||
_LIBCPP_INLINE_VISIBILITY static duration min() {return duration(duration_values<rep>::min());}
|
||||
_LIBCPP_INLINE_VISIBILITY static duration max() {return duration(duration_values<rep>::max());}
|
||||
};
|
||||
|
||||
typedef duration<long long, nano> nanoseconds;
|
||||
typedef duration<long long, micro> microseconds;
|
||||
typedef duration<long long, milli> milliseconds;
|
||||
typedef duration<long long > seconds;
|
||||
typedef duration< long, ratio< 60> > minutes;
|
||||
typedef duration< long, ratio<3600> > hours;
|
||||
|
||||
// Duration ==
|
||||
|
||||
template <class _LhsDuration, class _RhsDuration>
|
||||
struct __duration_eq
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
|
||||
{
|
||||
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
||||
return _Ct(__lhs).count() == _Ct(__rhs).count();
|
||||
}
|
||||
};
|
||||
|
||||
template <class _LhsDuration>
|
||||
struct __duration_eq<_LhsDuration, _LhsDuration>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
|
||||
{return __lhs.count() == __rhs.count();}
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return __duration_eq<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
|
||||
}
|
||||
|
||||
// Duration !=
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
|
||||
// Duration <
|
||||
|
||||
template <class _LhsDuration, class _RhsDuration>
|
||||
struct __duration_lt
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
|
||||
{
|
||||
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
||||
return _Ct(__lhs).count() < _Ct(__rhs).count();
|
||||
}
|
||||
};
|
||||
|
||||
template <class _LhsDuration>
|
||||
struct __duration_lt<_LhsDuration, _LhsDuration>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
|
||||
{return __lhs.count() < __rhs.count();}
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return __duration_lt<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
|
||||
}
|
||||
|
||||
// Duration >
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return __rhs < __lhs;
|
||||
}
|
||||
|
||||
// Duration <=
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return !(__rhs < __lhs);
|
||||
}
|
||||
|
||||
// Duration >=
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return !(__lhs < __rhs);
|
||||
}
|
||||
|
||||
// Duration +
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||
__r += __rhs;
|
||||
return __r;
|
||||
}
|
||||
|
||||
// Duration -
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||
__r -= __rhs;
|
||||
return __r;
|
||||
}
|
||||
|
||||
// Duration *
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
|
||||
duration<typename common_type<_Rep1, _Rep2>::type, _Period>
|
||||
>::type
|
||||
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||
{
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
duration<_Cr, _Period> __r = __d;
|
||||
__r *= static_cast<_Cr>(__s);
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
|
||||
duration<typename common_type<_Rep1, _Rep2>::type, _Period>
|
||||
>::type
|
||||
operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
|
||||
{
|
||||
return __d * __s;
|
||||
}
|
||||
|
||||
// Duration /
|
||||
|
||||
template <class _Duration, class _Rep, bool = __is_duration<_Rep>::value>
|
||||
struct __duration_divide_result
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Duration, class _Rep2,
|
||||
bool = is_convertible<_Rep2,
|
||||
typename common_type<typename _Duration::rep, _Rep2>::type>::value>
|
||||
struct __duration_divide_imp
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
struct __duration_divide_imp<duration<_Rep1, _Period>, _Rep2, true>
|
||||
{
|
||||
typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period> type;
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
|
||||
: __duration_divide_imp<duration<_Rep1, _Period>, _Rep2>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
||||
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||
{
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
duration<_Cr, _Period> __r = __d;
|
||||
__r /= static_cast<_Cr>(__s);
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename common_type<_Rep1, _Rep2>::type
|
||||
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Ct;
|
||||
return _Ct(__lhs).count() / _Ct(__rhs).count();
|
||||
}
|
||||
|
||||
// Duration %
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
||||
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||
{
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
duration<_Cr, _Period> __r = __d;
|
||||
__r %= static_cast<_Cr>(__s);
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||
__r %= __rhs;
|
||||
return __r;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
///////////////////// time_point /////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
template <class _Clock, class _Duration = typename _Clock::duration>
|
||||
class _LIBCPP_VISIBLE time_point
|
||||
{
|
||||
static_assert(__is_duration<_Duration>::value,
|
||||
"Second template parameter of time_point must be a std::chrono::duration");
|
||||
public:
|
||||
typedef _Clock clock;
|
||||
typedef _Duration duration;
|
||||
typedef typename duration::rep rep;
|
||||
typedef typename duration::period period;
|
||||
private:
|
||||
duration __d_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY time_point() : __d_(duration::zero()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit time_point(const duration& __d) : __d_(__d) {}
|
||||
|
||||
// conversions
|
||||
template <class _Duration2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
time_point(const time_point<clock, _Duration2>& t,
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Duration2, duration>::value
|
||||
>::type* = 0)
|
||||
: __d_(t.time_since_epoch()) {}
|
||||
|
||||
// observer
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration time_since_epoch() const {return __d_;}
|
||||
|
||||
// arithmetic
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d;}
|
||||
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d;}
|
||||
|
||||
// special values
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY static time_point min() {return time_point(duration::min());}
|
||||
_LIBCPP_INLINE_VISIBILITY static time_point max() {return time_point(duration::max());}
|
||||
};
|
||||
|
||||
} // chrono
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
struct _LIBCPP_VISIBLE common_type<chrono::time_point<_Clock, _Duration1>,
|
||||
chrono::time_point<_Clock, _Duration2> >
|
||||
{
|
||||
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
|
||||
};
|
||||
|
||||
namespace chrono {
|
||||
|
||||
template <class _ToDuration, class _Clock, class _Duration>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
time_point<_Clock, _ToDuration>
|
||||
time_point_cast(const time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
|
||||
}
|
||||
|
||||
// time_point ==
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return __lhs.time_since_epoch() == __rhs.time_since_epoch();
|
||||
}
|
||||
|
||||
// time_point !=
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
|
||||
// time_point <
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return __lhs.time_since_epoch() < __rhs.time_since_epoch();
|
||||
}
|
||||
|
||||
// time_point >
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return __rhs < __lhs;
|
||||
}
|
||||
|
||||
// time_point <=
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return !(__rhs < __lhs);
|
||||
}
|
||||
|
||||
// time_point >=
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return !(__lhs < __rhs);
|
||||
}
|
||||
|
||||
// time_point operator+(time_point x, duration y);
|
||||
|
||||
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
|
||||
operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
|
||||
_Tr __r(__lhs.time_since_epoch());
|
||||
__r += __rhs;
|
||||
return __r;
|
||||
}
|
||||
|
||||
// time_point operator+(duration x, time_point y);
|
||||
|
||||
template <class _Rep1, class _Period1, class _Clock, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
|
||||
operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return __rhs + __lhs;
|
||||
}
|
||||
|
||||
// time_point operator-(time_point x, duration y);
|
||||
|
||||
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
|
||||
operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
return __lhs + (-__rhs);
|
||||
}
|
||||
|
||||
// duration operator-(time_point x, time_point y);
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename common_type<_Duration1, _Duration2>::type
|
||||
operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
return __lhs.time_since_epoch() - __rhs.time_since_epoch();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
/////////////////////// clocks ///////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
class _LIBCPP_VISIBLE system_clock
|
||||
{
|
||||
public:
|
||||
typedef microseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<system_clock> time_point;
|
||||
static const bool is_steady = false;
|
||||
|
||||
static time_point now() _NOEXCEPT;
|
||||
static time_t to_time_t (const time_point& __t) _NOEXCEPT;
|
||||
static time_point from_time_t(time_t __t) _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_VISIBLE steady_clock
|
||||
{
|
||||
public:
|
||||
typedef nanoseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||
static const bool is_steady = true;
|
||||
|
||||
static time_point now() _NOEXCEPT;
|
||||
};
|
||||
|
||||
typedef steady_clock high_resolution_clock;
|
||||
|
||||
} // chrono
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CHRONO
|
259
trunk/include/cinttypes
Normal file
259
trunk/include/cinttypes
Normal file
@@ -0,0 +1,259 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cinttypes --------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CINTTYPES
|
||||
#define _LIBCPP_CINTTYPES
|
||||
|
||||
/*
|
||||
cinttypes synopsis
|
||||
|
||||
This entire header is C99 / C++0X
|
||||
|
||||
#include <cstdint> // <cinttypes> includes <cstdint>
|
||||
|
||||
Macros:
|
||||
|
||||
PRId8
|
||||
PRId16
|
||||
PRId32
|
||||
PRId64
|
||||
|
||||
PRIdLEAST8
|
||||
PRIdLEAST16
|
||||
PRIdLEAST32
|
||||
PRIdLEAST64
|
||||
|
||||
PRIdFAST8
|
||||
PRIdFAST16
|
||||
PRIdFAST32
|
||||
PRIdFAST64
|
||||
|
||||
PRIdMAX
|
||||
PRIdPTR
|
||||
|
||||
PRIi8
|
||||
PRIi16
|
||||
PRIi32
|
||||
PRIi64
|
||||
|
||||
PRIiLEAST8
|
||||
PRIiLEAST16
|
||||
PRIiLEAST32
|
||||
PRIiLEAST64
|
||||
|
||||
PRIiFAST8
|
||||
PRIiFAST16
|
||||
PRIiFAST32
|
||||
PRIiFAST64
|
||||
|
||||
PRIiMAX
|
||||
PRIiPTR
|
||||
|
||||
PRIo8
|
||||
PRIo16
|
||||
PRIo32
|
||||
PRIo64
|
||||
|
||||
PRIoLEAST8
|
||||
PRIoLEAST16
|
||||
PRIoLEAST32
|
||||
PRIoLEAST64
|
||||
|
||||
PRIoFAST8
|
||||
PRIoFAST16
|
||||
PRIoFAST32
|
||||
PRIoFAST64
|
||||
|
||||
PRIoMAX
|
||||
PRIoPTR
|
||||
|
||||
PRIu8
|
||||
PRIu16
|
||||
PRIu32
|
||||
PRIu64
|
||||
|
||||
PRIuLEAST8
|
||||
PRIuLEAST16
|
||||
PRIuLEAST32
|
||||
PRIuLEAST64
|
||||
|
||||
PRIuFAST8
|
||||
PRIuFAST16
|
||||
PRIuFAST32
|
||||
PRIuFAST64
|
||||
|
||||
PRIuMAX
|
||||
PRIuPTR
|
||||
|
||||
PRIx8
|
||||
PRIx16
|
||||
PRIx32
|
||||
PRIx64
|
||||
|
||||
PRIxLEAST8
|
||||
PRIxLEAST16
|
||||
PRIxLEAST32
|
||||
PRIxLEAST64
|
||||
|
||||
PRIxFAST8
|
||||
PRIxFAST16
|
||||
PRIxFAST32
|
||||
PRIxFAST64
|
||||
|
||||
PRIxMAX
|
||||
PRIxPTR
|
||||
|
||||
PRIX8
|
||||
PRIX16
|
||||
PRIX32
|
||||
PRIX64
|
||||
|
||||
PRIXLEAST8
|
||||
PRIXLEAST16
|
||||
PRIXLEAST32
|
||||
PRIXLEAST64
|
||||
|
||||
PRIXFAST8
|
||||
PRIXFAST16
|
||||
PRIXFAST32
|
||||
PRIXFAST64
|
||||
|
||||
PRIXMAX
|
||||
PRIXPTR
|
||||
|
||||
SCNd8
|
||||
SCNd16
|
||||
SCNd32
|
||||
SCNd64
|
||||
|
||||
SCNdLEAST8
|
||||
SCNdLEAST16
|
||||
SCNdLEAST32
|
||||
SCNdLEAST64
|
||||
|
||||
SCNdFAST8
|
||||
SCNdFAST16
|
||||
SCNdFAST32
|
||||
SCNdFAST64
|
||||
|
||||
SCNdMAX
|
||||
SCNdPTR
|
||||
|
||||
SCNi8
|
||||
SCNi16
|
||||
SCNi32
|
||||
SCNi64
|
||||
|
||||
SCNiLEAST8
|
||||
SCNiLEAST16
|
||||
SCNiLEAST32
|
||||
SCNiLEAST64
|
||||
|
||||
SCNiFAST8
|
||||
SCNiFAST16
|
||||
SCNiFAST32
|
||||
SCNiFAST64
|
||||
|
||||
SCNiMAX
|
||||
SCNiPTR
|
||||
|
||||
SCNo8
|
||||
SCNo16
|
||||
SCNo32
|
||||
SCNo64
|
||||
|
||||
SCNoLEAST8
|
||||
SCNoLEAST16
|
||||
SCNoLEAST32
|
||||
SCNoLEAST64
|
||||
|
||||
SCNoFAST8
|
||||
SCNoFAST16
|
||||
SCNoFAST32
|
||||
SCNoFAST64
|
||||
|
||||
SCNoMAX
|
||||
SCNoPTR
|
||||
|
||||
SCNu8
|
||||
SCNu16
|
||||
SCNu32
|
||||
SCNu64
|
||||
|
||||
SCNuLEAST8
|
||||
SCNuLEAST16
|
||||
SCNuLEAST32
|
||||
SCNuLEAST64
|
||||
|
||||
SCNuFAST8
|
||||
SCNuFAST16
|
||||
SCNuFAST32
|
||||
SCNuFAST64
|
||||
|
||||
SCNuMAX
|
||||
SCNuPTR
|
||||
|
||||
SCNx8
|
||||
SCNx16
|
||||
SCNx32
|
||||
SCNx64
|
||||
|
||||
SCNxLEAST8
|
||||
SCNxLEAST16
|
||||
SCNxLEAST32
|
||||
SCNxLEAST64
|
||||
|
||||
SCNxFAST8
|
||||
SCNxFAST16
|
||||
SCNxFAST32
|
||||
SCNxFAST64
|
||||
|
||||
SCNxMAX
|
||||
SCNxPTR
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
imaxdiv_t
|
||||
|
||||
intmax_t imaxabs(intmax_t j);
|
||||
imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
|
||||
intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base);
|
||||
uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base);
|
||||
intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
|
||||
uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cstdint>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using::imaxdiv_t;
|
||||
|
||||
using::imaxabs;
|
||||
using::imaxdiv;
|
||||
using::strtoimax;
|
||||
using::strtoumax;
|
||||
using::wcstoimax;
|
||||
using::wcstoumax;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CINTTYPES
|
25
trunk/include/ciso646
Normal file
25
trunk/include/ciso646
Normal file
@@ -0,0 +1,25 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- ciso646 ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CISO646
|
||||
#define _LIBCPP_CISO646
|
||||
|
||||
/*
|
||||
ciso646 synopsis
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CISO646
|
48
trunk/include/climits
Normal file
48
trunk/include/climits
Normal file
@@ -0,0 +1,48 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- climits ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CLIMITS
|
||||
#define _LIBCPP_CLIMITS
|
||||
|
||||
/*
|
||||
climits synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
CHAR_BIT
|
||||
SCHAR_MIN
|
||||
SCHAR_MAX
|
||||
UCHAR_MAX
|
||||
CHAR_MIN
|
||||
CHAR_MAX
|
||||
MB_LEN_MAX
|
||||
SHRT_MIN
|
||||
SHRT_MAX
|
||||
USHRT_MAX
|
||||
INT_MIN
|
||||
INT_MAX
|
||||
UINT_MAX
|
||||
LONG_MIN
|
||||
LONG_MAX
|
||||
ULONG_MAX
|
||||
LLONG_MIN // C99
|
||||
LLONG_MAX // C99
|
||||
ULLONG_MAX // C99
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <limits.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CLIMITS
|
53
trunk/include/clocale
Normal file
53
trunk/include/clocale
Normal file
@@ -0,0 +1,53 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- clocale ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CLOCALE
|
||||
#define _LIBCPP_CLOCALE
|
||||
|
||||
/*
|
||||
clocale synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
LC_ALL
|
||||
LC_COLLATE
|
||||
LC_CTYPE
|
||||
LC_MONETARY
|
||||
LC_NUMERIC
|
||||
LC_TIME
|
||||
NULL
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
struct lconv;
|
||||
char* setlocale(int category, const char* locale);
|
||||
lconv* localeconv();
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <locale.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::lconv;
|
||||
using ::setlocale;
|
||||
using ::localeconv;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CLOCALE
|
1640
trunk/include/cmath
Normal file
1640
trunk/include/cmath
Normal file
File diff suppressed because it is too large
Load Diff
547
trunk/include/codecvt
Normal file
547
trunk/include/codecvt
Normal file
@@ -0,0 +1,547 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- codecvt -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CODECVT
|
||||
#define _LIBCPP_CODECVT
|
||||
|
||||
/*
|
||||
codecvt synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
enum codecvt_mode
|
||||
{
|
||||
consume_header = 4,
|
||||
generate_header = 2,
|
||||
little_endian = 1
|
||||
};
|
||||
|
||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
codecvt_mode Mode = (codecvt_mode)0>
|
||||
class codecvt_utf8
|
||||
: public codecvt<Elem, char, mbstate_t>
|
||||
{
|
||||
// unspecified
|
||||
};
|
||||
|
||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
codecvt_mode Mode = (codecvt_mode)0>
|
||||
class codecvt_utf16
|
||||
: public codecvt<Elem, char, mbstate_t>
|
||||
{
|
||||
// unspecified
|
||||
};
|
||||
|
||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
codecvt_mode Mode = (codecvt_mode)0>
|
||||
class codecvt_utf8_utf16
|
||||
: public codecvt<Elem, char, mbstate_t>
|
||||
{
|
||||
// unspecified
|
||||
};
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__locale>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
enum codecvt_mode
|
||||
{
|
||||
consume_header = 4,
|
||||
generate_header = 2,
|
||||
little_endian = 1
|
||||
};
|
||||
|
||||
// codecvt_utf8
|
||||
|
||||
template <class _Elem> class __codecvt_utf8;
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8<wchar_t>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8<char16_t>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8<char32_t>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class _LIBCPP_VISIBLE codecvt_utf8
|
||||
: public __codecvt_utf8<_Elem>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_utf8(size_t __refs = 0)
|
||||
: __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf8() {}
|
||||
};
|
||||
|
||||
// codecvt_utf16
|
||||
|
||||
template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<wchar_t, false>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<wchar_t, true>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<char16_t, false>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<char16_t, true>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<char32_t, false>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<char32_t, true>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class _LIBCPP_VISIBLE codecvt_utf16
|
||||
: public __codecvt_utf16<_Elem, _Mode & little_endian>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_utf16(size_t __refs = 0)
|
||||
: __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf16() {}
|
||||
};
|
||||
|
||||
// codecvt_utf8_utf16
|
||||
|
||||
template <class _Elem> class __codecvt_utf8_utf16;
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8_utf16<wchar_t>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef wchar_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8_utf16<char32_t>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8_utf16<char16_t>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
codecvt_mode _Mode_;
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result
|
||||
do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
|
||||
size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
};
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class _LIBCPP_VISIBLE codecvt_utf8_utf16
|
||||
: public __codecvt_utf8_utf16<_Elem>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_utf8_utf16(size_t __refs = 0)
|
||||
: __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf8_utf16() {}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CODECVT
|
1516
trunk/include/complex
Normal file
1516
trunk/include/complex
Normal file
File diff suppressed because it is too large
Load Diff
35
trunk/include/complex.h
Normal file
35
trunk/include/complex.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- complex.h --------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_COMPLEX_H
|
||||
#define _LIBCPP_COMPLEX_H
|
||||
|
||||
/*
|
||||
complex.h synopsis
|
||||
|
||||
#include <ccomplex>
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <ccomplex>
|
||||
|
||||
#else // __cplusplus
|
||||
|
||||
#include_next <complex.h>
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_COMPLEX_H
|
256
trunk/include/condition_variable
Normal file
256
trunk/include/condition_variable
Normal file
@@ -0,0 +1,256 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------- condition_variable ----------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CONDITION_VARIABLE
|
||||
#define _LIBCPP_CONDITION_VARIABLE
|
||||
|
||||
/*
|
||||
condition_variable synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
enum class cv_status { no_timeout, timeout };
|
||||
|
||||
class condition_variable
|
||||
{
|
||||
public:
|
||||
condition_variable();
|
||||
~condition_variable();
|
||||
|
||||
condition_variable(const condition_variable&) = delete;
|
||||
condition_variable& operator=(const condition_variable&) = delete;
|
||||
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
|
||||
void wait(unique_lock<mutex>& lock);
|
||||
template <class Predicate>
|
||||
void wait(unique_lock<mutex>& lock, Predicate pred);
|
||||
|
||||
template <class Clock, class Duration>
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& lock,
|
||||
const chrono::time_point<Clock, Duration>& abs_time);
|
||||
|
||||
template <class Clock, class Duration, class Predicate>
|
||||
bool
|
||||
wait_until(unique_lock<mutex>& lock,
|
||||
const chrono::time_point<Clock, Duration>& abs_time,
|
||||
Predicate pred);
|
||||
|
||||
template <class Rep, class Period>
|
||||
cv_status
|
||||
wait_for(unique_lock<mutex>& lock,
|
||||
const chrono::duration<Rep, Period>& rel_time);
|
||||
|
||||
template <class Rep, class Period, class Predicate>
|
||||
bool
|
||||
wait_for(unique_lock<mutex>& lock,
|
||||
const chrono::duration<Rep, Period>& rel_time,
|
||||
Predicate pred);
|
||||
|
||||
typedef pthread_cond_t* native_handle_type;
|
||||
native_handle_type native_handle();
|
||||
};
|
||||
|
||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
class condition_variable_any
|
||||
{
|
||||
public:
|
||||
condition_variable_any();
|
||||
~condition_variable_any();
|
||||
|
||||
condition_variable_any(const condition_variable_any&) = delete;
|
||||
condition_variable_any& operator=(const condition_variable_any&) = delete;
|
||||
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
|
||||
template <class Lock>
|
||||
void wait(Lock& lock);
|
||||
template <class Lock, class Predicate>
|
||||
void wait(Lock& lock, Predicate pred);
|
||||
|
||||
template <class Lock, class Clock, class Duration>
|
||||
cv_status
|
||||
wait_until(Lock& lock,
|
||||
const chrono::time_point<Clock, Duration>& abs_time);
|
||||
|
||||
template <class Lock, class Clock, class Duration, class Predicate>
|
||||
bool
|
||||
wait_until(Lock& lock,
|
||||
const chrono::time_point<Clock, Duration>& abs_time,
|
||||
Predicate pred);
|
||||
|
||||
template <class Lock, class Rep, class Period>
|
||||
cv_status
|
||||
wait_for(Lock& lock,
|
||||
const chrono::duration<Rep, Period>& rel_time);
|
||||
|
||||
template <class Lock, class Rep, class Period, class Predicate>
|
||||
bool
|
||||
wait_for(Lock& lock,
|
||||
const chrono::duration<Rep, Period>& rel_time,
|
||||
Predicate pred);
|
||||
};
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__mutex_base>
|
||||
#include <memory>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_VISIBLE condition_variable_any
|
||||
{
|
||||
condition_variable __cv_;
|
||||
shared_ptr<mutex> __mut_;
|
||||
public:
|
||||
condition_variable_any();
|
||||
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
|
||||
template <class _Lock>
|
||||
void wait(_Lock& __lock);
|
||||
template <class _Lock, class _Predicate>
|
||||
void wait(_Lock& __lock, _Predicate __pred);
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration>
|
||||
cv_status
|
||||
wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
||||
bool
|
||||
wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred);
|
||||
|
||||
template <class _Lock, class _Rep, class _Period>
|
||||
cv_status
|
||||
wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d);
|
||||
|
||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||
bool
|
||||
wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred);
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
condition_variable_any::condition_variable_any()
|
||||
: __mut_(make_shared<mutex>()) {}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::notify_one()
|
||||
{
|
||||
{lock_guard<mutex> _(*__mut_);}
|
||||
__cv_.notify_one();
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::notify_all()
|
||||
{
|
||||
{lock_guard<mutex> _(*__mut_);}
|
||||
__cv_.notify_all();
|
||||
}
|
||||
|
||||
struct __lock_external
|
||||
{
|
||||
template <class _Lock>
|
||||
void operator()(_Lock* __m) {__m->lock();}
|
||||
};
|
||||
|
||||
template <class _Lock>
|
||||
void
|
||||
condition_variable_any::wait(_Lock& __lock)
|
||||
{
|
||||
shared_ptr<mutex> __mut = __mut_;
|
||||
unique_lock<mutex> __lk(*__mut);
|
||||
__lock.unlock();
|
||||
unique_ptr<_Lock, __lock_external> __(&__lock);
|
||||
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
|
||||
__cv_.wait(__lk);
|
||||
} // __mut_.unlock(), __lock.lock()
|
||||
|
||||
template <class _Lock, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
|
||||
{
|
||||
while (!__pred())
|
||||
wait(__lock);
|
||||
}
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration>
|
||||
cv_status
|
||||
condition_variable_any::wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
shared_ptr<mutex> __mut = __mut_;
|
||||
unique_lock<mutex> __lk(*__mut);
|
||||
__lock.unlock();
|
||||
unique_ptr<_Lock, __lock_external> __(&__lock);
|
||||
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
|
||||
return __cv_.wait_until(__lk, __t);
|
||||
} // __mut_.unlock(), __lock.lock()
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable_any::wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred)
|
||||
{
|
||||
while (!__pred())
|
||||
if (wait_until(__lock, __t) == cv_status::timeout)
|
||||
return __pred();
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Lock, class _Rep, class _Period>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
cv_status
|
||||
condition_variable_any::wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d);
|
||||
}
|
||||
|
||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable_any::wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d,
|
||||
_VSTD::move(__pred));
|
||||
}
|
||||
|
||||
_LIBCPP_VISIBLE
|
||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CONDITION_VARIABLE
|
52
trunk/include/csetjmp
Normal file
52
trunk/include/csetjmp
Normal file
@@ -0,0 +1,52 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- csetjmp ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSETJMP
|
||||
#define _LIBCPP_CSETJMP
|
||||
|
||||
/*
|
||||
csetjmp synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
setjmp
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
jmp_buf
|
||||
|
||||
void longjmp(jmp_buf env, int val);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <setjmp.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef setjmp
|
||||
#define setjmp(env) setjmp(env)
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::jmp_buf;
|
||||
using ::longjmp;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSETJMP
|
58
trunk/include/csignal
Normal file
58
trunk/include/csignal
Normal file
@@ -0,0 +1,58 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- csignal ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSIGNAL
|
||||
#define _LIBCPP_CSIGNAL
|
||||
|
||||
/*
|
||||
csignal synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
SIG_DFL
|
||||
SIG_ERR
|
||||
SIG_IGN
|
||||
SIGABRT
|
||||
SIGFPE
|
||||
SIGILL
|
||||
SIGINT
|
||||
SIGSEGV
|
||||
SIGTERM
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
sig_atomic_t
|
||||
|
||||
void (*signal(int sig, void (*func)(int)))(int);
|
||||
int raise(int sig);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <signal.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::sig_atomic_t;
|
||||
using ::signal;
|
||||
using ::raise;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSIGNAL
|
48
trunk/include/cstdarg
Normal file
48
trunk/include/cstdarg
Normal file
@@ -0,0 +1,48 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cstdarg ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDARG
|
||||
#define _LIBCPP_CSTDARG
|
||||
|
||||
/*
|
||||
cstdarg synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
type va_arg(va_list ap, type);
|
||||
void va_copy(va_list dest, va_list src); // C99
|
||||
void va_end(va_list ap);
|
||||
void va_start(va_list ap, parmN);
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
va_list
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::va_list;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTDARG
|
32
trunk/include/cstdbool
Normal file
32
trunk/include/cstdbool
Normal file
@@ -0,0 +1,32 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cstdbool ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDBOOL
|
||||
#define _LIBCPP_CSTDBOOL
|
||||
|
||||
/*
|
||||
cstdbool synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
__bool_true_false_are_defined
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#undef __bool_true_false_are_defined
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif // _LIBCPP_CSTDBOOL
|
102
trunk/include/cstddef
Normal file
102
trunk/include/cstddef
Normal file
@@ -0,0 +1,102 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cstddef ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDDEF
|
||||
#define _LIBCPP_CSTDDEF
|
||||
|
||||
/*
|
||||
cstddef synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
offsetof(type,member-designator)
|
||||
NULL
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
ptrdiff_t
|
||||
size_t
|
||||
max_align_t
|
||||
nullptr_t
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
|
||||
#ifdef __GLIBC__
|
||||
#define __need_NULL
|
||||
#define __need_ptrdiff_t
|
||||
#define __need_size_t
|
||||
#endif // __GLIBC__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::ptrdiff_t;
|
||||
using ::size_t;
|
||||
|
||||
typedef long double max_align_t;
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
struct _LIBCPP_VISIBLE nullptr_t
|
||||
{
|
||||
void* _;
|
||||
|
||||
struct __nat {int __for_bool_;};
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
operator _Tp* () const {return 0;}
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
operator _Tp _Up::* () const {return 0;}
|
||||
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
|
||||
};
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||
|
||||
#define nullptr _VSTD::__get_nullptr_t()
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
namespace std
|
||||
{
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
#endif // _LIBCPP_CSTDDEF
|
191
trunk/include/cstdint
Normal file
191
trunk/include/cstdint
Normal file
@@ -0,0 +1,191 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cstdint ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDINT
|
||||
#define _LIBCPP_CSTDINT
|
||||
|
||||
/*
|
||||
cstdint synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
INT8_MIN
|
||||
INT16_MIN
|
||||
INT32_MIN
|
||||
INT64_MIN
|
||||
|
||||
INT8_MAX
|
||||
INT16_MAX
|
||||
INT32_MAX
|
||||
INT64_MAX
|
||||
|
||||
UINT8_MAX
|
||||
UINT16_MAX
|
||||
UINT32_MAX
|
||||
UINT64_MAX
|
||||
|
||||
INT_LEAST8_MIN
|
||||
INT_LEAST16_MIN
|
||||
INT_LEAST32_MIN
|
||||
INT_LEAST64_MIN
|
||||
|
||||
INT_LEAST8_MAX
|
||||
INT_LEAST16_MAX
|
||||
INT_LEAST32_MAX
|
||||
INT_LEAST64_MAX
|
||||
|
||||
UINT_LEAST8_MAX
|
||||
UINT_LEAST16_MAX
|
||||
UINT_LEAST32_MAX
|
||||
UINT_LEAST64_MAX
|
||||
|
||||
INT_FAST8_MIN
|
||||
INT_FAST16_MIN
|
||||
INT_FAST32_MIN
|
||||
INT_FAST64_MIN
|
||||
|
||||
INT_FAST8_MAX
|
||||
INT_FAST16_MAX
|
||||
INT_FAST32_MAX
|
||||
INT_FAST64_MAX
|
||||
|
||||
UINT_FAST8_MAX
|
||||
UINT_FAST16_MAX
|
||||
UINT_FAST32_MAX
|
||||
UINT_FAST64_MAX
|
||||
|
||||
INTPTR_MIN
|
||||
INTPTR_MAX
|
||||
UINTPTR_MAX
|
||||
|
||||
INTMAX_MIN
|
||||
INTMAX_MAX
|
||||
|
||||
UINTMAX_MAX
|
||||
|
||||
PTRDIFF_MIN
|
||||
PTRDIFF_MAX
|
||||
|
||||
SIG_ATOMIC_MIN
|
||||
SIG_ATOMIC_MAX
|
||||
|
||||
SIZE_MAX
|
||||
|
||||
WCHAR_MIN
|
||||
WCHAR_MAX
|
||||
|
||||
WINT_MIN
|
||||
WINT_MAX
|
||||
|
||||
INT8_C(value)
|
||||
INT16_C(value)
|
||||
INT32_C(value)
|
||||
INT64_C(value)
|
||||
|
||||
UINT8_C(value)
|
||||
UINT16_C(value)
|
||||
UINT32_C(value)
|
||||
UINT64_C(value)
|
||||
|
||||
INTMAX_C(value)
|
||||
UINTMAX_C(value)
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
int8_t
|
||||
int16_t
|
||||
int32_t
|
||||
int64_t
|
||||
|
||||
uint8_t
|
||||
uint16_t
|
||||
uint32_t
|
||||
uint64_t
|
||||
|
||||
int_least8_t
|
||||
int_least16_t
|
||||
int_least32_t
|
||||
int_least64_t
|
||||
|
||||
uint_least8_t
|
||||
uint_least16_t
|
||||
uint_least32_t
|
||||
uint_least64_t
|
||||
|
||||
int_fast8_t
|
||||
int_fast16_t
|
||||
int_fast32_t
|
||||
int_fast64_t
|
||||
|
||||
uint_fast8_t
|
||||
uint_fast16_t
|
||||
uint_fast32_t
|
||||
uint_fast64_t
|
||||
|
||||
intptr_t
|
||||
uintptr_t
|
||||
|
||||
intmax_t
|
||||
uintmax_t
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <stdint.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using::int8_t;
|
||||
using::int16_t;
|
||||
using::int32_t;
|
||||
using::int64_t;
|
||||
|
||||
using::uint8_t;
|
||||
using::uint16_t;
|
||||
using::uint32_t;
|
||||
using::uint64_t;
|
||||
|
||||
using::int_least8_t;
|
||||
using::int_least16_t;
|
||||
using::int_least32_t;
|
||||
using::int_least64_t;
|
||||
|
||||
using::uint_least8_t;
|
||||
using::uint_least16_t;
|
||||
using::uint_least32_t;
|
||||
using::uint_least64_t;
|
||||
|
||||
using::int_fast8_t;
|
||||
using::int_fast16_t;
|
||||
using::int_fast32_t;
|
||||
using::int_fast64_t;
|
||||
|
||||
using::uint_fast8_t;
|
||||
using::uint_fast16_t;
|
||||
using::uint_fast32_t;
|
||||
using::uint_fast64_t;
|
||||
|
||||
using::intptr_t;
|
||||
using::uintptr_t;
|
||||
|
||||
using::intmax_t;
|
||||
using::uintmax_t;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTDINT
|
163
trunk/include/cstdio
Normal file
163
trunk/include/cstdio
Normal file
@@ -0,0 +1,163 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- cstdio ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDIO
|
||||
#define _LIBCPP_CSTDIO
|
||||
|
||||
/*
|
||||
cstdio synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
BUFSIZ
|
||||
EOF
|
||||
FILENAME_MAX
|
||||
FOPEN_MAX
|
||||
L_tmpnam
|
||||
NULL
|
||||
SEEK_CUR
|
||||
SEEK_END
|
||||
SEEK_SET
|
||||
TMP_MAX
|
||||
_IOFBF
|
||||
_IOLBF
|
||||
_IONBF
|
||||
stderr
|
||||
stdin
|
||||
stdout
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
FILE
|
||||
fpos_t
|
||||
size_t
|
||||
|
||||
int remove(const char* filename);
|
||||
int rename(const char* old, const char* new);
|
||||
FILE* tmpfile(void);
|
||||
char* tmpnam(char* s);
|
||||
int fclose(FILE* stream);
|
||||
int fflush(FILE* stream);
|
||||
FILE* fopen(const char* restrict filename, const char* restrict mode);
|
||||
FILE* freopen(const char* restrict filename, const char * restrict mode,
|
||||
FILE * restrict stream);
|
||||
void setbuf(FILE* restrict stream, char* restrict buf);
|
||||
int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
|
||||
int fprintf(FILE* restrict stream, const char* restrict format, ...);
|
||||
int fscanf(FILE* restrict stream, const char * restrict format, ...);
|
||||
int printf(const char* restrict format, ...);
|
||||
int scanf(const char* restrict format, ...);
|
||||
int snprintf(char* restrict s, size_t n, const char* restrict format, ...); // C99
|
||||
int sprintf(char* restrict s, const char* restrict format, ...);
|
||||
int sscanf(const char* restrict s, const char* restrict format, ...);
|
||||
int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
|
||||
int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); // C99
|
||||
int vprintf(const char* restrict format, va_list arg);
|
||||
int vscanf(const char* restrict format, va_list arg); // C99
|
||||
int vsnprintf(char* restrict s, size_t n, const char* restrict format, // C99
|
||||
va_list arg);
|
||||
int vsprintf(char* restrict s, const char* restrict format, va_list arg);
|
||||
int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
|
||||
int fgetc(FILE* stream);
|
||||
char* fgets(char* restrict s, int n, FILE* restrict stream);
|
||||
int fputc(int c, FILE* stream);
|
||||
int fputs(const char* restrict s, FILE* restrict stream);
|
||||
int getc(FILE* stream);
|
||||
int getchar(void);
|
||||
char* gets(char* s);
|
||||
int putc(int c, FILE* stream);
|
||||
int putchar(int c);
|
||||
int puts(const char* s);
|
||||
int ungetc(int c, FILE* stream);
|
||||
size_t fread(void* restrict ptr, size_t size, size_t nmemb,
|
||||
FILE* restrict stream);
|
||||
size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
|
||||
FILE* restrict stream);
|
||||
int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
|
||||
int fseek(FILE* stream, long offset, int whence);
|
||||
int fsetpos(FILE*stream, const fpos_t* pos);
|
||||
long ftell(FILE* stream);
|
||||
void rewind(FILE* stream);
|
||||
void clearerr(FILE* stream);
|
||||
int feof(FILE* stream);
|
||||
int ferror(FILE* stream);
|
||||
void perror(const char* s);
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <stdio.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::FILE;
|
||||
using ::fpos_t;
|
||||
using ::size_t;
|
||||
|
||||
using ::remove;
|
||||
using ::rename;
|
||||
using ::tmpfile;
|
||||
using ::tmpnam;
|
||||
using ::fclose;
|
||||
using ::fflush;
|
||||
using ::fopen;
|
||||
using ::freopen;
|
||||
using ::setbuf;
|
||||
using ::setvbuf;
|
||||
using ::fprintf;
|
||||
using ::fscanf;
|
||||
using ::printf;
|
||||
using ::scanf;
|
||||
using ::snprintf;
|
||||
using ::sprintf;
|
||||
using ::sscanf;
|
||||
#ifndef _MSC_VER
|
||||
using ::vfprintf;
|
||||
using ::vfscanf;
|
||||
using ::vscanf;
|
||||
using ::vsscanf;
|
||||
#endif // _MSC_VER
|
||||
using ::vprintf;
|
||||
using ::vsnprintf;
|
||||
using ::vsprintf;
|
||||
using ::fgetc;
|
||||
using ::fgets;
|
||||
using ::fputc;
|
||||
using ::fputs;
|
||||
using ::getc;
|
||||
using ::getchar;
|
||||
using ::gets;
|
||||
using ::putc;
|
||||
using ::putchar;
|
||||
using ::puts;
|
||||
using ::ungetc;
|
||||
using ::fread;
|
||||
using ::fwrite;
|
||||
using ::fgetpos;
|
||||
using ::fseek;
|
||||
using ::fsetpos;
|
||||
using ::ftell;
|
||||
using ::rewind;
|
||||
using ::clearerr;
|
||||
using ::feof;
|
||||
using ::ferror;
|
||||
using ::perror;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTDIO
|
145
trunk/include/cstdlib
Normal file
145
trunk/include/cstdlib
Normal file
@@ -0,0 +1,145 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cstdlib ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTDLIB
|
||||
#define _LIBCPP_CSTDLIB
|
||||
|
||||
/*
|
||||
cstdlib synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
EXIT_FAILURE
|
||||
EXIT_SUCCESS
|
||||
MB_CUR_MAX
|
||||
NULL
|
||||
RAND_MAX
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
size_t
|
||||
div_t
|
||||
ldiv_t
|
||||
lldiv_t // C99
|
||||
|
||||
double atof (const char* nptr);
|
||||
int atoi (const char* nptr);
|
||||
long atol (const char* nptr);
|
||||
long long atoll(const char* nptr); // C99
|
||||
double strtod (const char* restrict nptr, char** restrict endptr);
|
||||
float strtof (const char* restrict nptr, char** restrict endptr); // C99
|
||||
long double strtold (const char* restrict nptr, char** restrict endptr); // C99
|
||||
long strtol (const char* restrict nptr, char** restrict endptr, int base);
|
||||
long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99
|
||||
unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base);
|
||||
unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99
|
||||
int rand(void);
|
||||
void srand(unsigned int seed);
|
||||
void* calloc(size_t nmemb, size_t size);
|
||||
void free(void* ptr);
|
||||
void* malloc(size_t size);
|
||||
void* realloc(void* ptr, size_t size);
|
||||
void abort(void);
|
||||
int atexit(void (*func)(void));
|
||||
void exit(int status);
|
||||
void _Exit(int status);
|
||||
char* getenv(const char* name);
|
||||
int system(const char* string);
|
||||
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
|
||||
int (*compar)(const void *, const void *));
|
||||
void qsort(void* base, size_t nmemb, size_t size,
|
||||
int (*compar)(const void *, const void *));
|
||||
int abs( int j);
|
||||
long abs( long j);
|
||||
long long abs(long long j); // C++0X
|
||||
long labs( long j);
|
||||
long long llabs(long long j); // C99
|
||||
div_t div( int numer, int denom);
|
||||
ldiv_t div( long numer, long denom);
|
||||
lldiv_t div(long long numer, long long denom); // C++0X
|
||||
ldiv_t ldiv( long numer, long denom);
|
||||
lldiv_t lldiv(long long numer, long long denom); // C99
|
||||
int mblen(const char* s, size_t n);
|
||||
int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
|
||||
int wctomb(char* s, wchar_t wchar);
|
||||
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
|
||||
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <stdlib.h>
|
||||
#ifdef _MSC_VER
|
||||
#include "support/win32/locale_win32.h"
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::size_t;
|
||||
using ::div_t;
|
||||
using ::ldiv_t;
|
||||
using ::lldiv_t;
|
||||
using ::atof;
|
||||
using ::atoi;
|
||||
using ::atol;
|
||||
using ::atoll;
|
||||
using ::strtod;
|
||||
using ::strtof;
|
||||
using ::strtold;
|
||||
using ::strtol;
|
||||
using ::strtoll;
|
||||
using ::strtoul;
|
||||
using ::strtoull;
|
||||
using ::rand;
|
||||
using ::srand;
|
||||
using ::calloc;
|
||||
using ::free;
|
||||
using ::malloc;
|
||||
using ::realloc;
|
||||
using ::abort;
|
||||
using ::atexit;
|
||||
using ::exit;
|
||||
using ::_Exit;
|
||||
using ::getenv;
|
||||
using ::system;
|
||||
using ::bsearch;
|
||||
using ::qsort;
|
||||
using ::abs;
|
||||
using ::labs;
|
||||
using ::llabs;
|
||||
using ::div;
|
||||
using ::ldiv;
|
||||
using ::lldiv;
|
||||
using ::mblen;
|
||||
using ::mbtowc;
|
||||
using ::wctomb;
|
||||
using ::mbstowcs;
|
||||
using ::wcstombs;
|
||||
|
||||
#ifndef _MSC_VER // MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
|
||||
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) {return labs(__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) {return ldiv(__x, __y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
|
||||
#endif // _MSC_VER
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTDLIB
|
112
trunk/include/cstring
Normal file
112
trunk/include/cstring
Normal file
@@ -0,0 +1,112 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- cstring ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CSTRING
|
||||
#define _LIBCPP_CSTRING
|
||||
|
||||
/*
|
||||
cstring synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
NULL
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
Types:
|
||||
|
||||
size_t
|
||||
|
||||
void* memcpy(void* restrict s1, const void* restrict s2, size_t n);
|
||||
void* memmove(void* s1, const void* s2, size_t n);
|
||||
char* strcpy (char* restrict s1, const char* restrict s2);
|
||||
char* strncpy(char* restrict s1, const char* restrict s2, size_t n);
|
||||
char* strcat (char* restrict s1, const char* restrict s2);
|
||||
char* strncat(char* restrict s1, const char* restrict s2, size_t n);
|
||||
int memcmp(const void* s1, const void* s2, size_t n);
|
||||
int strcmp (const char* s1, const char* s2);
|
||||
int strncmp(const char* s1, const char* s2, size_t n);
|
||||
int strcoll(const char* s1, const char* s2);
|
||||
size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n);
|
||||
const void* memchr(const void* s, int c, size_t n);
|
||||
void* memchr( void* s, int c, size_t n);
|
||||
const char* strchr(const char* s, int c);
|
||||
char* strchr( char* s, int c);
|
||||
size_t strcspn(const char* s1, const char* s2);
|
||||
const char* strpbrk(const char* s1, const char* s2);
|
||||
char* strpbrk( char* s1, const char* s2);
|
||||
const char* strrchr(const char* s, int c);
|
||||
char* strrchr( char* s, int c);
|
||||
size_t strspn(const char* s1, const char* s2);
|
||||
const char* strstr(const char* s1, const char* s2);
|
||||
char* strstr( char* s1, const char* s2);
|
||||
char* strtok(char* restrict s1, const char* restrict s2);
|
||||
void* memset(void* s, int c, size_t n);
|
||||
char* strerror(int errnum);
|
||||
size_t strlen(const char* s);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::size_t;
|
||||
using ::memcpy;
|
||||
using ::memmove;
|
||||
using ::strcpy;
|
||||
using ::strncpy;
|
||||
using ::strcat;
|
||||
using ::strncat;
|
||||
using ::memcmp;
|
||||
using ::strcmp;
|
||||
using ::strncmp;
|
||||
using ::strcoll;
|
||||
using ::strxfrm;
|
||||
|
||||
using ::memchr;
|
||||
|
||||
using ::strchr;
|
||||
|
||||
using ::strcspn;
|
||||
|
||||
using ::strpbrk;
|
||||
|
||||
using ::strrchr;
|
||||
|
||||
using ::strspn;
|
||||
|
||||
using ::strstr;
|
||||
|
||||
// MSVC, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
|
||||
#if !defined(__GLIBC__) && !defined(_MSC_VER)
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
|
||||
#endif
|
||||
|
||||
using ::strtok;
|
||||
using ::memset;
|
||||
using ::strerror;
|
||||
using ::strlen;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CSTRING
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user