Compare commits
1 Commits
2.6.38.2
...
svn-tags/l
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1f7a17489e |
@@ -5,10 +5,10 @@
|
||||
#===============================================================================
|
||||
|
||||
project(libcxx CXX C)
|
||||
cmake_minimum_required(VERSION 2.6.4)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION lll)
|
||||
set(PACKAGE_VERSION trunk-svn)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
|
||||
|
||||
|
@@ -184,12 +184,10 @@ 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
|
||||
@@ -209,6 +207,7 @@ 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;
|
||||
|
||||
_NodePtr __next_;
|
||||
pointer __next_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_node_base() : __next_(nullptr) {}
|
||||
};
|
||||
|
@@ -97,7 +97,7 @@ typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::__getchar(bool __consume)
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
int __nread = _STD::max(1, __encoding_);
|
||||
int __nread = max(1, __encoding_);
|
||||
for (int __i = 0; __i < __nread; ++__i)
|
||||
{
|
||||
char __c = getc(__file_);
|
||||
|
@@ -769,7 +769,6 @@ 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>
|
||||
@@ -780,10 +779,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>
|
||||
@@ -911,12 +910,13 @@ public:
|
||||
iterator __insert_multi(_V&& __v);
|
||||
template <class _V>
|
||||
iterator __insert_multi(const_iterator __p, _V&& __v);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#else // _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::pointer
|
||||
// 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::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&
|
||||
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,11 +1728,18 @@ template <class _V>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
|
||||
{
|
||||
__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;
|
||||
__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);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
@@ -1740,11 +1747,16 @@ template <class _V>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
|
||||
{
|
||||
__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;
|
||||
__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);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
@@ -1784,8 +1796,6 @@ __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)
|
||||
@@ -1842,6 +1852,8 @@ __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,11 +214,7 @@ 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,17 +1559,8 @@ typename enable_if
|
||||
>::type
|
||||
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
|
||||
{
|
||||
if (__n > 0)
|
||||
{
|
||||
for (; __n > 0; --__n, ++__first, ++__result)
|
||||
*__result = *__first;
|
||||
++__result;
|
||||
for (--__n; __n > 0; --__n)
|
||||
{
|
||||
++__first;
|
||||
*__result = *__first;
|
||||
++__result;
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
@@ -1582,7 +1573,7 @@ typename enable_if
|
||||
>::type
|
||||
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
|
||||
{
|
||||
return _STD::copy(__first, __first + __n, __result);
|
||||
return copy(__first, __first + __n, __result);
|
||||
}
|
||||
|
||||
// move
|
||||
|
@@ -530,10 +530,6 @@ 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,
|
||||
@@ -1506,8 +1502,6 @@ 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
|
||||
|
@@ -603,7 +603,7 @@ copy_backward(_RAIter __f,
|
||||
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
|
||||
while (__f != __l)
|
||||
{
|
||||
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _STD::prev(__r);
|
||||
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = prev(__r);
|
||||
pointer __rb = *__rp.__m_iter_;
|
||||
pointer __re = __rp.__ptr_ + 1;
|
||||
difference_type __bs = __re - __rb;
|
||||
@@ -776,7 +776,7 @@ move_backward(_RAIter __f,
|
||||
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
|
||||
while (__f != __l)
|
||||
{
|
||||
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _STD::prev(__r);
|
||||
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = prev(__r);
|
||||
pointer __rb = *__rp.__m_iter_;
|
||||
pointer __re = __rp.__ptr_ + 1;
|
||||
difference_type __bs = __re - __rb;
|
||||
@@ -1780,7 +1780,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
|
||||
{
|
||||
const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
|
||||
iterator __b = __base::begin();
|
||||
iterator __bm1 = _STD::prev(__b);
|
||||
iterator __bm1 = prev(__b);
|
||||
if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
|
||||
__vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
|
||||
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
|
||||
@@ -1806,7 +1806,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
|
||||
{
|
||||
const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
|
||||
iterator __e = __base::end();
|
||||
iterator __em1 = _STD::prev(__e);
|
||||
iterator __em1 = prev(__e);
|
||||
if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
|
||||
__vt = pointer_traits<const_pointer>::pointer_to(*__e);
|
||||
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
|
||||
@@ -1842,7 +1842,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
|
||||
else
|
||||
{
|
||||
iterator __b = __base::begin();
|
||||
iterator __bm1 = _STD::prev(__b);
|
||||
iterator __bm1 = prev(__b);
|
||||
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
@@ -1865,7 +1865,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
|
||||
else
|
||||
{
|
||||
iterator __e = __base::end();
|
||||
iterator __em1 = _STD::prev(__e);
|
||||
iterator __em1 = prev(__e);
|
||||
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
|
||||
++__base::size();
|
||||
if (__de > 1)
|
||||
@@ -1900,7 +1900,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
||||
else
|
||||
{
|
||||
iterator __b = __base::begin();
|
||||
iterator __bm1 = _STD::prev(__b);
|
||||
iterator __bm1 = prev(__b);
|
||||
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
@@ -1923,7 +1923,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
||||
else
|
||||
{
|
||||
iterator __e = __base::end();
|
||||
iterator __em1 = _STD::prev(__e);
|
||||
iterator __em1 = prev(__e);
|
||||
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
|
||||
++__base::size();
|
||||
if (__de > 1)
|
||||
@@ -2209,7 +2209,7 @@ deque<_Tp, _Allocator>::__add_front_capacity(size_type __n)
|
||||
size_type __nb = __recommend_blocks(__n + __base::__map_.empty());
|
||||
// Number of unused blocks at back:
|
||||
size_type __back_capacity = __back_spare() / __base::__block_size;
|
||||
__back_capacity = _STD::min(__back_capacity, __nb); // don't take more than you need
|
||||
__back_capacity = min(__back_capacity, __nb); // don't take more than you need
|
||||
__nb -= __back_capacity; // number of blocks need to allocate
|
||||
// If __nb == 0, then we have sufficient capacity.
|
||||
if (__nb == 0)
|
||||
@@ -2354,7 +2354,7 @@ deque<_Tp, _Allocator>::__add_back_capacity(size_type __n)
|
||||
size_type __nb = __recommend_blocks(__n + __base::__map_.empty());
|
||||
// Number of unused blocks at front:
|
||||
size_type __front_capacity = __front_spare() / __base::__block_size;
|
||||
__front_capacity = _STD::min(__front_capacity, __nb); // don't take more than you need
|
||||
__front_capacity = min(__front_capacity, __nb); // don't take more than you need
|
||||
__nb -= __front_capacity; // number of blocks need to allocate
|
||||
// If __nb == 0, then we have sufficient capacity.
|
||||
if (__nb == 0)
|
||||
@@ -2608,7 +2608,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__pos < (__base::size() - 1) / 2)
|
||||
{ // erase from front
|
||||
_STD::move_backward(__b, __p, _STD::next(__p));
|
||||
_STD::move_backward(__b, __p, next(__p));
|
||||
__alloc_traits::destroy(__a, _STD::addressof(*__b));
|
||||
--__base::size();
|
||||
++__base::__start_;
|
||||
|
@@ -871,7 +871,7 @@ typename enable_if
|
||||
forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
|
||||
{
|
||||
iterator __i = before_begin();
|
||||
iterator __j = _STD::next(__i);
|
||||
iterator __j = next(__i);
|
||||
iterator __e = end();
|
||||
for (; __j != __e && __f != __l; ++__i, ++__j, ++__f)
|
||||
*__j = *__f;
|
||||
@@ -886,7 +886,7 @@ void
|
||||
forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
|
||||
{
|
||||
iterator __i = before_begin();
|
||||
iterator __j = _STD::next(__i);
|
||||
iterator __j = next(__i);
|
||||
iterator __e = end();
|
||||
for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
|
||||
*__j = __v;
|
||||
@@ -1235,7 +1235,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
||||
forward_list& __x,
|
||||
const_iterator __i)
|
||||
{
|
||||
const_iterator __lm1 = _STD::next(__i);
|
||||
const_iterator __lm1 = next(__i);
|
||||
if (__p != __i && __p != __lm1)
|
||||
{
|
||||
const_cast<__node_pointer>(__i.__ptr_)->__next_ =
|
||||
@@ -1312,7 +1312,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
|
||||
{
|
||||
if (__i.__ptr_->__next_->__value_ == __v)
|
||||
{
|
||||
iterator __j = _STD::next(__i, 2);
|
||||
iterator __j = next(__i, 2);
|
||||
for (; __j != __e && *__j == __v; ++__j)
|
||||
;
|
||||
erase_after(__i, __j);
|
||||
@@ -1335,7 +1335,7 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
|
||||
{
|
||||
if (__pred(__i.__ptr_->__next_->__value_))
|
||||
{
|
||||
iterator __j = _STD::next(__i, 2);
|
||||
iterator __j = next(__i, 2);
|
||||
for (; __j != __e && __pred(*__j); ++__j)
|
||||
;
|
||||
erase_after(__i, __j);
|
||||
@@ -1355,7 +1355,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
|
||||
{
|
||||
for (iterator __i = begin(), __e = end(); __i != __e;)
|
||||
{
|
||||
iterator __j = _STD::next(__i);
|
||||
iterator __j = next(__i);
|
||||
for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
|
||||
;
|
||||
if (__i.__ptr_->__next_ != __j.__ptr_)
|
||||
@@ -1456,7 +1456,7 @@ forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
|
||||
}
|
||||
difference_type __sz1 = __sz / 2;
|
||||
difference_type __sz2 = __sz - __sz1;
|
||||
__node_pointer __t = _STD::next(iterator(__f1), __sz1 - 1).__ptr_;
|
||||
__node_pointer __t = next(iterator(__f1), __sz1 - 1).__ptr_;
|
||||
__node_pointer __f2 = __t->__next_;
|
||||
__t->__next_ = nullptr;
|
||||
return __merge(__sort(__f1, __sz1, __comp),
|
||||
|
@@ -587,7 +587,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
||||
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
||||
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
||||
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
||||
size_t __nmemb = _STD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
|
||||
size_t __nmemb = min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
|
||||
static_cast<size_t>(__extbufend_ - __extbufnext_));
|
||||
codecvt_base::result __r;
|
||||
state_type __svs = __st_;
|
||||
|
@@ -801,13 +801,6 @@ 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;
|
||||
@@ -819,7 +812,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
|
||||
}
|
||||
else
|
||||
__is.setstate(ios_base::eofbit | ios_base::failbit);
|
||||
#endif
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -1273,7 +1265,7 @@ basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
__c = _STD::min(__c, __n);
|
||||
__c = min(__c, __n);
|
||||
for (streamsize __k = 0; __k < __c; ++__k, ++__s, ++__i)
|
||||
*__s = *__i;
|
||||
}
|
||||
|
@@ -488,7 +488,7 @@ next(_ForwardIter __x,
|
||||
typename iterator_traits<_ForwardIter>::difference_type __n = 1,
|
||||
typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
|
||||
{
|
||||
_STD::advance(__x, __n);
|
||||
advance(__x, __n);
|
||||
return __x;
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ prev(_BidiretionalIter __x,
|
||||
typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
|
||||
typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
|
||||
{
|
||||
_STD::advance(__x, -__n);
|
||||
advance(__x, -__n);
|
||||
return __x;
|
||||
}
|
||||
|
||||
|
26
include/list
26
include/list
@@ -714,8 +714,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::__iterator(size_type __n)
|
||||
{
|
||||
return __n <= base::__sz() / 2 ? _STD::next(begin(), __n)
|
||||
: _STD::prev(end(), base::__sz() - __n);
|
||||
return __n <= base::__sz() / 2 ? next(begin(), __n)
|
||||
: prev(end(), base::__sz() - __n);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -1321,7 +1321,7 @@ template <class _Tp, class _Alloc>
|
||||
void
|
||||
list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
|
||||
{
|
||||
if (__p != __i && __p != _STD::next(__i))
|
||||
if (__p != __i && __p != next(__i))
|
||||
{
|
||||
__node& __f = const_cast<__node&>(*__i.__ptr_);
|
||||
base::__unlink_nodes(__f, __f);
|
||||
@@ -1359,7 +1359,7 @@ list<_Tp, _Alloc>::remove(const value_type& __x)
|
||||
{
|
||||
if (*__i == __x)
|
||||
{
|
||||
iterator __j = _STD::next(__i);
|
||||
iterator __j = next(__i);
|
||||
for (; __j != __e && *__j == __x; ++__j)
|
||||
;
|
||||
__i = erase(__i, __j);
|
||||
@@ -1378,7 +1378,7 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred)
|
||||
{
|
||||
if (__pred(*__i))
|
||||
{
|
||||
iterator __j = _STD::next(__i);
|
||||
iterator __j = next(__i);
|
||||
for (; __j != __e && __pred(*__j); ++__j)
|
||||
;
|
||||
__i = erase(__i, __j);
|
||||
@@ -1403,7 +1403,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
|
||||
{
|
||||
for (iterator __i = begin(), __e = end(); __i != __e;)
|
||||
{
|
||||
iterator __j = _STD::next(__i);
|
||||
iterator __j = next(__i);
|
||||
for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
|
||||
;
|
||||
if (++__i != __j)
|
||||
@@ -1435,7 +1435,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
|
||||
if (__comp(*__f2, *__f1))
|
||||
{
|
||||
size_type __ds = 1;
|
||||
iterator __m2 = _STD::next(__f2);
|
||||
iterator __m2 = next(__f2);
|
||||
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, ++__ds)
|
||||
;
|
||||
base::__sz() += __ds;
|
||||
@@ -1444,7 +1444,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
|
||||
__node& __l = *__m2.__ptr_->__prev_;
|
||||
__f2 = __m2;
|
||||
base::__unlink_nodes(__f, __l);
|
||||
__m2 = _STD::next(__f1);
|
||||
__m2 = next(__f1);
|
||||
__link_nodes(*__f1.__ptr_, __f, __l);
|
||||
__f1 = __m2;
|
||||
}
|
||||
@@ -1493,12 +1493,12 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
|
||||
return __f1;
|
||||
}
|
||||
size_type __n2 = __n / 2;
|
||||
iterator __e1 = _STD::next(__f1, __n2);
|
||||
iterator __e1 = next(__f1, __n2);
|
||||
iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp);
|
||||
iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp);
|
||||
if (__comp(*__f2, *__f1))
|
||||
{
|
||||
iterator __m2 = _STD::next(__f2);
|
||||
iterator __m2 = next(__f2);
|
||||
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
|
||||
;
|
||||
__node& __f = *__f2.__ptr_;
|
||||
@@ -1506,7 +1506,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
|
||||
__r = __f2;
|
||||
__e1 = __f2 = __m2;
|
||||
base::__unlink_nodes(__f, __l);
|
||||
__m2 = _STD::next(__f1);
|
||||
__m2 = next(__f1);
|
||||
__link_nodes(*__f1.__ptr_, __f, __l);
|
||||
__f1 = __m2;
|
||||
}
|
||||
@@ -1516,7 +1516,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
|
||||
{
|
||||
if (__comp(*__f2, *__f1))
|
||||
{
|
||||
iterator __m2 = _STD::next(__f2);
|
||||
iterator __m2 = next(__f2);
|
||||
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
|
||||
;
|
||||
__node& __f = *__f2.__ptr_;
|
||||
@@ -1525,7 +1525,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
|
||||
__e1 = __m2;
|
||||
__f2 = __m2;
|
||||
base::__unlink_nodes(__f, __l);
|
||||
__m2 = _STD::next(__f1);
|
||||
__m2 = next(__f1);
|
||||
__link_nodes(*__f1.__ptr_, __f, __l);
|
||||
__f1 = __m2;
|
||||
}
|
||||
|
@@ -522,12 +522,6 @@ __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)
|
||||
@@ -538,28 +532,22 @@ __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 >= 24)
|
||||
if (__f >= 26)
|
||||
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 -1;
|
||||
break;
|
||||
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;
|
||||
}
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
if (__f >= 22)
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
if (__a_end-__a < __num_get_buf_sz - 1)
|
||||
*__a_end++ = __src[__f];
|
||||
++__dc;
|
||||
return 0;
|
||||
}
|
||||
@@ -745,27 +733,22 @@ __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 (__current_errno == ERANGE ||
|
||||
__ll < numeric_limits<_Tp>::min() ||
|
||||
numeric_limits<_Tp>::max() < __ll)
|
||||
else if (__ll > numeric_limits<_Tp>::max())
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
if (__ll > 0)
|
||||
return numeric_limits<_Tp>::max();
|
||||
else
|
||||
return numeric_limits<_Tp>::min();
|
||||
return numeric_limits<_Tp>::max();
|
||||
}
|
||||
else if (__ll < numeric_limits<_Tp>::min())
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return numeric_limits<_Tp>::min();
|
||||
}
|
||||
return static_cast<_Tp>(__ll);
|
||||
}
|
||||
@@ -780,25 +763,14 @@ __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 (__current_errno == ERANGE ||
|
||||
numeric_limits<_Tp>::max() < __ll)
|
||||
else if (__ll > numeric_limits<_Tp>::max())
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return numeric_limits<_Tp>::max();
|
||||
@@ -2608,7 +2580,7 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
char_type* __nb = __nar;
|
||||
char_type* __ne = __nb + 100;
|
||||
__do_put(__nb, __ne, __tm, __fmt, __mod);
|
||||
return _STD::copy(__nb, __ne, __s);
|
||||
return copy(__nb, __ne, __s);
|
||||
}
|
||||
|
||||
extern template class time_put<char>;
|
||||
@@ -3276,7 +3248,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
|
||||
break;
|
||||
case money_base::symbol:
|
||||
if (!__sym.empty() && (__flags & ios_base::showbase))
|
||||
__me = _STD::copy(__sym.begin(), __sym.end(), __me);
|
||||
__me = copy(__sym.begin(), __sym.end(), __me);
|
||||
break;
|
||||
case money_base::value:
|
||||
{
|
||||
@@ -3335,7 +3307,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
|
||||
}
|
||||
// print rest of sign, if any
|
||||
if (__sn.size() > 1)
|
||||
__me = _STD::copy(__sn.begin()+1, __sn.end(), __me);
|
||||
__me = copy(__sn.begin()+1, __sn.end(), __me);
|
||||
// set alignment
|
||||
if ((__flags & ios_base::adjustfield) == ios_base::left)
|
||||
__mi = __me;
|
||||
@@ -3502,7 +3474,7 @@ extern template class money_put<wchar_t>;
|
||||
class _LIBCPP_VISIBLE messages_base
|
||||
{
|
||||
public:
|
||||
typedef ptrdiff_t catalog;
|
||||
typedef nl_catd catalog;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE messages_base() {}
|
||||
};
|
||||
@@ -3559,10 +3531,7 @@ template <class _CharT>
|
||||
typename messages<_CharT>::catalog
|
||||
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
|
||||
{
|
||||
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;
|
||||
return catopen(__nm.c_str(), NL_CAT_LOCALE);
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
@@ -3574,10 +3543,7 @@ 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());
|
||||
if (__c != -1)
|
||||
__c <<= 1;
|
||||
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
|
||||
char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
|
||||
char* __n = catgets(__c, __set, __msgid, __ndflt.c_str());
|
||||
string_type __w;
|
||||
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
|
||||
__n, __n + strlen(__n));
|
||||
@@ -3588,10 +3554,7 @@ template <class _CharT>
|
||||
void
|
||||
messages<_CharT>::do_close(catalog __c) const
|
||||
{
|
||||
if (__c != -1)
|
||||
__c <<= 1;
|
||||
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
|
||||
catclose(__cat);
|
||||
catclose(__c);
|
||||
}
|
||||
|
||||
extern template class messages<char>;
|
||||
@@ -4004,7 +3967,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
|
||||
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
||||
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
||||
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
||||
streamsize __nmemb = _STD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
|
||||
streamsize __nmemb = min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
|
||||
static_cast<streamsize>(__extbufend_ - __extbufnext_));
|
||||
codecvt_base::result __r;
|
||||
state_type __svs = __st_;
|
||||
|
14
include/map
14
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
|
||||
@@ -1042,7 +1042,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(const_iterator __hint,
|
||||
else if (__tree_.value_comp().key_comp()(__hint->first, __k)) // check after
|
||||
{
|
||||
// *__hint < __k
|
||||
const_iterator __next = _STD::next(__hint);
|
||||
const_iterator __next = next(__hint);
|
||||
if (__next == end() || __tree_.value_comp().key_comp()(__k, __next->first))
|
||||
{
|
||||
// *__hint < __k < *next(__hint)
|
||||
|
@@ -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, const bitset<_Size>& __x)
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, bitset<_Size>& __x)
|
||||
{
|
||||
return __os << __x.template to_string<_CharT, _Traits>
|
||||
(use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),
|
||||
|
139
include/regex
139
include/regex
@@ -1264,7 +1264,6 @@ 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()
|
||||
@@ -1891,40 +1890,6 @@ __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>
|
||||
@@ -2263,7 +2228,7 @@ __bracket_expression<_CharT, _Traits>::__exec(__state& __s) const
|
||||
++__consumed;
|
||||
if (__might_have_digraph_)
|
||||
{
|
||||
const _CharT* __next = _STD::next(__s.__current_);
|
||||
const _CharT* __next = next(__s.__current_);
|
||||
if (__next != __s.__last_)
|
||||
{
|
||||
pair<_CharT, _CharT> __ch2(*__s.__current_, *__next);
|
||||
@@ -2429,6 +2394,7 @@ 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;
|
||||
@@ -2450,17 +2416,17 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_regex()
|
||||
: __flags_(), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0)
|
||||
__end_(0), __left_anchor_(false)
|
||||
{}
|
||||
_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)
|
||||
__end_(0), __left_anchor_(false)
|
||||
{__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)
|
||||
__end_(0), __left_anchor_(false)
|
||||
{__parse(__p, __p + __len);}
|
||||
// basic_regex(const basic_regex&) = default;
|
||||
// basic_regex(basic_regex&&) = default;
|
||||
@@ -2469,20 +2435,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)
|
||||
__end_(0), __left_anchor_(false)
|
||||
{__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)
|
||||
__end_(0), __left_anchor_(false)
|
||||
{__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)
|
||||
__end_(0), __left_anchor_(false)
|
||||
{__parse(__il.begin(), __il.end());}
|
||||
|
||||
// ~basic_regex() = default;
|
||||
@@ -2540,6 +2506,7 @@ private:
|
||||
__loop_count_ = 0;
|
||||
__open_count_ = 0;
|
||||
__end_ = nullptr;
|
||||
__left_anchor_ = false;
|
||||
}
|
||||
public:
|
||||
|
||||
@@ -2727,7 +2694,7 @@ private:
|
||||
basic_string<_CharT>* __str = nullptr);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __push_l_anchor();
|
||||
void __push_l_anchor() {__left_anchor_ = true;}
|
||||
void __push_r_anchor();
|
||||
void __push_match_any();
|
||||
void __push_match_any_but_newline();
|
||||
@@ -2765,22 +2732,22 @@ private:
|
||||
bool
|
||||
__match_at_start(const _CharT* __first, const _CharT* __last,
|
||||
match_results<const _CharT*, _Allocator>& __m,
|
||||
regex_constants::match_flag_type __flags, bool) const;
|
||||
regex_constants::match_flag_type __flags) 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, bool) const;
|
||||
regex_constants::match_flag_type __flags) 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, bool) const;
|
||||
regex_constants::match_flag_type __flags) 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, bool) const;
|
||||
regex_constants::match_flag_type __flags) const;
|
||||
|
||||
template <class _B, class _A, class _C, class _T>
|
||||
friend
|
||||
@@ -2842,6 +2809,7 @@ 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>
|
||||
@@ -2882,9 +2850,7 @@ __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_ | regex_constants::match_continuous,
|
||||
true);
|
||||
__m, __s.__flags_);
|
||||
if (__matched != __invert_)
|
||||
{
|
||||
__s.__do_ = __state::__accept_but_not_consume;
|
||||
@@ -2953,7 +2919,7 @@ basic_regex<_CharT, _Traits>::__parse_basic_reg_exp(_ForwardIterator __first,
|
||||
__first = __parse_RE_expression(__first, __last);
|
||||
if (__first != __last)
|
||||
{
|
||||
_ForwardIterator __temp = _STD::next(__first);
|
||||
_ForwardIterator __temp = next(__first);
|
||||
if (__temp == __last && *__first == '$')
|
||||
{
|
||||
__push_r_anchor();
|
||||
@@ -3182,7 +3148,7 @@ basic_regex<_CharT, _Traits>::__parse_Back_open_paren(_ForwardIterator __first,
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
_ForwardIterator __temp = _STD::next(__first);
|
||||
_ForwardIterator __temp = next(__first);
|
||||
if (__temp != __last)
|
||||
{
|
||||
if (*__first == '\\' && *__temp == '(')
|
||||
@@ -3200,7 +3166,7 @@ basic_regex<_CharT, _Traits>::__parse_Back_close_paren(_ForwardIterator __first,
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
_ForwardIterator __temp = _STD::next(__first);
|
||||
_ForwardIterator __temp = next(__first);
|
||||
if (__temp != __last)
|
||||
{
|
||||
if (*__first == '\\' && *__temp == ')')
|
||||
@@ -3218,7 +3184,7 @@ basic_regex<_CharT, _Traits>::__parse_Back_open_brace(_ForwardIterator __first,
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
_ForwardIterator __temp = _STD::next(__first);
|
||||
_ForwardIterator __temp = next(__first);
|
||||
if (__temp != __last)
|
||||
{
|
||||
if (*__first == '\\' && *__temp == '{')
|
||||
@@ -3236,7 +3202,7 @@ basic_regex<_CharT, _Traits>::__parse_Back_close_brace(_ForwardIterator __first,
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
_ForwardIterator __temp = _STD::next(__first);
|
||||
_ForwardIterator __temp = next(__first);
|
||||
if (__temp != __last)
|
||||
{
|
||||
if (*__first == '\\' && *__temp == '}')
|
||||
@@ -3254,7 +3220,7 @@ basic_regex<_CharT, _Traits>::__parse_BACKREF(_ForwardIterator __first,
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
_ForwardIterator __temp = _STD::next(__first);
|
||||
_ForwardIterator __temp = next(__first);
|
||||
if (__temp != __last)
|
||||
{
|
||||
if (*__first == '\\' && '1' <= *__temp && *__temp <= '9')
|
||||
@@ -3275,7 +3241,7 @@ basic_regex<_CharT, _Traits>::__parse_ORD_CHAR(_ForwardIterator __first,
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
_ForwardIterator __temp = _STD::next(__first);
|
||||
_ForwardIterator __temp = next(__first);
|
||||
if (__temp == __last && *__first == '$')
|
||||
return __first;
|
||||
// Not called inside a bracket
|
||||
@@ -3333,7 +3299,7 @@ basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR(_ForwardIterator __first,
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
_ForwardIterator __temp = _STD::next(__first);
|
||||
_ForwardIterator __temp = next(__first);
|
||||
if (__temp != __last)
|
||||
{
|
||||
if (*__first == '\\')
|
||||
@@ -3364,7 +3330,7 @@ basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first,
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
_ForwardIterator __temp = _STD::next(__first);
|
||||
_ForwardIterator __temp = next(__first);
|
||||
if (__temp != __last)
|
||||
{
|
||||
if (*__first == '\\')
|
||||
@@ -3674,7 +3640,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
|
||||
{
|
||||
if (__first != __last && *__first != ']')
|
||||
{
|
||||
_ForwardIterator __temp = _STD::next(__first);
|
||||
_ForwardIterator __temp = next(__first);
|
||||
basic_string<_CharT> __start_range;
|
||||
if (__temp != __last && *__first == '[')
|
||||
{
|
||||
@@ -3703,7 +3669,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
|
||||
}
|
||||
if (__first != __last && *__first != ']')
|
||||
{
|
||||
__temp = _STD::next(__first);
|
||||
__temp = next(__first);
|
||||
if (__temp != __last && *__first == '-' && *__temp != ']')
|
||||
{
|
||||
// parse a range
|
||||
@@ -3925,7 +3891,7 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
}
|
||||
__first = _STD::next(__temp, 2);
|
||||
__first = next(__temp, 2);
|
||||
return __first;
|
||||
}
|
||||
|
||||
@@ -3954,7 +3920,7 @@ basic_regex<_CharT, _Traits>::__parse_character_class(_ForwardIterator __first,
|
||||
throw regex_error(regex_constants::error_brack);
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__ml->__add_class(__class_type);
|
||||
__first = _STD::next(__temp, 2);
|
||||
__first = next(__temp, 2);
|
||||
return __first;
|
||||
}
|
||||
|
||||
@@ -3987,7 +3953,7 @@ basic_regex<_CharT, _Traits>::__parse_collating_symbol(_ForwardIterator __first,
|
||||
throw regex_error(regex_constants::error_collate);
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
__first = _STD::next(__temp, 2);
|
||||
__first = next(__temp, 2);
|
||||
return __first;
|
||||
}
|
||||
|
||||
@@ -4121,6 +4087,7 @@ 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 != ')')
|
||||
@@ -4134,6 +4101,7 @@ 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 != ')')
|
||||
@@ -4608,14 +4576,6 @@ 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()
|
||||
@@ -5260,18 +5220,18 @@ public:
|
||||
__matches_.resize(__m.size());
|
||||
for (size_type __i = 0; __i < __matches_.size(); ++__i)
|
||||
{
|
||||
__matches_[__i].first = _STD::next(__f, _STD::distance(__mf, __m[__i].first));
|
||||
__matches_[__i].second = _STD::next(__f, _STD::distance(__mf, __m[__i].second));
|
||||
__matches_[__i].first = next(__f, _STD::distance(__mf, __m[__i].first));
|
||||
__matches_[__i].second = next(__f, _STD::distance(__mf, __m[__i].second));
|
||||
__matches_[__i].matched = __m[__i].matched;
|
||||
}
|
||||
__unmatched_.first = __l;
|
||||
__unmatched_.second = __l;
|
||||
__unmatched_.matched = false;
|
||||
__prefix_.first = _STD::next(__f, _STD::distance(__mf, __m.prefix().first));
|
||||
__prefix_.second = _STD::next(__f, _STD::distance(__mf, __m.prefix().second));
|
||||
__prefix_.first = next(__f, _STD::distance(__mf, __m.prefix().first));
|
||||
__prefix_.second = next(__f, _STD::distance(__mf, __m.prefix().second));
|
||||
__prefix_.matched = __m.prefix().matched;
|
||||
__suffix_.first = _STD::next(__f, _STD::distance(__mf, __m.suffix().first));
|
||||
__suffix_.second = _STD::next(__f, _STD::distance(__mf, __m.suffix().second));
|
||||
__suffix_.first = next(__f, _STD::distance(__mf, __m.suffix().first));
|
||||
__suffix_.second = next(__f, _STD::distance(__mf, __m.suffix().second));
|
||||
__suffix_.matched = __m.suffix().matched;
|
||||
if (!__no_update_pos)
|
||||
__position_start_ = __prefix_.first;
|
||||
@@ -5481,7 +5441,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, bool __at_first) const
|
||||
regex_constants::match_flag_type __flags) const
|
||||
{
|
||||
vector<__state> __states;
|
||||
ptrdiff_t __j = 0;
|
||||
@@ -5498,7 +5458,6 @@ 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
|
||||
{
|
||||
@@ -5547,7 +5506,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, bool __at_first) const
|
||||
regex_constants::match_flag_type __flags) const
|
||||
{
|
||||
deque<__state> __states;
|
||||
ptrdiff_t __highest_j = 0;
|
||||
@@ -5563,7 +5522,6 @@ 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
|
||||
{
|
||||
@@ -5625,7 +5583,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, bool __at_first) const
|
||||
regex_constants::match_flag_type __flags) const
|
||||
{
|
||||
vector<__state> __states;
|
||||
__state __best_state;
|
||||
@@ -5644,7 +5602,6 @@ 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
|
||||
@@ -5710,13 +5667,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, bool __at_first) const
|
||||
regex_constants::match_flag_type __flags) const
|
||||
{
|
||||
if ((__flags_ & 0x1F0) == ECMAScript)
|
||||
return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);
|
||||
return __match_at_start_ecma(__first, __last, __m, __flags);
|
||||
if (mark_count() == 0)
|
||||
return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);
|
||||
return __match_at_start_posix_subs(__first, __last, __m, __flags, __at_first);
|
||||
return __match_at_start_posix_nosubs(__first, __last, __m, __flags);
|
||||
return __match_at_start_posix_subs(__first, __last, __m, __flags);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -5727,9 +5684,11 @@ 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, true))
|
||||
if (__match_at_start(__first, __last, __m, __flags))
|
||||
{
|
||||
__m.__prefix_.second = __m[0].first;
|
||||
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
|
||||
@@ -5743,7 +5702,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, false))
|
||||
if (__match_at_start(__first, __last, __m, __flags))
|
||||
{
|
||||
__m.__prefix_.second = __m[0].first;
|
||||
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
|
||||
|
@@ -451,7 +451,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
__hm_ = _STD::max(this->pptr() + 1, __hm_);
|
||||
__hm_ = max(this->pptr() + 1, __hm_);
|
||||
if (__mode_ & ios_base::in)
|
||||
{
|
||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
||||
|
@@ -211,14 +211,6 @@ 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 {};
|
||||
@@ -400,8 +392,7 @@ 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 ||
|
||||
__is_nullptr_t<_Tp>::value ||
|
||||
: public integral_constant<bool, is_void<_Tp>::value ||
|
||||
is_arithmetic<_Tp>::value> {};
|
||||
|
||||
// is_scalar
|
||||
@@ -410,11 +401,8 @@ 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
|
||||
|
@@ -1101,7 +1101,7 @@ vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u)
|
||||
if (__n <= capacity())
|
||||
{
|
||||
size_type __s = size();
|
||||
_STD::fill_n(this->__begin_, _STD::min(__n, __s), __u);
|
||||
_STD::fill_n(this->__begin_, min(__n, __s), __u);
|
||||
if (__n > __s)
|
||||
__construct_at_end(__n - __s, __u);
|
||||
else
|
||||
|
@@ -14,10 +14,12 @@ endif()
|
||||
if (LIBCXX_ENABLE_SHARED)
|
||||
add_library(cxx SHARED
|
||||
${sources}
|
||||
${headers}
|
||||
)
|
||||
else()
|
||||
add_library(cxx STATIC
|
||||
${sources}
|
||||
${headers}
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -48,10 +50,7 @@ install(TARGETS cxx
|
||||
)
|
||||
|
||||
install(DIRECTORY ../include/
|
||||
DESTINATION include/libcxx/v1
|
||||
DESTINATION include/c++/v1
|
||||
FILES_MATCHING
|
||||
PATTERN "*"
|
||||
PATTERN ".svn" EXCLUDE
|
||||
PATTERN ".git" EXCLUDE
|
||||
)
|
||||
|
||||
|
@@ -40,7 +40,7 @@ case $TRIPLE in
|
||||
LDSHARED_FLAGS="-o libc++.1.dylib \
|
||||
-dynamiclib -nodefaultlibs -current_version 1 \
|
||||
-compatibility_version 1 \
|
||||
-install_name /usr/lib/libc++.1.dylib \
|
||||
-install_name /usr/lib/libc++.dylib \
|
||||
-Wl,-reexport_library,/usr/lib/libc++abi.dylib \
|
||||
-Wl,-unexported_symbols_list,libc++unexp.exp \
|
||||
/usr/lib/libSystem.B.dylib"
|
||||
@@ -49,7 +49,7 @@ case $TRIPLE in
|
||||
LDSHARED_FLAGS="-o libc++.1.dylib \
|
||||
-dynamiclib -nodefaultlibs \
|
||||
-current_version ${RC_ProjectSourceVersion} -compatibility_version 1 \
|
||||
-install_name /usr/lib/libc++.1.dylib \
|
||||
-install_name /usr/lib/libc++.dylib \
|
||||
${SDKROOT}/usr/lib/libc++abi.dylib \
|
||||
-lSystem \
|
||||
-Wl,-unexported_symbols_list,libc++unexp.exp \
|
||||
|
@@ -165,7 +165,7 @@ ios_base::iword(int index)
|
||||
size_t newcap;
|
||||
const size_t mx = std::numeric_limits<size_t>::max();
|
||||
if (req_size < mx/2)
|
||||
newcap = _STD::max(2 * __iarray_cap_, req_size);
|
||||
newcap = max(2 * __iarray_cap_, req_size);
|
||||
else
|
||||
newcap = mx;
|
||||
long* iarray = (long*)realloc(__iarray_, newcap * sizeof(long));
|
||||
@@ -193,7 +193,7 @@ ios_base::pword(int index)
|
||||
size_t newcap;
|
||||
const size_t mx = std::numeric_limits<size_t>::max();
|
||||
if (req_size < mx/2)
|
||||
newcap = _STD::max(2 * __parray_cap_, req_size);
|
||||
newcap = max(2 * __parray_cap_, req_size);
|
||||
else
|
||||
newcap = mx;
|
||||
void** parray = (void**)realloc(__parray_, newcap * sizeof(void*));
|
||||
@@ -223,7 +223,7 @@ ios_base::register_callback(event_callback fn, int index)
|
||||
size_t newcap;
|
||||
const size_t mx = std::numeric_limits<size_t>::max();
|
||||
if (req_size < mx/2)
|
||||
newcap = _STD::max(2 * __event_cap_, req_size);
|
||||
newcap = max(2 * __event_cap_, req_size);
|
||||
else
|
||||
newcap = mx;
|
||||
event_callback* fns = (event_callback*)realloc(__fn_, newcap * sizeof(event_callback));
|
||||
|
@@ -229,7 +229,7 @@ string
|
||||
__get_collation_name(const char* s)
|
||||
{
|
||||
const collationnames* i =
|
||||
_STD::lower_bound(begin(collatenames), end(collatenames), s, use_strcmp());
|
||||
lower_bound(begin(collatenames), end(collatenames), s, use_strcmp());
|
||||
string r;
|
||||
if (i != end(collatenames) && strcmp(s, i->elem_) == 0)
|
||||
r = char(i->char_);
|
||||
@@ -240,7 +240,7 @@ ctype_base::mask
|
||||
__get_classname(const char* s, bool __icase)
|
||||
{
|
||||
const classnames* i =
|
||||
_STD::lower_bound(begin(ClassNames), end(ClassNames), s, use_strcmp());
|
||||
lower_bound(begin(ClassNames), end(ClassNames), s, use_strcmp());
|
||||
ctype_base::mask r = 0;
|
||||
if (i != end(ClassNames) && strcmp(s, i->elem_) == 0)
|
||||
{
|
||||
|
@@ -302,7 +302,7 @@ strstreambuf::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmod
|
||||
{
|
||||
char* newpos = eback() + newoff;
|
||||
if (pos_in)
|
||||
setg(eback(), newpos, _STD::max(newpos, egptr()));
|
||||
setg(eback(), newpos, max(newpos, egptr()));
|
||||
if (pos_out)
|
||||
{
|
||||
// min(pbase, newpos), newpos, epptr()
|
||||
@@ -332,7 +332,7 @@ strstreambuf::seekpos(pos_type __sp, ios_base::openmode __which)
|
||||
{
|
||||
char* newpos = eback() + newoff;
|
||||
if (pos_in)
|
||||
setg(eback(), newpos, _STD::max(newpos, egptr()));
|
||||
setg(eback(), newpos, max(newpos, egptr()));
|
||||
if (pos_out)
|
||||
{
|
||||
// min(pbase, newpos), newpos, epptr()
|
||||
|
@@ -32,7 +32,7 @@ if(PYTHONINTERP_FOUND)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
@ONLY)
|
||||
|
||||
add_custom_target(libcxx.check
|
||||
add_custom_target(check
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
${LIT_EXECUTABLE}
|
||||
${LIT_ARGS}
|
||||
@@ -40,5 +40,5 @@ if(PYTHONINTERP_FOUND)
|
||||
DEPENDS
|
||||
COMMENT "Running libcxx tests")
|
||||
else()
|
||||
message(WARNING "Could not find Python, no libcxx.check target will be available!")
|
||||
message(WARNING "Could not find Python, no check target will be available!")
|
||||
endif()
|
||||
|
@@ -1,25 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <map>
|
||||
|
||||
// class map
|
||||
|
||||
// map();
|
||||
|
||||
#include <map>
|
||||
|
||||
struct X
|
||||
{
|
||||
std::multimap<int, X> m;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
@@ -20,22 +20,13 @@ 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 B();
|
||||
throw 1;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@@ -41,19 +41,4 @@ 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);
|
||||
}
|
||||
|
@@ -1,53 +0,0 @@
|
||||
#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>();
|
||||
}
|
67
test/testit
67
test/testit
@@ -8,14 +8,51 @@
|
||||
# //
|
||||
# //===--------------------------------------------------------------------===//
|
||||
|
||||
BACKUP="../"
|
||||
|
||||
currentpath=`pwd`
|
||||
origpath=$currentpath
|
||||
currentdir=`basename $currentpath`
|
||||
while [ $currentdir != "test" ]; do
|
||||
if [ $currentdir == "/" ]
|
||||
then
|
||||
echo "current directory must be in or under \"test\"."
|
||||
exit 1
|
||||
fi
|
||||
cd ..
|
||||
currentpath=`pwd`
|
||||
currentdir=`basename $currentpath`
|
||||
BACKUP="../"$BACKUP
|
||||
done
|
||||
cd $origpath
|
||||
|
||||
if [ -z $CC ]
|
||||
then
|
||||
CC=clang++
|
||||
CC=g++
|
||||
fi
|
||||
|
||||
auto_header=0
|
||||
|
||||
if [ -z $HEADER_INCLUDE ]
|
||||
then
|
||||
HEADER_INCLUDE=$BACKUP"include"
|
||||
let "auto_header+=1"
|
||||
fi
|
||||
|
||||
auto_lib=0
|
||||
|
||||
SOURCE_LIB=/usr/lib/libc++.dylib
|
||||
#SOURCE_LIB=/Users/hinnant/Development/libcpp/lib/libc++.a
|
||||
|
||||
if [ -z $SOURCE_LIB ]
|
||||
then
|
||||
SOURCE_LIB=$BACKUP"lib/libc++.dylib"
|
||||
let "auto_lib+=1"
|
||||
fi
|
||||
|
||||
if [ -z "$OPTIONS" ]
|
||||
then
|
||||
OPTIONS="-std=c++0x -stdlib=libc++"
|
||||
OPTIONS="-nostdinc++ -nodefaultlibs /usr/lib/libSystem.B.dylib -arch `arch`"
|
||||
fi
|
||||
|
||||
FAIL=0
|
||||
@@ -31,7 +68,7 @@ function afunc
|
||||
if (ls *.fail.cpp &> /dev/null)
|
||||
then
|
||||
for FILE in $(ls *.fail.cpp); do
|
||||
if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE &> /dev/null
|
||||
if $CC $OPTIONS -I$HEADER_INCLUDE $SOURCE_LIB $FILE &> /dev/null
|
||||
then
|
||||
rm ./a.out
|
||||
echo "$FILE should not compile"
|
||||
@@ -45,7 +82,7 @@ function afunc
|
||||
if (ls *.pass.cpp &> /dev/null)
|
||||
then
|
||||
for FILE in $(ls *.pass.cpp); do
|
||||
if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE
|
||||
if $CC $OPTIONS -I$HEADER_INCLUDE $SOURCE_LIB $FILE
|
||||
then
|
||||
if ./a.out
|
||||
then
|
||||
@@ -90,7 +127,27 @@ function afunc
|
||||
if [ -d "$FILE" ];
|
||||
then
|
||||
cd $FILE
|
||||
if [ $auto_header -eq 1 ]
|
||||
then
|
||||
SAVE_HEADER_INCLUDE=$HEADER_INCLUDE
|
||||
HEADER_INCLUDE="../"$HEADER_INCLUDE
|
||||
fi
|
||||
if [ $auto_lib -eq 1 ]
|
||||
then
|
||||
SAVE_SOURCE_LIB=$SOURCE_LIB
|
||||
SOURCE_LIB="../"$SOURCE_LIB
|
||||
fi
|
||||
|
||||
afunc
|
||||
|
||||
if [ $auto_header -eq 1 ]
|
||||
then
|
||||
HEADER_INCLUDE=${HEADER_INCLUDE:3}
|
||||
fi
|
||||
if [ $auto_lib -eq 1 ]
|
||||
then
|
||||
SOURCE_LIB=${SOURCE_LIB:3}
|
||||
fi
|
||||
cd ..
|
||||
fi
|
||||
done
|
||||
@@ -101,7 +158,7 @@ afunc
|
||||
echo "****************************************************"
|
||||
echo "Results for `pwd`:"
|
||||
echo "using `$CC --version`"
|
||||
echo "with $OPTIONS $HEADER_INCLUDE $SOURCE_LIB"
|
||||
echo "with $OPTIONS -I$HEADER_INCLUDE $SOURCE_LIB"
|
||||
echo "----------------------------------------------------"
|
||||
echo "sections without tests : $UNIMPLEMENTED"
|
||||
echo "sections with failures : $IMPLEMENTED_FAIL"
|
||||
|
@@ -157,8 +157,7 @@
|
||||
|
||||
<ul>
|
||||
<li><code>cd /usr/lib</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>sudo ln -sf path-to-libcxx/lib/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="#80FF80"><tt>__is_base_of(T, U)</tt></td>
|
||||
<td bgcolor="#FF5965"><tt>__is_base_of(T, U)</tt></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
Reference in New Issue
Block a user