Compare commits
34 Commits
svn-tags/l
...
svn-tags/l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f304fcf54 | ||
|
|
0a68a4d739 | ||
|
|
60a0a8ef24 | ||
|
|
45783d2dfd | ||
|
|
3da2d48b03 | ||
|
|
d78b315935 | ||
|
|
f3dcca049b | ||
|
|
8daa733576 | ||
|
|
a0d045b787 | ||
|
|
588ea08124 | ||
|
|
15476f345d | ||
|
|
e9de5ff443 | ||
|
|
856846b66f | ||
|
|
ad2a7ab9a9 | ||
|
|
17615b040d | ||
|
|
ddff70e879 | ||
|
|
2ade7c27f8 | ||
|
|
1371b2e56e | ||
|
|
aa69808da9 | ||
|
|
639a668b4c | ||
|
|
22ce0b4a1c | ||
|
|
68025ed084 | ||
|
|
173968a5f2 | ||
|
|
e34f17d383 | ||
|
|
cba352d348 | ||
|
|
ac30386dfe | ||
|
|
37f9f9c587 | ||
|
|
e77aa5e7f4 | ||
|
|
f8ce459f8d | ||
|
|
43b4decac5 | ||
|
|
0dca5fc7ad | ||
|
|
9b80f2b044 | ||
|
|
7e9d84b746 | ||
|
|
cd85b9ee13 |
103
include/__config
103
include/__config
@@ -73,6 +73,76 @@
|
||||
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
|
||||
|
||||
#if defined(__clang__)
|
||||
|
||||
#if !(__has_feature(cxx_exceptions))
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_STRONG_USING
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#else
|
||||
|
||||
#if __has_feature(cxx_rvalue_references)
|
||||
#define _LIBCPP_MOVE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_decltype))
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_deleted_functions))
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_nullptr))
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_static_assert))
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_variadic_templates))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#if !__EXCEPTIONS
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#else
|
||||
|
||||
#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
|
||||
#define _LIBCPP_MOVE
|
||||
#endif
|
||||
@@ -81,23 +151,22 @@
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#endif
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#define _LIBCPP_HAS_NO_STRONG_USING
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STRONG_USING
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
|
||||
@@ -106,6 +175,7 @@
|
||||
#else
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _STD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
namespace _LIBCPP_NAMESPACE {
|
||||
@@ -113,12 +183,11 @@ namespace _LIBCPP_NAMESPACE {
|
||||
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||
}
|
||||
|
||||
#define _STD std::_LIBCPP_NAMESPACE
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef unsigned short char16_t;
|
||||
typedef unsigned int char32_t;
|
||||
typedef unsigned short char16_t;
|
||||
typedef unsigned int char32_t;
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
@@ -133,13 +202,7 @@ template <unsigned> struct __static_assert_check {};
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_DECLTYPE
|
||||
|
||||
#define decltype(x) __typeof__(x)
|
||||
|
||||
#endif
|
||||
|
||||
#if !__EXCEPTIONS
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
||||
|
||||
@@ -18,7 +18,7 @@ protected:
|
||||
void __throw_out_of_range() const;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _Tp, class _Allocator = allocator<_Tp> >
|
||||
struct __split_buffer
|
||||
: private __split_buffer_common<true>
|
||||
{
|
||||
@@ -497,7 +497,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 2) / 4, __alloc());
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
@@ -528,7 +528,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 2) / 4, __alloc());
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
|
||||
@@ -297,6 +297,12 @@ long double truncl(long double x);
|
||||
|
||||
*/
|
||||
|
||||
// FIXME: work around for Clang with -std=C++0x on OSX/iOS
|
||||
#if defined(__clang__) && defined(__APPLE__)
|
||||
# pragma push_macro("__STRICT_ANSI__")
|
||||
# undef __STRICT_ANSI__
|
||||
#endif
|
||||
|
||||
#include <__config>
|
||||
#include <math.h>
|
||||
#include <type_traits>
|
||||
@@ -1641,4 +1647,9 @@ using ::truncl;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
// FIXME: work around for Clang with -std=C++0x on OSX/iOS
|
||||
#if defined(__clang__) && defined(__APPLE__)
|
||||
# pragma pop_macro("__STRICT_ANSI__")
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CMATH
|
||||
|
||||
@@ -18,8 +18,16 @@
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <ccomplex>
|
||||
|
||||
#else
|
||||
|
||||
#include_next <complex.h>
|
||||
|
||||
#endif
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#endif // _LIBCPP_COMPLEX_H
|
||||
|
||||
@@ -78,6 +78,42 @@ struct nullptr_t
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
|
||||
|
||||
template <typename _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, _Tp* __p) {return 0 == __p;}
|
||||
|
||||
template <typename _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator==(_Tp* __p, nullptr_t) {return __p == 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, _Tp* __p) {return 0 != __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator!=(_Tp* __p, nullptr_t) {return __p != 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, _Tp* __p) {return 0 < __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<(_Tp* __p, nullptr_t) {return __p < 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, _Tp* __p) {return 0 <= __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(_Tp* __p, nullptr_t) {return __p <= 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, _Tp* __p) {return 0 > __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(_Tp* __p, nullptr_t) {return __p > 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, _Tp* __p) {return 0 >= __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(_Tp* __p, nullptr_t) {return __p >= 0;}
|
||||
};
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||
|
||||
@@ -77,23 +77,23 @@ using ::strncmp;
|
||||
using ::strcoll;
|
||||
using ::strxfrm;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const void* memchr(const void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
|
||||
using ::memchr;
|
||||
inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const char* strchr(const char* __s, int __c) {return ::strchr(__s, __c);}
|
||||
using ::strchr;
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
|
||||
|
||||
using ::strcspn;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const char* strpbrk(const char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
||||
using ::strpbrk;
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const char* strrchr(const char* __s, int __c) {return ::strrchr(__s, __c);}
|
||||
using ::strrchr;
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
|
||||
|
||||
using ::strspn;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const char* strstr(const char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
|
||||
using ::strstr;
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
|
||||
|
||||
using ::strtok;
|
||||
|
||||
@@ -789,7 +789,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
typename basic_filebuf<_CharT, _Traits>::pos_type
|
||||
basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode __wch)
|
||||
basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
|
||||
{
|
||||
if (__file_ == 0 || sync())
|
||||
return pos_type(off_type(-1));
|
||||
|
||||
@@ -1615,7 +1615,7 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
|
||||
|
||||
#endif // _LIBCPP_DEBUG
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#if defined(_LIBCPP_MOVE) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
|
||||
|
||||
template <class _C>
|
||||
inline
|
||||
|
||||
@@ -1129,7 +1129,7 @@ struct uses_allocator
|
||||
{
|
||||
};
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#if defined(_LIBCPP_MOVE) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
|
||||
|
||||
// uses-allocator construction
|
||||
|
||||
|
||||
3865
include/regex
3865
include/regex
File diff suppressed because it is too large
Load Diff
@@ -1,44 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- stdbool.h --------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_STDBOOL_H
|
||||
#define _LIBCPP_STDBOOL_H
|
||||
|
||||
/*
|
||||
stdbool.h synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
__bool_true_false_are_defined
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <__config>
|
||||
#endif
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#undef __bool_true_false_are_defined
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#define bool _Bool
|
||||
#if __STDC_VERSION__ < 199901L && __GNUC__ < 3
|
||||
typedef int _Bool;
|
||||
#endif
|
||||
|
||||
#define false (bool)0
|
||||
#define true (bool)1
|
||||
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
#endif // _LIBCPP_STDBOOL_H
|
||||
@@ -1259,8 +1259,6 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const {return __r_.second();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY bool __is_long() const {return bool(__r_.first().__s.__size_ & __short_mask);}
|
||||
_LIBCPP_INLINE_VISIBILITY void __set_long() {__r_.first().__s.__size_ &= __short_mask;}
|
||||
_LIBCPP_INLINE_VISIBILITY void __set_short() {__r_.first().__s.__size_ |= ~__short_mask;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __set_short_size(size_type __s)
|
||||
#if _LIBCPP_BIG_ENDIAN
|
||||
|
||||
@@ -178,9 +178,12 @@ class thread
|
||||
{
|
||||
pthread_t __t_;
|
||||
|
||||
#ifndef _LIBCPP_MOVE
|
||||
thread(const thread&); // = delete;
|
||||
thread& operator=(const thread&); // = delete;
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
thread(const thread&) = delete;
|
||||
thread& operator=(const thread&) = delete;
|
||||
#else
|
||||
thread(const thread&);
|
||||
thread& operator=(const thread&);
|
||||
#endif
|
||||
public:
|
||||
typedef __thread_id id;
|
||||
@@ -201,9 +204,7 @@ public:
|
||||
~thread();
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
thread(const thread&) = delete;
|
||||
thread(thread&& __t) : __t_(__t.__t_) {__t.__t_ = 0;}
|
||||
thread& operator=(const thread&) = delete;
|
||||
thread& operator=(thread&& __t);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1093,10 +1093,10 @@ private:
|
||||
#else
|
||||
static _Tp __t();
|
||||
static _Up __u();
|
||||
static bool __f();
|
||||
#endif
|
||||
static bool __f();
|
||||
public:
|
||||
typedef __typeof__(__f() ? __t() : __u()) type;
|
||||
typedef decltype(__f() ? __t() : __u()) type;
|
||||
};
|
||||
|
||||
#else
|
||||
@@ -1135,7 +1135,10 @@ struct common_type<_Tp, _Up, _Vp...>
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename remove_reference<_Tp>::type&&
|
||||
move(_Tp&& __t) {return __t;}
|
||||
move(_Tp&& __t)
|
||||
{
|
||||
return static_cast<typename remove_reference<_Tp>::type&&>(__t);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Up,
|
||||
class = typename _STD::enable_if<
|
||||
@@ -1148,8 +1151,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp&&
|
||||
forward(_Up&& __t)
|
||||
{
|
||||
return __t; // to quiet spurious warning
|
||||
// return static_cast<_Tp&&>(__t);
|
||||
return static_cast<_Tp&&>(__t);
|
||||
}
|
||||
|
||||
#else // _LIBCPP_MOVE
|
||||
@@ -1464,22 +1466,23 @@ struct __is_constructible_void_check<true, _Tp, _Args...>
|
||||
: public false_type
|
||||
{};
|
||||
|
||||
template <class ..._Args> struct __constains_void;
|
||||
template <class ..._Args> struct __contains_void;
|
||||
|
||||
template <> struct __constains_void<> : false_type {};
|
||||
template <> struct __contains_void<> : false_type {};
|
||||
|
||||
template <class _A0, class ..._Args>
|
||||
struct __constains_void<_A0, _Args...>
|
||||
struct __contains_void<_A0, _Args...>
|
||||
{
|
||||
static const bool value = is_void<_A0>::value ||
|
||||
__constains_void<_Args...>::value;
|
||||
__contains_void<_Args...>::value;
|
||||
};
|
||||
|
||||
// is_constructible entry point
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
struct is_constructible
|
||||
: public __is_constructible_void_check<__constains_void<_Tp, _Args...>::value,
|
||||
: public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value
|
||||
|| is_abstract<_Tp>::value,
|
||||
_Tp, _Args...>
|
||||
{};
|
||||
|
||||
|
||||
@@ -223,6 +223,8 @@ struct pair
|
||||
second(_STD::forward<_U2>(__u2))
|
||||
{}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Tuple,
|
||||
class = typename enable_if<__tuple_convertible<_Tuple, pair>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -233,7 +235,6 @@ struct pair
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(get<1>(__p)))
|
||||
{}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
|
||||
pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
|
||||
tuple<_Args2...> __second_args)
|
||||
@@ -241,7 +242,6 @@ struct pair
|
||||
typename __make_tuple_indices<sizeof...(_Args1)>::type(),
|
||||
typename __make_tuple_indices<sizeof...(_Args2) >::type())
|
||||
{}
|
||||
#endif
|
||||
|
||||
template <class _Tuple,
|
||||
class = typename enable_if<__tuple_assignable<_Tuple, pair>::value>::type>
|
||||
@@ -256,6 +256,8 @@ struct pair
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
template<class _U1, class _U2>
|
||||
_LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p)
|
||||
|
||||
@@ -21,7 +21,7 @@ case $TRIPLE in
|
||||
*-apple-*)
|
||||
if [ -z $RC_BUILDIT ]
|
||||
then
|
||||
RC_CFLAGS="-arch i386 -arch ppc -arch x86_64"
|
||||
RC_CFLAGS="-arch i386 -arch x86_64"
|
||||
fi
|
||||
SOEXT=dylib
|
||||
LDSHARED_FLAGS="-o libc++.1.dylib \
|
||||
|
||||
@@ -50,6 +50,10 @@ make_error_type_string(regex_constants::error_type ecode)
|
||||
case regex_constants::error_stack:
|
||||
return "There was insufficient memory to determine whether the regular "
|
||||
"expression could match the specified character sequence.";
|
||||
case regex_constants::__re_err_grammar:
|
||||
return "An invalid regex grammar has been requested.";
|
||||
case regex_constants::__re_err_empty:
|
||||
return "An empty regex is not allowed in the POSIX grammar.";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -252,4 +256,62 @@ __get_classname(const char* s, bool __icase)
|
||||
return r;
|
||||
}
|
||||
|
||||
template <>
|
||||
void
|
||||
__match_any_but_newline<char>::__exec(__state& __s) const
|
||||
{
|
||||
if (__s.__current_ != __s.__last_)
|
||||
{
|
||||
switch (*__s.__current_)
|
||||
{
|
||||
case '\r':
|
||||
case '\n':
|
||||
__s.__do_ = __state::__reject;
|
||||
__s.__node_ = nullptr;
|
||||
break;
|
||||
default:
|
||||
__s.__do_ = __state::__accept_and_consume;
|
||||
++__s.__current_;
|
||||
__s.__node_ = this->first();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__s.__do_ = __state::__reject;
|
||||
__s.__node_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
void
|
||||
__match_any_but_newline<wchar_t>::__exec(__state& __s) const
|
||||
{
|
||||
if (__s.__current_ != __s.__last_)
|
||||
{
|
||||
switch (*__s.__current_)
|
||||
{
|
||||
case '\r':
|
||||
case '\n':
|
||||
case 0x2028:
|
||||
case 0x2029:
|
||||
__s.__do_ = __state::__reject;
|
||||
__s.__node_ = nullptr;
|
||||
break;
|
||||
default:
|
||||
__s.__do_ = __state::__accept_and_consume;
|
||||
++__s.__current_;
|
||||
__s.__node_ = this->first();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__s.__do_ = __state::__reject;
|
||||
__s.__node_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
@@ -24,9 +24,10 @@ int main()
|
||||
"sizeof(std::nullptr_t) == sizeof(void*)");
|
||||
A* p = 0;
|
||||
assert(p == nullptr);
|
||||
assert(nullptr == p);
|
||||
#if !((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ <= 5))
|
||||
// GCC 4.2 through 4.5 can't handle this
|
||||
void (A::*pmf)() = 0;
|
||||
#ifdef __clang__
|
||||
// GCC 4.2 can't handle this
|
||||
assert(pmf == nullptr);
|
||||
#endif
|
||||
int A::*pmd = 0;
|
||||
@@ -41,4 +42,20 @@ int main()
|
||||
assert(!(nullptr != nullptr));
|
||||
assert(!(nullptr < nullptr));
|
||||
assert(!(nullptr > nullptr));
|
||||
assert(!(&a1 == nullptr));
|
||||
assert(!(nullptr == &a1));
|
||||
assert(&a1 != nullptr);
|
||||
assert(nullptr != &a1);
|
||||
assert(nullptr < &a1);
|
||||
assert(nullptr <= &a1);
|
||||
assert(!(nullptr < p));
|
||||
assert(nullptr <= p);
|
||||
assert(!(&a1 < nullptr));
|
||||
assert(!(&a1 <= nullptr));
|
||||
assert(!(p < nullptr));
|
||||
assert(p <= nullptr);
|
||||
assert(!(nullptr > &a1));
|
||||
assert(!(nullptr >= &a1));
|
||||
assert(!(nullptr > p));
|
||||
assert(nullptr >= p);
|
||||
}
|
||||
|
||||
251
test/re/iterators.h
Normal file
251
test/re/iterators.h
Normal file
@@ -0,0 +1,251 @@
|
||||
#ifndef ITERATORS_H
|
||||
#define ITERATORS_H
|
||||
|
||||
#include <iterator>
|
||||
|
||||
template <class It>
|
||||
class input_iterator
|
||||
{
|
||||
It it_;
|
||||
|
||||
template <class U> friend class input_iterator;
|
||||
public:
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
typedef typename std::iterator_traits<It>::value_type value_type;
|
||||
typedef typename std::iterator_traits<It>::difference_type difference_type;
|
||||
typedef It pointer;
|
||||
typedef typename std::iterator_traits<It>::reference reference;
|
||||
|
||||
It base() const {return it_;}
|
||||
|
||||
input_iterator() : it_() {}
|
||||
explicit input_iterator(It it) : it_(it) {}
|
||||
template <class U>
|
||||
input_iterator(const input_iterator<U>& u) :it_(u.it_) {}
|
||||
|
||||
reference operator*() const {return *it_;}
|
||||
pointer operator->() const {return it_;}
|
||||
|
||||
input_iterator& operator++() {++it_; return *this;}
|
||||
input_iterator operator++(int)
|
||||
{input_iterator tmp(*this); ++(*this); return tmp;}
|
||||
|
||||
friend bool operator==(const input_iterator& x, const input_iterator& y)
|
||||
{return x.it_ == y.it_;}
|
||||
friend bool operator!=(const input_iterator& x, const input_iterator& y)
|
||||
{return !(x == y);}
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
bool
|
||||
operator==(const input_iterator<T>& x, const input_iterator<U>& y)
|
||||
{
|
||||
return x.base() == y.base();
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
bool
|
||||
operator!=(const input_iterator<T>& x, const input_iterator<U>& y)
|
||||
{
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
template <class It>
|
||||
class forward_iterator
|
||||
{
|
||||
It it_;
|
||||
|
||||
template <class U> friend class forward_iterator;
|
||||
public:
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
typedef typename std::iterator_traits<It>::value_type value_type;
|
||||
typedef typename std::iterator_traits<It>::difference_type difference_type;
|
||||
typedef It pointer;
|
||||
typedef typename std::iterator_traits<It>::reference reference;
|
||||
|
||||
It base() const {return it_;}
|
||||
|
||||
forward_iterator() : it_() {}
|
||||
explicit forward_iterator(It it) : it_(it) {}
|
||||
template <class U>
|
||||
forward_iterator(const forward_iterator<U>& u) :it_(u.it_) {}
|
||||
|
||||
reference operator*() const {return *it_;}
|
||||
pointer operator->() const {return it_;}
|
||||
|
||||
forward_iterator& operator++() {++it_; return *this;}
|
||||
forward_iterator operator++(int)
|
||||
{forward_iterator tmp(*this); ++(*this); return tmp;}
|
||||
|
||||
friend bool operator==(const forward_iterator& x, const forward_iterator& y)
|
||||
{return x.it_ == y.it_;}
|
||||
friend bool operator!=(const forward_iterator& x, const forward_iterator& y)
|
||||
{return !(x == y);}
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
bool
|
||||
operator==(const forward_iterator<T>& x, const forward_iterator<U>& y)
|
||||
{
|
||||
return x.base() == y.base();
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
bool
|
||||
operator!=(const forward_iterator<T>& x, const forward_iterator<U>& y)
|
||||
{
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
template <class It>
|
||||
class bidirectional_iterator
|
||||
{
|
||||
It it_;
|
||||
|
||||
template <class U> friend class bidirectional_iterator;
|
||||
public:
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
typedef typename std::iterator_traits<It>::value_type value_type;
|
||||
typedef typename std::iterator_traits<It>::difference_type difference_type;
|
||||
typedef It pointer;
|
||||
typedef typename std::iterator_traits<It>::reference reference;
|
||||
|
||||
It base() const {return it_;}
|
||||
|
||||
bidirectional_iterator() : it_() {}
|
||||
explicit bidirectional_iterator(It it) : it_(it) {}
|
||||
template <class U>
|
||||
bidirectional_iterator(const bidirectional_iterator<U>& u) :it_(u.it_) {}
|
||||
|
||||
reference operator*() const {return *it_;}
|
||||
pointer operator->() const {return it_;}
|
||||
|
||||
bidirectional_iterator& operator++() {++it_; return *this;}
|
||||
bidirectional_iterator operator++(int)
|
||||
{bidirectional_iterator tmp(*this); ++(*this); return tmp;}
|
||||
|
||||
bidirectional_iterator& operator--() {--it_; return *this;}
|
||||
bidirectional_iterator operator--(int)
|
||||
{bidirectional_iterator tmp(*this); --(*this); return tmp;}
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
bool
|
||||
operator==(const bidirectional_iterator<T>& x, const bidirectional_iterator<U>& y)
|
||||
{
|
||||
return x.base() == y.base();
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
bool
|
||||
operator!=(const bidirectional_iterator<T>& x, const bidirectional_iterator<U>& y)
|
||||
{
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
template <class It>
|
||||
class random_access_iterator
|
||||
{
|
||||
It it_;
|
||||
|
||||
template <class U> friend class random_access_iterator;
|
||||
public:
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef typename std::iterator_traits<It>::value_type value_type;
|
||||
typedef typename std::iterator_traits<It>::difference_type difference_type;
|
||||
typedef It pointer;
|
||||
typedef typename std::iterator_traits<It>::reference reference;
|
||||
|
||||
It base() const {return it_;}
|
||||
|
||||
random_access_iterator() : it_() {}
|
||||
explicit random_access_iterator(It it) : it_(it) {}
|
||||
template <class U>
|
||||
random_access_iterator(const random_access_iterator<U>& u) :it_(u.it_) {}
|
||||
|
||||
reference operator*() const {return *it_;}
|
||||
pointer operator->() const {return it_;}
|
||||
|
||||
random_access_iterator& operator++() {++it_; return *this;}
|
||||
random_access_iterator operator++(int)
|
||||
{random_access_iterator tmp(*this); ++(*this); return tmp;}
|
||||
|
||||
random_access_iterator& operator--() {--it_; return *this;}
|
||||
random_access_iterator operator--(int)
|
||||
{random_access_iterator tmp(*this); --(*this); return tmp;}
|
||||
|
||||
random_access_iterator& operator+=(difference_type n) {it_ += n; return *this;}
|
||||
random_access_iterator operator+(difference_type n) const
|
||||
{random_access_iterator tmp(*this); tmp += n; return tmp;}
|
||||
friend random_access_iterator operator+(difference_type n, random_access_iterator x)
|
||||
{x += n; return x;}
|
||||
random_access_iterator& operator-=(difference_type n) {return *this += -n;}
|
||||
random_access_iterator operator-(difference_type n) const
|
||||
{random_access_iterator tmp(*this); tmp -= n; return tmp;}
|
||||
|
||||
reference operator[](difference_type n) const {return it_[n];}
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
bool
|
||||
operator==(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
|
||||
{
|
||||
return x.base() == y.base();
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
bool
|
||||
operator!=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
|
||||
{
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
bool
|
||||
operator<(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
|
||||
{
|
||||
return x.base() < y.base();
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
bool
|
||||
operator<=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
|
||||
{
|
||||
return !(y < x);
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
bool
|
||||
operator>(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
|
||||
{
|
||||
return y < x;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
bool
|
||||
operator>=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
|
||||
{
|
||||
return !(x < y);
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
typename std::iterator_traits<T>::difference_type
|
||||
operator-(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
|
||||
{
|
||||
return x.base() - y.base();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,4 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- algorithm ---------------------------------===//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
||||
12
test/re/re.alg/nothing_to_do.pass.cpp
Normal file
12
test/re/re.alg/nothing_to_do.pass.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
||||
1568
test/re/re.alg/re.alg.search/awk.pass.cpp
Normal file
1568
test/re/re.alg/re.alg.search/awk.pass.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1542
test/re/re.alg/re.alg.search/basic.pass.cpp
Normal file
1542
test/re/re.alg/re.alg.search/basic.pass.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1585
test/re/re.alg/re.alg.search/ecma.pass.cpp
Normal file
1585
test/re/re.alg/re.alg.search/ecma.pass.cpp
Normal file
File diff suppressed because it is too large
Load Diff
92
test/re/re.alg/re.alg.search/egrep.pass.cpp
Normal file
92
test/re/re.alg/re.alg.search/egrep.pass.cpp
Normal file
@@ -0,0 +1,92 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator, class Allocator, class charT, class traits>
|
||||
// bool
|
||||
// regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||||
// match_results<BidirectionalIterator, Allocator>& m,
|
||||
// const basic_regex<charT, traits>& e,
|
||||
// regex_constants::match_flag_type flags = regex_constants::match_default);
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../iterators.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::cmatch m;
|
||||
const char s[] = "tournament";
|
||||
assert(std::regex_search(s, m, std::regex("tour\nto\ntournament",
|
||||
std::regex_constants::egrep)));
|
||||
assert(m.size() == 1);
|
||||
assert(!m.prefix().matched);
|
||||
assert(m.prefix().first == s);
|
||||
assert(m.prefix().second == m[0].first);
|
||||
assert(!m.suffix().matched);
|
||||
assert(m.suffix().first == m[0].second);
|
||||
assert(m.suffix().second == s + std::char_traits<char>::length(s));
|
||||
assert(m.length(0) == 10);
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == "tournament");
|
||||
}
|
||||
{
|
||||
std::cmatch m;
|
||||
const char s[] = "ment";
|
||||
assert(std::regex_search(s, m, std::regex("tour\n\ntournament",
|
||||
std::regex_constants::egrep)));
|
||||
assert(m.size() == 1);
|
||||
assert(!m.prefix().matched);
|
||||
assert(m.prefix().first == s);
|
||||
assert(m.prefix().second == m[0].first);
|
||||
assert(m.suffix().matched);
|
||||
assert(m.suffix().first == m[0].second);
|
||||
assert(m.suffix().second == s + std::char_traits<char>::length(s));
|
||||
assert(m.length(0) == 0);
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == "");
|
||||
}
|
||||
{
|
||||
std::cmatch m;
|
||||
const char s[] = "tournament";
|
||||
assert(std::regex_search(s, m, std::regex("(tour|to|tournament)+\ntourna",
|
||||
std::regex_constants::egrep)));
|
||||
assert(m.size() == 2);
|
||||
assert(!m.prefix().matched);
|
||||
assert(m.prefix().first == s);
|
||||
assert(m.prefix().second == m[0].first);
|
||||
assert(!m.suffix().matched);
|
||||
assert(m.suffix().first == m[0].second);
|
||||
assert(m.suffix().second == s + std::char_traits<char>::length(s));
|
||||
assert(m.length(0) == 10);
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == "tournament");
|
||||
}
|
||||
{
|
||||
std::cmatch m;
|
||||
const char s[] = "tourna";
|
||||
assert(std::regex_search(s, m, std::regex("(tour|to|tournament)+\ntourna",
|
||||
std::regex_constants::egrep)));
|
||||
assert(m.size() == 2);
|
||||
assert(!m.prefix().matched);
|
||||
assert(m.prefix().first == s);
|
||||
assert(m.prefix().second == m[0].first);
|
||||
assert(!m.suffix().matched);
|
||||
assert(m.suffix().first == m[0].second);
|
||||
assert(m.suffix().second == s + std::char_traits<char>::length(s));
|
||||
assert(m.length(0) == 6);
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == "tourna");
|
||||
}
|
||||
}
|
||||
1537
test/re/re.alg/re.alg.search/extended.pass.cpp
Normal file
1537
test/re/re.alg/re.alg.search/extended.pass.cpp
Normal file
File diff suppressed because it is too large
Load Diff
60
test/re/re.alg/re.alg.search/grep.pass.cpp
Normal file
60
test/re/re.alg/re.alg.search/grep.pass.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator, class Allocator, class charT, class traits>
|
||||
// bool
|
||||
// regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||||
// match_results<BidirectionalIterator, Allocator>& m,
|
||||
// const basic_regex<charT, traits>& e,
|
||||
// regex_constants::match_flag_type flags = regex_constants::match_default);
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../iterators.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::cmatch m;
|
||||
const char s[] = "tournament";
|
||||
assert(std::regex_search(s, m, std::regex("tour\nto\ntournament",
|
||||
std::regex_constants::grep)));
|
||||
assert(m.size() == 1);
|
||||
assert(!m.prefix().matched);
|
||||
assert(m.prefix().first == s);
|
||||
assert(m.prefix().second == m[0].first);
|
||||
assert(!m.suffix().matched);
|
||||
assert(m.suffix().first == m[0].second);
|
||||
assert(m.suffix().second == s + std::char_traits<char>::length(s));
|
||||
assert(m.length(0) == 10);
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == "tournament");
|
||||
}
|
||||
{
|
||||
std::cmatch m;
|
||||
const char s[] = "ment";
|
||||
assert(std::regex_search(s, m, std::regex("tour\n\ntournament",
|
||||
std::regex_constants::grep)));
|
||||
assert(m.size() == 1);
|
||||
assert(!m.prefix().matched);
|
||||
assert(m.prefix().first == s);
|
||||
assert(m.prefix().second == m[0].first);
|
||||
assert(m.suffix().matched);
|
||||
assert(m.suffix().first == m[0].second);
|
||||
assert(m.suffix().second == s + std::char_traits<char>::length(s));
|
||||
assert(m.length(0) == 0);
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == "");
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ int main()
|
||||
assert(std::regex_constants::nosubs != 0);
|
||||
assert(std::regex_constants::optimize != 0);
|
||||
assert(std::regex_constants::collate != 0);
|
||||
assert(std::regex_constants::ECMAScript != 0);
|
||||
assert(std::regex_constants::ECMAScript == 0);
|
||||
assert(std::regex_constants::basic != 0);
|
||||
assert(std::regex_constants::extended != 0);
|
||||
assert(std::regex_constants::awk != 0);
|
||||
|
||||
12
test/re/re.iter/nothing_to_do.pass.cpp
Normal file
12
test/re/re.iter/nothing_to_do.pass.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
// basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
|
||||
51
test/re/re.results/types.pass.cpp
Normal file
51
test/re/re.results/types.pass.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator,
|
||||
// class Allocator = allocator<sub_match<BidirectionalIterator>>>
|
||||
// class match_results
|
||||
// {
|
||||
// public:
|
||||
// typedef sub_match<BidirectionalIterator> value_type;
|
||||
// typedef const value_type& const_reference;
|
||||
// typedef const_reference reference;
|
||||
// typedef /implementation-defined/ const_iterator;
|
||||
// typedef const_iterator iterator;
|
||||
// typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
|
||||
// typedef typename allocator_traits<Allocator>::size_type size_type;
|
||||
// typedef Allocator allocator_type;
|
||||
// typedef typename iterator_traits<BidirectionalIterator>::value_type char_type;
|
||||
// typedef basic_string<char_type> string_type;
|
||||
|
||||
#include <regex>
|
||||
#include <type_traits>
|
||||
|
||||
template <class CharT>
|
||||
void
|
||||
test()
|
||||
{
|
||||
typedef std::match_results<CharT*> MR;
|
||||
static_assert((std::is_same<typename MR::value_type, std::sub_match<CharT*> >::value), "");
|
||||
static_assert((std::is_same<typename MR::const_reference, const std::sub_match<CharT*>& >::value), "");
|
||||
static_assert((std::is_same<typename MR::reference, const std::sub_match<CharT*>& >::value), "");
|
||||
static_assert((!std::is_same<typename MR::const_iterator, void>::value), "");
|
||||
static_assert((std::is_same<typename MR::difference_type, std::ptrdiff_t>::value), "");
|
||||
static_assert((std::is_same<typename MR::size_type, std::size_t>::value), "");
|
||||
static_assert((std::is_same<typename MR::allocator_type, std::allocator<std::sub_match<CharT*> > >::value), "");
|
||||
static_assert((std::is_same<typename MR::char_type, CharT>::value), "");
|
||||
static_assert((std::is_same<typename MR::string_type, std::basic_string<CharT> >::value), "");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test<char>();
|
||||
test<wchar_t>();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator> class sub_match;
|
||||
|
||||
// int compare(const string_type& s) const;
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef char CharT;
|
||||
typedef std::sub_match<const CharT*> SM;
|
||||
typedef SM::string_type string;
|
||||
SM sm = SM();
|
||||
SM sm2 = SM();
|
||||
assert(sm.compare(string()) == 0);
|
||||
const CharT s[] = {'1', '2', '3', 0};
|
||||
sm.first = s;
|
||||
sm.second = s + 3;
|
||||
sm.matched = true;
|
||||
assert(sm.compare(string()) > 0);
|
||||
assert(sm.compare(string("123")) == 0);
|
||||
}
|
||||
{
|
||||
typedef wchar_t CharT;
|
||||
typedef std::sub_match<const CharT*> SM;
|
||||
typedef SM::string_type string;
|
||||
SM sm = SM();
|
||||
SM sm2 = SM();
|
||||
assert(sm.compare(string()) == 0);
|
||||
const CharT s[] = {'1', '2', '3', 0};
|
||||
sm.first = s;
|
||||
sm.second = s + 3;
|
||||
sm.matched = true;
|
||||
assert(sm.compare(string()) > 0);
|
||||
assert(sm.compare(string(L"123")) == 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator> class sub_match;
|
||||
|
||||
// int compare(const sub_match& s) const;
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef char CharT;
|
||||
typedef std::sub_match<const CharT*> SM;
|
||||
SM sm = SM();
|
||||
SM sm2 = SM();
|
||||
assert(sm.compare(sm2) == 0);
|
||||
const CharT s[] = {'1', '2', '3', 0};
|
||||
sm.first = s;
|
||||
sm.second = s + 3;
|
||||
sm.matched = true;
|
||||
assert(sm.compare(sm2) > 0);
|
||||
sm2.first = s;
|
||||
sm2.second = s + 3;
|
||||
sm2.matched = true;
|
||||
assert(sm.compare(sm2) == 0);
|
||||
}
|
||||
{
|
||||
typedef wchar_t CharT;
|
||||
typedef std::sub_match<const CharT*> SM;
|
||||
SM sm = SM();
|
||||
SM sm2 = SM();
|
||||
assert(sm.compare(sm2) == 0);
|
||||
const CharT s[] = {'1', '2', '3', 0};
|
||||
sm.first = s;
|
||||
sm.second = s + 3;
|
||||
sm.matched = true;
|
||||
assert(sm.compare(sm2) > 0);
|
||||
sm2.first = s;
|
||||
sm2.second = s + 3;
|
||||
sm2.matched = true;
|
||||
assert(sm.compare(sm2) == 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator> class sub_match;
|
||||
|
||||
// int compare(const value_type* s) const;
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef char CharT;
|
||||
typedef std::sub_match<const CharT*> SM;
|
||||
SM sm = SM();
|
||||
SM sm2 = SM();
|
||||
assert(sm.compare("") == 0);
|
||||
const CharT s[] = {'1', '2', '3', 0};
|
||||
sm.first = s;
|
||||
sm.second = s + 3;
|
||||
sm.matched = true;
|
||||
assert(sm.compare("") > 0);
|
||||
assert(sm.compare("123") == 0);
|
||||
}
|
||||
{
|
||||
typedef wchar_t CharT;
|
||||
typedef std::sub_match<const CharT*> SM;
|
||||
SM sm = SM();
|
||||
SM sm2 = SM();
|
||||
assert(sm.compare(L"") == 0);
|
||||
const CharT s[] = {'1', '2', '3', 0};
|
||||
sm.first = s;
|
||||
sm.second = s + 3;
|
||||
sm.matched = true;
|
||||
assert(sm.compare(L"") > 0);
|
||||
assert(sm.compare(L"123") == 0);
|
||||
}
|
||||
}
|
||||
43
test/re/re.submatch/re.submatch.members/length.pass.cpp
Normal file
43
test/re/re.submatch/re.submatch.members/length.pass.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator> class sub_match;
|
||||
|
||||
// difference_type length() const;
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef char CharT;
|
||||
typedef std::sub_match<const CharT*> SM;
|
||||
SM sm = SM();
|
||||
assert(sm.length() == 0);
|
||||
const CharT s[] = {'1', '2', '3', 0};
|
||||
sm.first = s;
|
||||
sm.second = s + 3;
|
||||
sm.matched = true;
|
||||
assert(sm.length() == 3);
|
||||
}
|
||||
{
|
||||
typedef wchar_t CharT;
|
||||
typedef std::sub_match<const CharT*> SM;
|
||||
SM sm = SM();
|
||||
assert(sm.length() == 0);
|
||||
const CharT s[] = {'1', '2', '3', 0};
|
||||
sm.first = s;
|
||||
sm.second = s + 3;
|
||||
sm.matched = true;
|
||||
assert(sm.length() == 3);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator> class sub_match;
|
||||
|
||||
// operator string_type() const;
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef char CharT;
|
||||
typedef std::sub_match<const CharT*> SM;
|
||||
SM sm = SM();
|
||||
SM::string_type str = sm;
|
||||
assert(str.empty());
|
||||
const CharT s[] = {'1', '2', '3', 0};
|
||||
sm.first = s;
|
||||
sm.second = s + 3;
|
||||
sm.matched = true;
|
||||
str = sm;
|
||||
assert(str == std::string("123"));
|
||||
}
|
||||
{
|
||||
typedef wchar_t CharT;
|
||||
typedef std::sub_match<const CharT*> SM;
|
||||
SM sm = SM();
|
||||
SM::string_type str = sm;
|
||||
assert(str.empty());
|
||||
const CharT s[] = {'1', '2', '3', 0};
|
||||
sm.first = s;
|
||||
sm.second = s + 3;
|
||||
sm.matched = true;
|
||||
str = sm;
|
||||
assert(str == std::wstring(L"123"));
|
||||
}
|
||||
}
|
||||
47
test/re/re.submatch/re.submatch.members/str.pass.cpp
Normal file
47
test/re/re.submatch/re.submatch.members/str.pass.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator> class sub_match;
|
||||
|
||||
// string_type str() const;
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef char CharT;
|
||||
typedef std::sub_match<const CharT*> SM;
|
||||
SM sm = SM();
|
||||
SM::string_type str = sm.str();
|
||||
assert(str.empty());
|
||||
const CharT s[] = {'1', '2', '3', 0};
|
||||
sm.first = s;
|
||||
sm.second = s + 3;
|
||||
sm.matched = true;
|
||||
str = sm.str();
|
||||
assert(str == std::string("123"));
|
||||
}
|
||||
{
|
||||
typedef wchar_t CharT;
|
||||
typedef std::sub_match<const CharT*> SM;
|
||||
SM sm = SM();
|
||||
SM::string_type str = sm.str();
|
||||
assert(str.empty());
|
||||
const CharT s[] = {'1', '2', '3', 0};
|
||||
sm.first = s;
|
||||
sm.second = s + 3;
|
||||
sm.matched = true;
|
||||
str = sm.str();
|
||||
assert(str == std::wstring(L"123"));
|
||||
}
|
||||
}
|
||||
283
test/re/re.submatch/re.submatch.op/compare.pass.cpp
Normal file
283
test/re/re.submatch/re.submatch.op/compare.pass.cpp
Normal file
@@ -0,0 +1,283 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator> class sub_match;
|
||||
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator==(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator!=(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator<(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator<=(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator>=(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator>(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter, class ST, class SA>
|
||||
// bool
|
||||
// operator==(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter, class ST, class SA>
|
||||
// bool
|
||||
// operator!=(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter, class ST, class SA>
|
||||
// bool
|
||||
// operator<(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter, class ST, class SA>
|
||||
// bool
|
||||
// operator>(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter, class ST, class SA>
|
||||
// bool operator>=(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter, class ST, class SA>
|
||||
// bool
|
||||
// operator<=(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter, class ST, class SA>
|
||||
// bool
|
||||
// operator==(const sub_match<BiIter>& lhs,
|
||||
// const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
|
||||
//
|
||||
// template <class BiIter, class ST, class SA>
|
||||
// bool
|
||||
// operator!=(const sub_match<BiIter>& lhs,
|
||||
// const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
|
||||
//
|
||||
// template <class BiIter, class ST, class SA>
|
||||
// bool
|
||||
// operator<(const sub_match<BiIter>& lhs,
|
||||
// const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
|
||||
//
|
||||
// template <class BiIter, class ST, class SA>
|
||||
// bool operator>(const sub_match<BiIter>& lhs,
|
||||
// const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
|
||||
//
|
||||
// template <class BiIter, class ST, class SA>
|
||||
// bool
|
||||
// operator>=(const sub_match<BiIter>& lhs,
|
||||
// const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
|
||||
//
|
||||
// template <class BiIter, class ST, class SA>
|
||||
// bool
|
||||
// operator<=(const sub_match<BiIter>& lhs,
|
||||
// const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator==(typename iterator_traits<BiIter>::value_type const* lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator!=(typename iterator_traits<BiIter>::value_type const* lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator<(typename iterator_traits<BiIter>::value_type const* lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator>(typename iterator_traits<BiIter>::value_type const* lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator>=(typename iterator_traits<BiIter>::value_type const* lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator<=(typename iterator_traits<BiIter>::value_type const* lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator==(const sub_match<BiIter>& lhs,
|
||||
// typename iterator_traits<BiIter>::value_type const* rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator!=(const sub_match<BiIter>& lhs,
|
||||
// typename iterator_traits<BiIter>::value_type const* rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator<(const sub_match<BiIter>& lhs,
|
||||
// typename iterator_traits<BiIter>::value_type const* rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator>(const sub_match<BiIter>& lhs,
|
||||
// typename iterator_traits<BiIter>::value_type const* rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator>=(const sub_match<BiIter>& lhs,
|
||||
// typename iterator_traits<BiIter>::value_type const* rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator<=(const sub_match<BiIter>& lhs,
|
||||
// typename iterator_traits<BiIter>::value_type const* rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator==(typename iterator_traits<BiIter>::value_type const& lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator!=(typename iterator_traits<BiIter>::value_type const& lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator<(typename iterator_traits<BiIter>::value_type const& lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator>(typename iterator_traits<BiIter>::value_type const& lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator>=(typename iterator_traits<BiIter>::value_type const& lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator<=(typename iterator_traits<BiIter>::value_type const& lhs,
|
||||
// const sub_match<BiIter>& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator==(const sub_match<BiIter>& lhs,
|
||||
// typename iterator_traits<BiIter>::value_type const& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator!=(const sub_match<BiIter>& lhs,
|
||||
// typename iterator_traits<BiIter>::value_type const& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator<(const sub_match<BiIter>& lhs,
|
||||
// typename iterator_traits<BiIter>::value_type const& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator>(const sub_match<BiIter>& lhs,
|
||||
// typename iterator_traits<BiIter>::value_type const& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator>=(const sub_match<BiIter>& lhs,
|
||||
// typename iterator_traits<BiIter>::value_type const& rhs);
|
||||
//
|
||||
// template <class BiIter>
|
||||
// bool
|
||||
// operator<=(const sub_match<BiIter>& lhs,
|
||||
// typename iterator_traits<BiIter>::value_type const& rhs);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
template <class CharT>
|
||||
void
|
||||
test(const std::basic_string<CharT>& x, const std::basic_string<CharT>& y)
|
||||
{
|
||||
typedef std::basic_string<CharT> string;
|
||||
typedef std::sub_match<typename string::const_iterator> sub_match;
|
||||
sub_match sm1;
|
||||
sm1.first = x.begin();
|
||||
sm1.second = x.end();
|
||||
sm1.matched = true;
|
||||
sub_match sm2;
|
||||
sm2.first = y.begin();
|
||||
sm2.second = y.end();
|
||||
sm2.matched = true;
|
||||
assert((sm1 == sm2) == (x == y));
|
||||
assert((sm1 != sm2) == (x != y));
|
||||
assert((sm1 < sm2) == (x < y));
|
||||
assert((sm1 > sm2) == (x > y));
|
||||
assert((sm1 <= sm2) == (x <= y));
|
||||
assert((sm1 >= sm2) == (x >= y));
|
||||
assert((x == sm2) == (x == y));
|
||||
assert((x != sm2) == (x != y));
|
||||
assert((x < sm2) == (x < y));
|
||||
assert((x > sm2) == (x > y));
|
||||
assert((x <= sm2) == (x <= y));
|
||||
assert((x >= sm2) == (x >= y));
|
||||
assert((sm1 == y) == (x == y));
|
||||
assert((sm1 != y) == (x != y));
|
||||
assert((sm1 < y) == (x < y));
|
||||
assert((sm1 > y) == (x > y));
|
||||
assert((sm1 <= y) == (x <= y));
|
||||
assert((sm1 >= y) == (x >= y));
|
||||
assert((x.c_str() == sm2) == (x == y));
|
||||
assert((x.c_str() != sm2) == (x != y));
|
||||
assert((x.c_str() < sm2) == (x < y));
|
||||
assert((x.c_str() > sm2) == (x > y));
|
||||
assert((x.c_str() <= sm2) == (x <= y));
|
||||
assert((x.c_str() >= sm2) == (x >= y));
|
||||
assert((sm1 == y.c_str()) == (x == y));
|
||||
assert((sm1 != y.c_str()) == (x != y));
|
||||
assert((sm1 < y.c_str()) == (x < y));
|
||||
assert((sm1 > y.c_str()) == (x > y));
|
||||
assert((sm1 <= y.c_str()) == (x <= y));
|
||||
assert((sm1 >= y.c_str()) == (x >= y));
|
||||
assert((x[0] == sm2) == (string(1, x[0]) == y));
|
||||
assert((x[0] != sm2) == (string(1, x[0]) != y));
|
||||
assert((x[0] < sm2) == (string(1, x[0]) < y));
|
||||
assert((x[0] > sm2) == (string(1, x[0]) > y));
|
||||
assert((x[0] <= sm2) == (string(1, x[0]) <= y));
|
||||
assert((x[0] >= sm2) == (string(1, x[0]) >= y));
|
||||
assert((sm1 == y[0]) == (x == string(1, y[0])));
|
||||
assert((sm1 != y[0]) == (x != string(1, y[0])));
|
||||
assert((sm1 < y[0]) == (x < string(1, y[0])));
|
||||
assert((sm1 > y[0]) == (x > string(1, y[0])));
|
||||
assert((sm1 <= y[0]) == (x <= string(1, y[0])));
|
||||
assert((sm1 >= y[0]) == (x >= string(1, y[0])));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test(std::string("123"), std::string("123"));
|
||||
test(std::string("1234"), std::string("123"));
|
||||
test(std::wstring(L"123"), std::wstring(L"123"));
|
||||
test(std::wstring(L"1234"), std::wstring(L"123"));
|
||||
}
|
||||
42
test/re/re.submatch/re.submatch.op/stream.pass.cpp
Normal file
42
test/re/re.submatch/re.submatch.op/stream.pass.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator> class sub_match;
|
||||
|
||||
// template <class charT, class ST, class BiIter>
|
||||
// basic_ostream<charT, ST>&
|
||||
// operator<<(basic_ostream<charT, ST>& os, const sub_match<BiIter>& m);
|
||||
|
||||
#include <regex>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
template <class CharT>
|
||||
void
|
||||
test(const std::basic_string<CharT>& s)
|
||||
{
|
||||
typedef std::basic_string<CharT> string;
|
||||
typedef std::sub_match<typename string::const_iterator> SM;
|
||||
typedef std::basic_ostringstream<CharT> ostringstream;
|
||||
SM sm;
|
||||
sm.first = s.begin();
|
||||
sm.second = s.end();
|
||||
sm.matched = true;
|
||||
ostringstream os;
|
||||
os << sm;
|
||||
assert(os.str() == s);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test(std::string("123"));
|
||||
test(std::wstring(L"123"));
|
||||
}
|
||||
64
test/re/re.submatch/types.pass.cpp
Normal file
64
test/re/re.submatch/types.pass.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator>
|
||||
// class sub_match
|
||||
// : public pair<BidirectionalIterator, BidirectionalIterator>
|
||||
// {
|
||||
// public:
|
||||
// typedef BidirectionalIterator iterator;
|
||||
// typedef typename iterator_traits<iterator>::value_type value_type;
|
||||
// typedef typename iterator_traits<iterator>::difference_type difference_type;
|
||||
// typedef basic_string<value_type> string_type;
|
||||
//
|
||||
// bool matched;
|
||||
// ...
|
||||
// };
|
||||
|
||||
#include <regex>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::sub_match<char*> SM;
|
||||
static_assert((std::is_same<SM::iterator, char*>::value), "");
|
||||
static_assert((std::is_same<SM::value_type, char>::value), "");
|
||||
static_assert((std::is_same<SM::difference_type, std::ptrdiff_t>::value), "");
|
||||
static_assert((std::is_same<SM::string_type, std::string>::value), "");
|
||||
static_assert((std::is_convertible<SM*, std::pair<char*, char*>*>::value), "");
|
||||
|
||||
SM sm;
|
||||
sm.first = nullptr;
|
||||
sm.second = nullptr;
|
||||
sm.matched = false;
|
||||
}
|
||||
{
|
||||
typedef std::sub_match<wchar_t*> SM;
|
||||
static_assert((std::is_same<SM::iterator, wchar_t*>::value), "");
|
||||
static_assert((std::is_same<SM::value_type, wchar_t>::value), "");
|
||||
static_assert((std::is_same<SM::difference_type, std::ptrdiff_t>::value), "");
|
||||
static_assert((std::is_same<SM::string_type, std::wstring>::value), "");
|
||||
static_assert((std::is_convertible<SM*, std::pair<wchar_t*, wchar_t*>*>::value), "");
|
||||
|
||||
SM sm;
|
||||
sm.first = nullptr;
|
||||
sm.second = nullptr;
|
||||
sm.matched = false;
|
||||
}
|
||||
{
|
||||
static_assert((std::is_same<std::csub_match, std::sub_match<const char*> >::value), "");
|
||||
static_assert((std::is_same<std::wcsub_match, std::sub_match<const wchar_t*> >::value), "");
|
||||
static_assert((std::is_same<std::ssub_match, std::sub_match<std::string::const_iterator> >::value), "");
|
||||
static_assert((std::is_same<std::wssub_match, std::sub_match<std::wstring::const_iterator> >::value), "");
|
||||
}
|
||||
}
|
||||
@@ -34,17 +34,17 @@ int main()
|
||||
static_assert((std::is_same<decltype(std::strncmp(cpc, cpc, s)), int>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strcoll(cpc, cpc)), int>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strxfrm(cp, cpc, s)), std::size_t>::value), "");
|
||||
static_assert((std::is_same<decltype(std::memchr(vpc, 0, s)), const void*>::value), "");
|
||||
// static_assert((std::is_same<decltype(std::memchr(vpc, 0, s)), const void*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::memchr(vp, 0, s)), void*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strchr(cpc, 0)), const char*>::value), "");
|
||||
// static_assert((std::is_same<decltype(std::strchr(cpc, 0)), const char*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strchr(cp, 0)), char*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strcspn(cpc, cpc)), std::size_t>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strpbrk(cpc, cpc)), const char*>::value), "");
|
||||
// static_assert((std::is_same<decltype(std::strpbrk(cpc, cpc)), const char*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strpbrk(cp, cpc)), char*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strrchr(cpc, 0)), const char*>::value), "");
|
||||
// static_assert((std::is_same<decltype(std::strrchr(cpc, 0)), const char*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strrchr(cp, 0)), char*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strspn(cpc, cpc)), std::size_t>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strstr(cpc, cpc)), const char*>::value), "");
|
||||
// static_assert((std::is_same<decltype(std::strstr(cpc, cpc)), const char*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strstr(cp, cpc)), char*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::strtok(cp, cpc)), char*>::value), "");
|
||||
static_assert((std::is_same<decltype(std::memset(vp, 0, s)), void*>::value), "");
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user