16 #ifndef RWrap_libcpp_string_view_h 17 #define RWrap_libcpp_string_view_h 45 #define _ROOT_LIBCPP_BEGIN_NAMESPACE_LFTS \ 47 namespace experimental { inline namespace __ROOT { 48 #define _ROOT_LIBCPP_END_NAMESPACE_LFTS } } } 52 #define _ROOT_LIBCPP_BEGIN_NAMESPACE_LFTS \ 54 namespace experimental { namespace __ROOT { 55 #define _ROOT_LIBCPP_END_NAMESPACE_LFTS } using namespace __ROOT; } } 60 #ifndef _LIBCPP_BEGIN_NAMESPACE_STD 61 #define _LOCAL_LIBCPP_BEGIN_NAMESPACE_STD 62 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { 63 #define _LIBCPP_END_NAMESPACE_STD } 66 #ifndef _LIBCPP_CONSTEXPR 67 #define _LOCAL_LIBCPP_CONSTEXPR 68 #define _LIBCPP_CONSTEXPR constexpr 76 #ifndef _LIBCPP_INLINE_VISIBILITY 77 #define _LOCAL_LIBCPP_INLINE_VISIBILITY 78 #define _LIBCPP_INLINE_VISIBILITY inline 81 #ifndef _LIBCPP_EXPLICIT 82 #define _LOCAL_LIBCPP_EXPLICIT 83 #define _LIBCPP_EXPLICIT explicit 91 #ifdef _LIBCPP_STD_VER 92 #define _LOCAL_LIBCPP_STD_VER 93 #define _LIBCPP_STD_VER 11 96 #ifndef _LIBCPP_TYPE_VIS_ONLY 97 #define _LOCAL_LIBCPP_TYPE_VIS_ONLY 98 #define _LIBCPP_TYPE_VIS_ONLY 101 #ifndef _LIBCPP_CONSTEXPR_AFTER_CXX11 102 #define _LOCAL_LIBCPP_CONSTEXPR_AFTER_CXX11 103 #define _LIBCPP_CONSTEXPR_AFTER_CXX11 107 #define _LOCAL_NOEXCEPT 111 #ifndef _LIBCPP_ASSERT 112 #define _LOCAL_LIBCPP_ASSERT 113 #define _LIBCPP_ASSERT(X,Y) ((void)0) 123 inline namespace __ROOT {
126 inline namespace __1 {
137 template <
class _CharT,
class _OutputIterator>
140 const _CharT* __ob,
const _CharT* __op,
const _CharT* __oe,
141 ios_base& __iob, _CharT __fl)
143 streamsize __sz = __oe - __ob;
144 streamsize __ns = __iob.width();
149 for (;__ob < __op; ++__ob, ++__s)
151 for (; __ns; --__ns, ++__s)
153 for (; __ob < __oe; ++__ob, ++__s)
159 template<
class _CharT,
class _Traits>
160 basic_ostream<_CharT, _Traits>&
162 const _CharT* __str,
size_t __len)
168 #endif // _LIBCPP_NO_EXCEPTIONS 169 typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
172 typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
175 (__os.flags() & ios_base::adjustfield) == ios_base::left ?
180 __os.fill()).failed())
181 __os.setstate(ios_base::badbit | ios_base::failbit);
188 __os.__set_badbit_and_consider_rethrow();
190 #endif // _LIBCPP_NO_EXCEPTIONS 197 template <
class _BinaryPredicate,
class _ForwardIterator1,
class _ForwardIterator2>
199 __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
200 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred,
201 forward_iterator_tag, forward_iterator_tag)
203 if (__first2 == __last2)
210 if (__first1 == __last1)
212 if (__pred(*__first1, *__first2))
217 _ForwardIterator1 __m1 = __first1;
218 _ForwardIterator2 __m2 = __first2;
221 if (++__m2 == __last2)
223 if (++__m1 == __last1)
225 if (!__pred(*__m1, *__m2))
234 template <
class _BinaryPredicate,
class _RandomAccessIterator1,
class _RandomAccessIterator2>
236 __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
237 _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred,
238 random_access_iterator_tag, random_access_iterator_tag)
240 typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type _D1;
241 typedef typename std::iterator_traits<_RandomAccessIterator2>::difference_type _D2;
243 _D2 __len2 = __last2 - __first2;
246 _D1 __len1 = __last1 - __first1;
249 const _RandomAccessIterator1 __s = __last1 - (__len2 - 1);
252 #if !_LIBCPP_UNROLL_LOOPS 257 if (__pred(*__first1, *__first2))
261 #else // !_LIBCPP_UNROLL_LOOPS 262 for (_D1 __loop_unroll = (__s - __first1) / 4; __loop_unroll > 0; --__loop_unroll)
264 if (__pred(*__first1, *__first2))
266 if (__pred(*++__first1, *__first2))
268 if (__pred(*++__first1, *__first2))
270 if (__pred(*++__first1, *__first2))
274 switch (__s - __first1)
277 if (__pred(*__first1, *__first2))
281 if (__pred(*__first1, *__first2))
285 if (__pred(*__first1, *__first2))
291 #endif // !_LIBCPP_UNROLL_LOOPS 292 _RandomAccessIterator1 __m1 = __first1;
293 _RandomAccessIterator2 __m2 = __first2;
294 #if !_LIBCPP_UNROLL_LOOPS 297 if (++__m2 == __last2)
300 if (!__pred(*__m1, *__m2))
306 #else // !_LIBCPP_UNROLL_LOOPS 309 for (_D2 __loop_unroll = (__last2 - __m2) / 4; __loop_unroll > 0; --__loop_unroll)
311 if (!__pred(*__m1, *__m2))
313 if (!__pred(*++__m1, *++__m2))
315 if (!__pred(*++__m1, *++__m2))
317 if (!__pred(*++__m1, *++__m2))
322 switch (__last2 - __m2)
325 if (!__pred(*__m1, *__m2))
330 if (!__pred(*__m1, *__m2))
335 if (!__pred(*__m1, *__m2))
342 #endif // !_LIBCPP_UNROLL_LOOPS 346 #endif // _LOCAL_VSTD for __search 348 template <
class _ForwardIterator1,
class _ForwardIterator2,
class _BinaryPredicate>
351 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
353 for (; __first1 != __last1; ++__first1)
354 for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j)
355 if (__pred(*__first1, *__j))
361 template<
class _CharT,
class _SizeT,
class _Traits, _SizeT __npos>
368 const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c);
371 return static_cast<_SizeT
>(__r - __p);
374 template<
class _CharT,
class _SizeT,
class _Traits, _SizeT __npos>
377 const _CharT* __s, _SizeT __pos, _SizeT __n)
379 if (__pos > __sz || __sz - __pos < __n)
385 __s, __s + __n, _Traits::eq,
386 random_access_iterator_tag(), random_access_iterator_tag());
387 if (__r == __p + __sz)
389 return static_cast<_SizeT
>(__r - __p);
395 template<
class _CharT,
class _SizeT,
class _Traits, _SizeT __npos>
398 _CharT __c, _SizeT __pos)
406 for (
const _CharT* __ps = __p + __pos; __ps != __p;)
408 if (_Traits::eq(*--__ps, __c))
409 return static_cast<_SizeT
>(__ps - __p);
414 template<
class _CharT,
class _SizeT,
class _Traits, _SizeT __npos>
417 const _CharT* __s, _SizeT __pos, _SizeT __n)
419 __pos = _VSTD::min(__pos, __sz);
420 if (__n < __sz - __pos)
424 const _CharT* __r = _VSTD::__find_end(
425 __p, __p + __pos, __s, __s + __n, _Traits::eq,
426 random_access_iterator_tag(), random_access_iterator_tag());
427 if (__n > 0 && __r == __p + __pos)
429 return static_cast<_SizeT
>(__r - __p);
433 template<
class _CharT,
class _SizeT,
class _Traits, _SizeT __npos>
436 const _CharT* __s, _SizeT __pos, _SizeT __n)
438 if (__pos >= __sz || __n == 0)
441 (__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq );
442 if (__r == __p + __sz)
444 return static_cast<_SizeT
>(__r - __p);
449 template<
class _CharT,
class _SizeT,
class _Traits, _SizeT __npos>
452 const _CharT* __s, _SizeT __pos, _SizeT __n)
460 for (
const _CharT* __ps = __p + __pos; __ps != __p;)
462 const _CharT* __r = _Traits::find(__s, __n, *--__ps);
464 return static_cast<_SizeT
>(__ps - __p);
472 template<
class _CharT,
class _SizeT,
class _Traits, _SizeT __npos>
475 const _CharT* __s, _SizeT __pos, _SizeT __n)
479 const _CharT* __pe = __p + __sz;
480 for (
const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
481 if (_Traits::find(__s, __n, *__ps) == 0)
482 return static_cast<_SizeT
>(__ps - __p);
488 template<
class _CharT,
class _SizeT,
class _Traits, _SizeT __npos>
491 _CharT __c, _SizeT __pos)
495 const _CharT* __pe = __p + __sz;
496 for (
const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
497 if (!_Traits::eq(*__ps, __c))
498 return static_cast<_SizeT
>(__ps - __p);
505 template<
class _CharT,
class _SizeT,
class _Traits, _SizeT __npos>
508 const _CharT* __s, _SizeT __pos, _SizeT __n)
514 for (
const _CharT* __ps = __p + __pos; __ps != __p;)
515 if (_Traits::find(__s, __n, *--__ps) == 0)
516 return static_cast<_SizeT
>(__ps - __p);
521 template<
class _CharT,
class _SizeT,
class _Traits, _SizeT __npos>
524 _CharT __c, _SizeT __pos)
530 for (
const _CharT* __ps = __p + __pos; __ps != __p;)
531 if (!_Traits::eq(*--__ps, __c))
532 return static_cast<_SizeT
>(__ps - __p);
545 #ifdef _LOCAL_LIBCPP_BEGIN_NAMESPACE_LFTS 546 #undef _LIBCPP_BEGIN_NAMESPACE_LFTS 547 #undef _LIBCPP_END_NAMESPACE_LFTS 550 #ifdef _LOCAL_LIBCPP_BEGIN_NAMESPACE_STD 551 #undef _LIBCPP_BEGIN_NAMESPACE_STD 552 #undef _LIBCPP_END_NAMESPACE_STD 555 #ifdef _LOCAL_LIBCPP_CONSTEXPR 556 #undef _LIBCPP_CONSTEXPR 563 #ifdef _LOCAL_LIBCPP_INLINE_VISIBILITY 564 #undef _LIBCPP_INLINE_VISIBILITY 567 #ifdef _LOCAL_LIBCPP_STD_VER 568 #undef _LIBCPP_STD_VER 571 #ifdef _LOCAL_LIBCPP_TYPE_VIS_ONLY 572 #undef _LIBCPP_TYPE_VIS_ONLY 575 #ifdef _LOCAL_LIBCPP_CONSTEXPR_AFTER_CXX11 576 #undef _LIBCPP_CONSTEXPR_AFTER_CXX11 579 #ifdef _LOCAL_NOEXCEPT 583 #ifdef _LOCAL_LIBCPP_ASSERT 584 #undef _LIBCPP_ASSERT 587 #endif // RWrap_libcpp_string_view_h _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY __str_find_first_not_of(const _CharT *__p, _SizeT __sz, const _CharT *__s, _SizeT __pos, _SizeT __n)
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY __str_rfind(const _CharT *__p, _SizeT __sz, _CharT __c, _SizeT __pos)
_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator1 __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag, random_access_iterator_tag)
_OutputIterator __pad_and_output(_OutputIterator __s, const _CharT *__ob, const _CharT *__op, const _CharT *__oe, ios_base &__iob, _CharT __fl)
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY __str_find_first_of(const _CharT *__p, _SizeT __sz, const _CharT *__s, _SizeT __pos, _SizeT __n)
#define _LIBCPP_INLINE_VISIBILITY
_ForwardIterator1 __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred, forward_iterator_tag, forward_iterator_tag)
_LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator1 __find_first_of_ce(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY __str_find_last_of(const _CharT *__p, _SizeT __sz, const _CharT *__s, _SizeT __pos, _SizeT __n)
basic_ostream< _CharT, _Traits > & R__put_character_sequence(basic_ostream< _CharT, _Traits > &__os, const _CharT *__str, size_t __len)
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY __str_find(const _CharT *__p, _SizeT __sz, _CharT __c, _SizeT __pos) _NOEXCEPT
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY __str_find_last_not_of(const _CharT *__p, _SizeT __sz, const _CharT *__s, _SizeT __pos, _SizeT __n)