Compare commits
25 Commits
svn-tags/l
...
2.6.38.2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1179b32b93 | ||
![]() |
1160236b87 | ||
![]() |
afb2c7d9ff | ||
![]() |
58da822e10 | ||
![]() |
a02851e8a2 | ||
![]() |
3e93e96dff | ||
![]() |
b8a03c763a | ||
![]() |
d615e47bea | ||
![]() |
154002bb5d | ||
![]() |
41fb6e1432 | ||
![]() |
86e78d694c | ||
![]() |
770a3c5116 | ||
![]() |
d0a2fbfe60 | ||
![]() |
f9b8998795 | ||
![]() |
6e5e7e78ee | ||
![]() |
5885da34ce | ||
![]() |
80586729e4 | ||
![]() |
8dcad976e0 | ||
![]() |
542b0f0cf5 | ||
![]() |
fddf722f4e | ||
![]() |
171869e27c | ||
![]() |
df85e57f4a | ||
![]() |
e7c8da6f2d | ||
![]() |
b2080c70d4 | ||
![]() |
5a245dbf52 |
@@ -5,10 +5,10 @@
|
||||
#===============================================================================
|
||||
|
||||
project(libcxx CXX C)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
cmake_minimum_required(VERSION 2.6.4)
|
||||
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION trunk-svn)
|
||||
set(PACKAGE_VERSION lll)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
|
||||
|
||||
|
@@ -184,10 +184,12 @@ namespace std {
|
||||
#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
|
||||
@@ -207,7 +209,6 @@ namespace std {
|
||||
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
|
@@ -29,9 +29,9 @@ template <class _NodePtr>
|
||||
struct __hash_node_base
|
||||
{
|
||||
typedef __hash_node_base __first_node;
|
||||
typedef _NodePtr pointer;
|
||||
// typedef _NodePtr pointer;
|
||||
|
||||
pointer __next_;
|
||||
_NodePtr __next_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_node_base() : __next_(nullptr) {}
|
||||
};
|
||||
|
@@ -769,6 +769,7 @@ public:
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
|
||||
typedef __tree_node<value_type, typename __alloc_traits::void_pointer> __node;
|
||||
typedef __tree_node_base<typename __alloc_traits::void_pointer> __node_base;
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__node>
|
||||
@@ -779,10 +780,10 @@ public:
|
||||
typedef allocator_traits<__node_allocator> __node_traits;
|
||||
typedef typename __node_traits::pointer __node_pointer;
|
||||
typedef typename __node_traits::const_pointer __node_const_pointer;
|
||||
typedef typename __node::base::pointer __node_base_pointer;
|
||||
typedef typename __node::base::const_pointer __node_base_const_pointer;
|
||||
typedef typename __node_base::pointer __node_base_pointer;
|
||||
typedef typename __node_base::const_pointer __node_base_const_pointer;
|
||||
private:
|
||||
typedef typename __node::base::base __end_node_t;
|
||||
typedef typename __node_base::base __end_node_t;
|
||||
typedef typename pointer_traits<__node_pointer>::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind<__end_node_t>
|
||||
@@ -910,13 +911,12 @@ public:
|
||||
iterator __insert_multi(_V&& __v);
|
||||
template <class _V>
|
||||
iterator __insert_multi(const_iterator __p, _V&& __v);
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
pair<iterator, bool> __insert_unique(const value_type& __v);
|
||||
iterator __insert_unique(const_iterator __p, const value_type& __v);
|
||||
iterator __insert_multi(const value_type& __v);
|
||||
iterator __insert_multi(const_iterator __p, const value_type& __v);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
|
||||
iterator __node_insert_unique(const_iterator __p,
|
||||
@@ -997,19 +997,19 @@ public:
|
||||
|
||||
__node_holder remove(const_iterator __p);
|
||||
private:
|
||||
typename __node::base::pointer&
|
||||
__find_leaf_low(typename __node::base::pointer& __parent, const value_type& __v);
|
||||
typename __node::base::pointer&
|
||||
__find_leaf_high(typename __node::base::pointer& __parent, const value_type& __v);
|
||||
typename __node::base::pointer&
|
||||
typename __node_base::pointer&
|
||||
__find_leaf_low(typename __node_base::pointer& __parent, const value_type& __v);
|
||||
typename __node_base::pointer&
|
||||
__find_leaf_high(typename __node_base::pointer& __parent, const value_type& __v);
|
||||
typename __node_base::pointer&
|
||||
__find_leaf(const_iterator __hint,
|
||||
typename __node::base::pointer& __parent, const value_type& __v);
|
||||
typename __node_base::pointer& __parent, const value_type& __v);
|
||||
template <class _Key>
|
||||
typename __node::base::pointer&
|
||||
__find_equal(typename __node::base::pointer& __parent, const _Key& __v);
|
||||
typename __node_base::pointer&
|
||||
__find_equal(typename __node_base::pointer& __parent, const _Key& __v);
|
||||
template <class _Key>
|
||||
typename __node::base::pointer&
|
||||
__find_equal(const_iterator __hint, typename __node::base::pointer& __parent,
|
||||
typename __node_base::pointer&
|
||||
__find_equal(const_iterator __hint, typename __node_base::pointer& __parent,
|
||||
const _Key& __v);
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
@@ -1411,8 +1411,8 @@ __tree<_Tp, _Compare, _Allocator>::clear()
|
||||
// Set __parent to parent of null leaf
|
||||
// Return reference to null leaf
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node::base::pointer& __parent,
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer& __parent,
|
||||
const value_type& __v)
|
||||
{
|
||||
__node_pointer __nd = __root();
|
||||
@@ -1450,8 +1450,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node::base::pointe
|
||||
// Set __parent to parent of null leaf
|
||||
// Return reference to null leaf
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node::base::pointer& __parent,
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointer& __parent,
|
||||
const value_type& __v)
|
||||
{
|
||||
__node_pointer __nd = __root();
|
||||
@@ -1492,9 +1492,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node::base::point
|
||||
// Set __parent to parent of null leaf
|
||||
// Return reference to null leaf
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
|
||||
typename __node::base::pointer& __parent,
|
||||
typename __node_base::pointer& __parent,
|
||||
const value_type& __v)
|
||||
{
|
||||
if (__hint == end() || !value_comp()(*__hint, __v)) // check before
|
||||
@@ -1528,8 +1528,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
|
||||
// If __v exists, set parent to node of __v and return reference to node of __v
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _Key>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node::base::pointer& __parent,
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& __parent,
|
||||
const _Key& __v)
|
||||
{
|
||||
__node_pointer __nd = __root();
|
||||
@@ -1577,9 +1577,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node::base::pointer&
|
||||
// If __v exists, set parent to node of __v and return reference to node of __v
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _Key>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
|
||||
typename __node::base::pointer& __parent,
|
||||
typename __node_base::pointer& __parent,
|
||||
const _Key& __v)
|
||||
{
|
||||
if (__hint == end() || value_comp()(__v, *__hint)) // check before
|
||||
@@ -1728,18 +1728,11 @@ template <class _V>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
|
||||
{
|
||||
__node_base_pointer __parent;
|
||||
__node_base_pointer& __child = __find_equal(__parent, __v);
|
||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||
bool __inserted = false;
|
||||
if (__child == nullptr)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
|
||||
__insert_node_at(__parent, __child, __h.get());
|
||||
__r = __h.release();
|
||||
__inserted = true;
|
||||
}
|
||||
return pair<iterator, bool>(iterator(__r), __inserted);
|
||||
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
|
||||
pair<iterator, bool> __r = __node_insert_unique(__h.get());
|
||||
if (__r.second)
|
||||
__h.release();
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
@@ -1747,16 +1740,11 @@ template <class _V>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
|
||||
{
|
||||
__node_base_pointer __parent;
|
||||
__node_base_pointer& __child = __find_equal(__p, __parent, __v);
|
||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||
if (__child == nullptr)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
|
||||
__insert_node_at(__parent, __child, __h.get());
|
||||
__r = __h.release();
|
||||
}
|
||||
return iterator(__r);
|
||||
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
|
||||
iterator __r = __node_insert_unique(__p, __h.get());
|
||||
if (__r.__ptr_ == __h.get())
|
||||
__h.release();
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
@@ -1796,6 +1784,8 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
|
||||
return _STD::move(__h);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const value_type& __v)
|
||||
@@ -1852,8 +1842,6 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const valu
|
||||
return iterator(__h.release());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
|
||||
|
@@ -214,7 +214,11 @@ 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,
|
||||
#if 1 // waiting on cwg 1170
|
||||
is_convertible<_Tp0, _Up0>::value &&
|
||||
#else
|
||||
is_constructible<_Up0, _Tp0>::value &&
|
||||
#endif
|
||||
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
|
@@ -1559,8 +1559,17 @@ typename enable_if
|
||||
>::type
|
||||
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
|
||||
{
|
||||
for (; __n > 0; --__n, ++__first, ++__result)
|
||||
if (__n > 0)
|
||||
{
|
||||
*__result = *__first;
|
||||
++__result;
|
||||
for (--__n; __n > 0; --__n)
|
||||
{
|
||||
++__first;
|
||||
*__result = *__first;
|
||||
++__result;
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
|
@@ -530,6 +530,10 @@ void atomic_signal_fence(memory_order m);
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if !__has_feature(cxx_atomic)
|
||||
#error <atomic> is not implemented
|
||||
#else
|
||||
|
||||
typedef enum memory_order
|
||||
{
|
||||
memory_order_relaxed, memory_order_consume, memory_order_acquire,
|
||||
@@ -1502,6 +1506,8 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
|
||||
#define ATOMIC_LONG_LOCK_FREE 0
|
||||
#define ATOMIC_LLONG_LOCK_FREE 0
|
||||
|
||||
#endif // !__has_feature(cxx_atomic)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_ATOMIC
|
||||
|
@@ -801,6 +801,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
|
||||
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
|
||||
if (__sen)
|
||||
{
|
||||
#if 1
|
||||
typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
|
||||
if (_Traits::eq_int_type(__i, _Traits::eof()))
|
||||
__is.setstate(ios_base::eofbit | ios_base::failbit);
|
||||
else
|
||||
__c = _Traits::to_char_type(__i);
|
||||
#else
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
||||
_I __i(__is);
|
||||
_I __eof;
|
||||
@@ -812,6 +819,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
|
||||
}
|
||||
else
|
||||
__is.setstate(ios_base::eofbit | ios_base::failbit);
|
||||
#endif
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
|
@@ -522,6 +522,12 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
|
||||
unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
|
||||
unsigned* __g, unsigned*& __g_end, _CharT* __atoms)
|
||||
{
|
||||
if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25]))
|
||||
{
|
||||
*__a_end++ = __ct == __atoms[24] ? '+' : '-';
|
||||
__dc = 0;
|
||||
return 0;
|
||||
}
|
||||
if (__ct == __thousands_sep && __grouping.size() != 0)
|
||||
{
|
||||
if (__g_end-__g < __num_get_buf_sz)
|
||||
@@ -532,22 +538,28 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
|
||||
return 0;
|
||||
}
|
||||
ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms;
|
||||
if (__f >= 26)
|
||||
if (__f >= 24)
|
||||
return -1;
|
||||
if (__a_end-__a < __num_get_buf_sz - 1)
|
||||
*__a_end++ = __src[__f];
|
||||
switch (__base)
|
||||
{
|
||||
case 8:
|
||||
case 10:
|
||||
if (__f >= __base)
|
||||
return 0;
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
if (__f >= 22)
|
||||
case 16:
|
||||
if (__f < 22)
|
||||
break;
|
||||
if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0')
|
||||
{
|
||||
__dc = 0;
|
||||
*__a_end++ = __src[__f];
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (__a_end-__a < __num_get_buf_sz - 1)
|
||||
*__a_end++ = __src[__f];
|
||||
++__dc;
|
||||
return 0;
|
||||
}
|
||||
@@ -733,22 +745,27 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
|
||||
{
|
||||
if (__a != __a_end)
|
||||
{
|
||||
int __save_errno = errno;
|
||||
errno = 0;
|
||||
char *__p2;
|
||||
long long __ll = strtoll_l(__a, &__p2, __base, 0);
|
||||
int __current_errno = errno;
|
||||
if (__current_errno == 0)
|
||||
errno = __save_errno;
|
||||
if (__p2 != __a_end)
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return 0;
|
||||
}
|
||||
else if (__ll > numeric_limits<_Tp>::max())
|
||||
else if (__current_errno == ERANGE ||
|
||||
__ll < numeric_limits<_Tp>::min() ||
|
||||
numeric_limits<_Tp>::max() < __ll)
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return numeric_limits<_Tp>::max();
|
||||
}
|
||||
else if (__ll < numeric_limits<_Tp>::min())
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return numeric_limits<_Tp>::min();
|
||||
if (__ll > 0)
|
||||
return numeric_limits<_Tp>::max();
|
||||
else
|
||||
return numeric_limits<_Tp>::min();
|
||||
}
|
||||
return static_cast<_Tp>(__ll);
|
||||
}
|
||||
@@ -763,14 +780,25 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
|
||||
{
|
||||
if (__a != __a_end)
|
||||
{
|
||||
if (*__a == '-')
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return 0;
|
||||
}
|
||||
int __save_errno = errno;
|
||||
errno = 0;
|
||||
char *__p2;
|
||||
unsigned long long __ll = strtoull_l(__a, &__p2, __base, 0);
|
||||
int __current_errno = errno;
|
||||
if (__current_errno == 0)
|
||||
errno = __save_errno;
|
||||
if (__p2 != __a_end)
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return 0;
|
||||
}
|
||||
else if (__ll > numeric_limits<_Tp>::max())
|
||||
else if (__current_errno == ERANGE ||
|
||||
numeric_limits<_Tp>::max() < __ll)
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return numeric_limits<_Tp>::max();
|
||||
@@ -3474,7 +3502,7 @@ extern template class money_put<wchar_t>;
|
||||
class _LIBCPP_VISIBLE messages_base
|
||||
{
|
||||
public:
|
||||
typedef nl_catd catalog;
|
||||
typedef ptrdiff_t catalog;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE messages_base() {}
|
||||
};
|
||||
@@ -3531,7 +3559,10 @@ template <class _CharT>
|
||||
typename messages<_CharT>::catalog
|
||||
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
|
||||
{
|
||||
return catopen(__nm.c_str(), NL_CAT_LOCALE);
|
||||
catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
|
||||
if (__cat != -1)
|
||||
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
|
||||
return __cat;
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
@@ -3543,7 +3574,10 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
|
||||
__narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
|
||||
__dflt.c_str(),
|
||||
__dflt.c_str() + __dflt.size());
|
||||
char* __n = catgets(__c, __set, __msgid, __ndflt.c_str());
|
||||
if (__c != -1)
|
||||
__c <<= 1;
|
||||
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
|
||||
char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
|
||||
string_type __w;
|
||||
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
|
||||
__n, __n + strlen(__n));
|
||||
@@ -3554,7 +3588,10 @@ template <class _CharT>
|
||||
void
|
||||
messages<_CharT>::do_close(catalog __c) const
|
||||
{
|
||||
catclose(__c);
|
||||
if (__c != -1)
|
||||
__c <<= 1;
|
||||
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
|
||||
catclose(__cat);
|
||||
}
|
||||
|
||||
extern template class messages<char>;
|
||||
|
12
include/map
12
include/map
@@ -493,11 +493,11 @@ class _LIBCPP_VISIBLE __map_iterator
|
||||
_TreeIterator __i_;
|
||||
|
||||
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
|
||||
typedef const typename _TreeIterator::value_type::first_type key_type;
|
||||
typedef typename _TreeIterator::value_type::second_type mapped_type;
|
||||
typedef const typename _TreeIterator::value_type::first_type __key_type;
|
||||
typedef typename _TreeIterator::value_type::second_type __mapped_type;
|
||||
public:
|
||||
typedef bidirectional_iterator_tag iterator_category;
|
||||
typedef pair<key_type, mapped_type> value_type;
|
||||
typedef pair<__key_type, __mapped_type> value_type;
|
||||
typedef typename _TreeIterator::difference_type difference_type;
|
||||
typedef value_type& reference;
|
||||
typedef typename __pointer_traits::template
|
||||
@@ -558,11 +558,11 @@ class _LIBCPP_VISIBLE __map_const_iterator
|
||||
_TreeIterator __i_;
|
||||
|
||||
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
|
||||
typedef const typename _TreeIterator::value_type::first_type key_type;
|
||||
typedef typename _TreeIterator::value_type::second_type mapped_type;
|
||||
typedef const typename _TreeIterator::value_type::first_type __key_type;
|
||||
typedef typename _TreeIterator::value_type::second_type __mapped_type;
|
||||
public:
|
||||
typedef bidirectional_iterator_tag iterator_category;
|
||||
typedef pair<key_type, mapped_type> value_type;
|
||||
typedef pair<__key_type, __mapped_type> value_type;
|
||||
typedef typename _TreeIterator::difference_type difference_type;
|
||||
typedef const value_type& reference;
|
||||
typedef typename __pointer_traits::template
|
||||
|
@@ -1276,7 +1276,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
|
||||
|
||||
template <class _CharT, class _Traits, size_t _Size>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, bitset<_Size>& __x)
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
|
||||
{
|
||||
return __os << __x.template to_string<_CharT, _Traits>
|
||||
(use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),
|
||||
|
@@ -1264,6 +1264,7 @@ struct __state
|
||||
vector<pair<size_t, const _CharT*> > __loop_data_;
|
||||
const __node<_CharT>* __node_;
|
||||
regex_constants::match_flag_type __flags_;
|
||||
bool __at_first_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__state()
|
||||
@@ -1890,6 +1891,40 @@ __word_boundary<_CharT, _Traits>::__exec(__state& __s) const
|
||||
}
|
||||
}
|
||||
|
||||
// __l_anchor
|
||||
|
||||
template <class _CharT>
|
||||
class __l_anchor
|
||||
: public __owns_one_state<_CharT>
|
||||
{
|
||||
typedef __owns_one_state<_CharT> base;
|
||||
|
||||
public:
|
||||
typedef _STD::__state<_CharT> __state;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__l_anchor(__node<_CharT>* __s)
|
||||
: base(__s) {}
|
||||
|
||||
virtual void __exec(__state&) const;
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
void
|
||||
__l_anchor<_CharT>::__exec(__state& __s) const
|
||||
{
|
||||
if (__s.__at_first_ && __s.__current_ == __s.__first_)
|
||||
{
|
||||
__s.__do_ = __state::__accept_but_not_consume;
|
||||
__s.__node_ = this->first();
|
||||
}
|
||||
else
|
||||
{
|
||||
__s.__do_ = __state::__reject;
|
||||
__s.__node_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// __r_anchor
|
||||
|
||||
template <class _CharT>
|
||||
@@ -2394,7 +2429,6 @@ private:
|
||||
int __open_count_;
|
||||
shared_ptr<__empty_state<_CharT> > __start_;
|
||||
__owns_one_state<_CharT>* __end_;
|
||||
bool __left_anchor_;
|
||||
|
||||
typedef _STD::__state<_CharT> __state;
|
||||
typedef _STD::__node<_CharT> __node;
|
||||
@@ -2416,17 +2450,17 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_regex()
|
||||
: __flags_(), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0), __left_anchor_(false)
|
||||
__end_(0)
|
||||
{}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
|
||||
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0), __left_anchor_(false)
|
||||
__end_(0)
|
||||
{__parse(__p, __p + __traits_.length(__p));}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_regex(const value_type* __p, size_t __len, flag_type __f)
|
||||
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0), __left_anchor_(false)
|
||||
__end_(0)
|
||||
{__parse(__p, __p + __len);}
|
||||
// basic_regex(const basic_regex&) = default;
|
||||
// basic_regex(basic_regex&&) = default;
|
||||
@@ -2435,20 +2469,20 @@ public:
|
||||
explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p,
|
||||
flag_type __f = regex_constants::ECMAScript)
|
||||
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0), __left_anchor_(false)
|
||||
__end_(0)
|
||||
{__parse(__p.begin(), __p.end());}
|
||||
template <class _ForwardIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_regex(_ForwardIterator __first, _ForwardIterator __last,
|
||||
flag_type __f = regex_constants::ECMAScript)
|
||||
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0), __left_anchor_(false)
|
||||
__end_(0)
|
||||
{__parse(__first, __last);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_regex(initializer_list<value_type> __il,
|
||||
flag_type __f = regex_constants::ECMAScript)
|
||||
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0), __left_anchor_(false)
|
||||
__end_(0)
|
||||
{__parse(__il.begin(), __il.end());}
|
||||
|
||||
// ~basic_regex() = default;
|
||||
@@ -2506,7 +2540,6 @@ private:
|
||||
__loop_count_ = 0;
|
||||
__open_count_ = 0;
|
||||
__end_ = nullptr;
|
||||
__left_anchor_ = false;
|
||||
}
|
||||
public:
|
||||
|
||||
@@ -2694,7 +2727,7 @@ private:
|
||||
basic_string<_CharT>* __str = nullptr);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __push_l_anchor() {__left_anchor_ = true;}
|
||||
void __push_l_anchor();
|
||||
void __push_r_anchor();
|
||||
void __push_match_any();
|
||||
void __push_match_any_but_newline();
|
||||
@@ -2732,22 +2765,22 @@ private:
|
||||
bool
|
||||
__match_at_start(const _CharT* __first, const _CharT* __last,
|
||||
match_results<const _CharT*, _Allocator>& __m,
|
||||
regex_constants::match_flag_type __flags) const;
|
||||
regex_constants::match_flag_type __flags, bool) const;
|
||||
template <class _Allocator>
|
||||
bool
|
||||
__match_at_start_ecma(const _CharT* __first, const _CharT* __last,
|
||||
match_results<const _CharT*, _Allocator>& __m,
|
||||
regex_constants::match_flag_type __flags) const;
|
||||
regex_constants::match_flag_type __flags, bool) const;
|
||||
template <class _Allocator>
|
||||
bool
|
||||
__match_at_start_posix_nosubs(const _CharT* __first, const _CharT* __last,
|
||||
match_results<const _CharT*, _Allocator>& __m,
|
||||
regex_constants::match_flag_type __flags) const;
|
||||
regex_constants::match_flag_type __flags, bool) const;
|
||||
template <class _Allocator>
|
||||
bool
|
||||
__match_at_start_posix_subs(const _CharT* __first, const _CharT* __last,
|
||||
match_results<const _CharT*, _Allocator>& __m,
|
||||
regex_constants::match_flag_type __flags) const;
|
||||
regex_constants::match_flag_type __flags, bool) const;
|
||||
|
||||
template <class _B, class _A, class _C, class _T>
|
||||
friend
|
||||
@@ -2809,7 +2842,6 @@ basic_regex<_CharT, _Traits>::swap(basic_regex& __r)
|
||||
swap(__open_count_, __r.__open_count_);
|
||||
swap(__start_, __r.__start_);
|
||||
swap(__end_, __r.__end_);
|
||||
swap(__left_anchor_, __r.__left_anchor_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -2850,7 +2882,9 @@ __lookahead<_CharT, _Traits>::__exec(__state& __s) const
|
||||
match_results<const _CharT*> __m;
|
||||
__m.__init(1 + __exp_.mark_count(), __s.__current_, __s.__last_);
|
||||
bool __matched = __exp_.__match_at_start_ecma(__s.__current_, __s.__last_,
|
||||
__m, __s.__flags_);
|
||||
__m,
|
||||
__s.__flags_ | regex_constants::match_continuous,
|
||||
true);
|
||||
if (__matched != __invert_)
|
||||
{
|
||||
__s.__do_ = __state::__accept_but_not_consume;
|
||||
@@ -4087,7 +4121,6 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
|
||||
basic_regex __exp;
|
||||
__exp.__flags_ = __flags_;
|
||||
__temp = __exp.__parse(++__temp, __last);
|
||||
__exp.__push_l_anchor();
|
||||
__push_lookahead(_STD::move(__exp), false);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__temp == __last || *__temp != ')')
|
||||
@@ -4101,7 +4134,6 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
|
||||
basic_regex __exp;
|
||||
__exp.__flags_ = __flags_;
|
||||
__temp = __exp.__parse(++__temp, __last);
|
||||
__exp.__push_l_anchor();
|
||||
__push_lookahead(_STD::move(__exp), true);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__temp == __last || *__temp != ')')
|
||||
@@ -4576,6 +4608,14 @@ basic_regex<_CharT, _Traits>::__push_end_marked_subexpression(unsigned __sub)
|
||||
}
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_regex<_CharT, _Traits>::__push_l_anchor()
|
||||
{
|
||||
__end_->first() = new __l_anchor<_CharT>(__end_->first());
|
||||
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_regex<_CharT, _Traits>::__push_r_anchor()
|
||||
@@ -5441,7 +5481,7 @@ bool
|
||||
basic_regex<_CharT, _Traits>::__match_at_start_ecma(
|
||||
const _CharT* __first, const _CharT* __last,
|
||||
match_results<const _CharT*, _Allocator>& __m,
|
||||
regex_constants::match_flag_type __flags) const
|
||||
regex_constants::match_flag_type __flags, bool __at_first) const
|
||||
{
|
||||
vector<__state> __states;
|
||||
ptrdiff_t __j = 0;
|
||||
@@ -5458,6 +5498,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
|
||||
__states.back().__loop_data_.resize(__loop_count());
|
||||
__states.back().__node_ = __st;
|
||||
__states.back().__flags_ = __flags;
|
||||
__states.back().__at_first_ = __at_first;
|
||||
bool __matched = false;
|
||||
do
|
||||
{
|
||||
@@ -5506,7 +5547,7 @@ bool
|
||||
basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
|
||||
const _CharT* __first, const _CharT* __last,
|
||||
match_results<const _CharT*, _Allocator>& __m,
|
||||
regex_constants::match_flag_type __flags) const
|
||||
regex_constants::match_flag_type __flags, bool __at_first) const
|
||||
{
|
||||
deque<__state> __states;
|
||||
ptrdiff_t __highest_j = 0;
|
||||
@@ -5522,6 +5563,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
|
||||
__states.back().__loop_data_.resize(__loop_count());
|
||||
__states.back().__node_ = __st;
|
||||
__states.back().__flags_ = __flags;
|
||||
__states.back().__at_first_ = __at_first;
|
||||
bool __matched = false;
|
||||
do
|
||||
{
|
||||
@@ -5583,7 +5625,7 @@ bool
|
||||
basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
|
||||
const _CharT* __first, const _CharT* __last,
|
||||
match_results<const _CharT*, _Allocator>& __m,
|
||||
regex_constants::match_flag_type __flags) const
|
||||
regex_constants::match_flag_type __flags, bool __at_first) const
|
||||
{
|
||||
vector<__state> __states;
|
||||
__state __best_state;
|
||||
@@ -5602,6 +5644,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
|
||||
__states.back().__loop_data_.resize(__loop_count());
|
||||
__states.back().__node_ = __st;
|
||||
__states.back().__flags_ = __flags;
|
||||
__states.back().__at_first_ = __at_first;
|
||||
const _CharT* __current = __first;
|
||||
bool __matched = false;
|
||||
do
|
||||
@@ -5667,13 +5710,13 @@ bool
|
||||
basic_regex<_CharT, _Traits>::__match_at_start(
|
||||
const _CharT* __first, const _CharT* __last,
|
||||
match_results<const _CharT*, _Allocator>& __m,
|
||||
regex_constants::match_flag_type __flags) const
|
||||
regex_constants::match_flag_type __flags, bool __at_first) const
|
||||
{
|
||||
if ((__flags_ & 0x1F0) == ECMAScript)
|
||||
return __match_at_start_ecma(__first, __last, __m, __flags);
|
||||
return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);
|
||||
if (mark_count() == 0)
|
||||
return __match_at_start_posix_nosubs(__first, __last, __m, __flags);
|
||||
return __match_at_start_posix_subs(__first, __last, __m, __flags);
|
||||
return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);
|
||||
return __match_at_start_posix_subs(__first, __last, __m, __flags, __at_first);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -5684,11 +5727,9 @@ basic_regex<_CharT, _Traits>::__search(
|
||||
match_results<const _CharT*, _Allocator>& __m,
|
||||
regex_constants::match_flag_type __flags) const
|
||||
{
|
||||
if (__left_anchor_)
|
||||
__flags |= regex_constants::match_continuous;
|
||||
__m.__init(1 + mark_count(), __first, __last,
|
||||
__flags & regex_constants::__no_update_pos);
|
||||
if (__match_at_start(__first, __last, __m, __flags))
|
||||
if (__match_at_start(__first, __last, __m, __flags, true))
|
||||
{
|
||||
__m.__prefix_.second = __m[0].first;
|
||||
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
|
||||
@@ -5702,7 +5743,7 @@ basic_regex<_CharT, _Traits>::__search(
|
||||
for (++__first; __first != __last; ++__first)
|
||||
{
|
||||
__m.__matches_.assign(__m.size(), __m.__unmatched_);
|
||||
if (__match_at_start(__first, __last, __m, __flags))
|
||||
if (__match_at_start(__first, __last, __m, __flags, false))
|
||||
{
|
||||
__m.__prefix_.second = __m[0].first;
|
||||
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
|
||||
|
@@ -211,6 +211,14 @@ template <> struct __is_void<void> : public true_type {};
|
||||
template <class _Tp> struct _LIBCPP_VISIBLE is_void
|
||||
: public __is_void<typename remove_cv<_Tp>::type> {};
|
||||
|
||||
// __is_nullptr_t
|
||||
|
||||
template <class _Tp> struct ____is_nullptr_t : public false_type {};
|
||||
template <> struct ____is_nullptr_t<nullptr_t> : public true_type {};
|
||||
|
||||
template <class _Tp> struct _LIBCPP_VISIBLE __is_nullptr_t
|
||||
: public ____is_nullptr_t<typename remove_cv<_Tp>::type> {};
|
||||
|
||||
// is_integral
|
||||
|
||||
template <class _Tp> struct __is_integral : public false_type {};
|
||||
@@ -392,7 +400,8 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_arithmetic
|
||||
// is_fundamental
|
||||
|
||||
template <class _Tp> struct _LIBCPP_VISIBLE is_fundamental
|
||||
: public integral_constant<bool, is_void<_Tp>::value ||
|
||||
: public integral_constant<bool, is_void<_Tp>::value ||
|
||||
__is_nullptr_t<_Tp>::value ||
|
||||
is_arithmetic<_Tp>::value> {};
|
||||
|
||||
// is_scalar
|
||||
@@ -401,8 +410,11 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_scalar
|
||||
: public integral_constant<bool, is_arithmetic<_Tp>::value ||
|
||||
is_member_pointer<_Tp>::value ||
|
||||
is_pointer<_Tp>::value ||
|
||||
__is_nullptr_t<_Tp>::value ||
|
||||
is_enum<_Tp>::value > {};
|
||||
|
||||
template <> struct _LIBCPP_VISIBLE is_scalar<nullptr_t> : public true_type {};
|
||||
|
||||
// is_object
|
||||
|
||||
template <class _Tp> struct _LIBCPP_VISIBLE is_object
|
||||
|
@@ -14,12 +14,10 @@ endif()
|
||||
if (LIBCXX_ENABLE_SHARED)
|
||||
add_library(cxx SHARED
|
||||
${sources}
|
||||
${headers}
|
||||
)
|
||||
else()
|
||||
add_library(cxx STATIC
|
||||
${sources}
|
||||
${headers}
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -50,7 +48,10 @@ install(TARGETS cxx
|
||||
)
|
||||
|
||||
install(DIRECTORY ../include/
|
||||
DESTINATION include/c++/v1
|
||||
DESTINATION include/libcxx/v1
|
||||
FILES_MATCHING
|
||||
PATTERN "*"
|
||||
PATTERN ".svn" EXCLUDE
|
||||
PATTERN ".git" EXCLUDE
|
||||
)
|
||||
|
||||
|
@@ -32,7 +32,7 @@ if(PYTHONINTERP_FOUND)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
@ONLY)
|
||||
|
||||
add_custom_target(check
|
||||
add_custom_target(libcxx.check
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
${LIT_EXECUTABLE}
|
||||
${LIT_ARGS}
|
||||
@@ -40,5 +40,5 @@ if(PYTHONINTERP_FOUND)
|
||||
DEPENDS
|
||||
COMMENT "Running libcxx tests")
|
||||
else()
|
||||
message(WARNING "Could not find Python, no check target will be available!")
|
||||
message(WARNING "Could not find Python, no libcxx.check target will be available!")
|
||||
endif()
|
||||
|
@@ -0,0 +1,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <map>
|
||||
|
||||
// class map
|
||||
|
||||
// map();
|
||||
|
||||
#include <map>
|
||||
|
||||
struct X
|
||||
{
|
||||
std::multimap<int, X> m;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
@@ -20,13 +20,22 @@ struct A
|
||||
}
|
||||
};
|
||||
|
||||
struct B
|
||||
{
|
||||
B()
|
||||
{
|
||||
// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#475
|
||||
assert(!std::uncaught_exception());
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
try
|
||||
{
|
||||
A a;
|
||||
assert(!std::uncaught_exception());
|
||||
throw 1;
|
||||
throw B();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@@ -41,4 +41,19 @@ int main()
|
||||
assert(!(nullptr != nullptr));
|
||||
assert(!(nullptr < nullptr));
|
||||
assert(!(nullptr > nullptr));
|
||||
A* a = nullptr;
|
||||
assert(a == nullptr);
|
||||
assert(a <= nullptr);
|
||||
assert(a >= nullptr);
|
||||
assert(!(a != nullptr));
|
||||
assert(!(a < nullptr));
|
||||
assert(!(a > nullptr));
|
||||
assert(nullptr == a);
|
||||
assert(nullptr <= a);
|
||||
assert(nullptr >= a);
|
||||
assert(!(nullptr != a));
|
||||
assert(!(nullptr < a));
|
||||
assert(!(nullptr > a));
|
||||
std::ptrdiff_t i = reinterpret_cast<std::ptrdiff_t>(nullptr);
|
||||
assert(i == 0);
|
||||
}
|
||||
|
@@ -0,0 +1,53 @@
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
template<typename T>
|
||||
void check_limits()
|
||||
{
|
||||
T minv = numeric_limits<T>::min();
|
||||
T maxv = numeric_limits<T>::max();
|
||||
|
||||
ostringstream miniss, maxiss;
|
||||
assert(miniss << minv);
|
||||
assert(maxiss << maxv);
|
||||
std::string mins = miniss.str();
|
||||
std::string maxs = maxiss.str();
|
||||
|
||||
istringstream maxoss(maxs), minoss(mins);
|
||||
|
||||
T new_minv, new_maxv;
|
||||
assert(maxoss >> new_maxv);
|
||||
assert(minoss >> new_minv);
|
||||
|
||||
assert(new_minv == minv);
|
||||
assert(new_maxv == maxv);
|
||||
|
||||
if(mins == "0")
|
||||
mins = "-1";
|
||||
else
|
||||
mins[mins.size() - 1]++;
|
||||
|
||||
maxs[maxs.size() - 1]++;
|
||||
|
||||
istringstream maxoss2(maxs), minoss2(mins);
|
||||
|
||||
assert(! (maxoss2 >> new_maxv));
|
||||
assert(! (minoss2 >> new_minv));
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
check_limits<short>();
|
||||
check_limits<unsigned short>();
|
||||
check_limits<int>();
|
||||
check_limits<unsigned int>();
|
||||
check_limits<long>();
|
||||
check_limits<unsigned long>();
|
||||
check_limits<long long>();
|
||||
check_limits<unsigned long long>();
|
||||
}
|
@@ -157,7 +157,8 @@
|
||||
|
||||
<ul>
|
||||
<li><code>cd /usr/lib</code></li>
|
||||
<li><code>sudo ln -sf path-to-libcxx/lib/libc++.1.dylib libc++.dylib</code></li>
|
||||
<li><code>sudo ln -sf path-to-libcxx/lib/libc++.1.dylib libc++.1.dylib</code></li>
|
||||
<li><code>sudo ln -sf libc++.1.dylib libc++.dylib</code></li>
|
||||
<li><code>cd /usr/include/c++</code></li>
|
||||
<li><code>sudo ln -sf path-to-libcxx/include v1</code></li>
|
||||
</ul>
|
||||
|
@@ -255,7 +255,7 @@ changed. Please see:
|
||||
|
||||
<tr>
|
||||
<td><tt>is_base_of<T, U></tt></td>
|
||||
<td bgcolor="#FF5965"><tt>__is_base_of(T, U)</tt></td>
|
||||
<td bgcolor="#80FF80"><tt>__is_base_of(T, U)</tt></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
Reference in New Issue
Block a user