// Components for manipulating non-owning sequences of characters -*- C++ -*-
+// Note: This file has been stolen from the gcc repo
+// (libstdc++-v3/include/experimental/bits/string_view.tcc) and has local
+// modifications.
+
// Copyright (C) 2013-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// N3762 basic_string_view library
//
-#ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC
-#define _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC 1
-
-#pragma GCC system_header
-
-#if __cplusplus >= 201402L
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#ifndef GDB_STRING_VIEW_TCC
+#define GDB_STRING_VIEW_TCC 1
-namespace experimental
-{
-inline namespace fundamentals_v1
+namespace gdb
{
template<typename _CharT, typename _Traits>
- constexpr typename basic_string_view<_CharT, _Traits>::size_type
+ /*constexpr*/ typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find(const _CharT* __str, size_type __pos, size_type __n) const noexcept
{
- __glibcxx_requires_string_len(__str, __n);
+ gdb_assert (__str != nullptr || __n == 0);
if (__n == 0)
return __pos <= this->_M_len ? __pos : npos;
}
template<typename _CharT, typename _Traits>
- constexpr typename basic_string_view<_CharT, _Traits>::size_type
+ /*constexpr*/ typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find(_CharT __c, size_type __pos) const noexcept
{
}
template<typename _CharT, typename _Traits>
- constexpr typename basic_string_view<_CharT, _Traits>::size_type
+ /*constexpr*/ typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept
{
- __glibcxx_requires_string_len(__str, __n);
+ gdb_assert (__str != nullptr || __n == 0);
if (__n <= this->_M_len)
{
}
template<typename _CharT, typename _Traits>
- constexpr typename basic_string_view<_CharT, _Traits>::size_type
+ /*constexpr*/ typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
rfind(_CharT __c, size_type __pos) const noexcept
{
}
template<typename _CharT, typename _Traits>
- constexpr typename basic_string_view<_CharT, _Traits>::size_type
+ /*constexpr*/ typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find_first_of(const _CharT* __str, size_type __pos, size_type __n) const
{
- __glibcxx_requires_string_len(__str, __n);
+ gdb_assert (__str != nullptr || __n == 0);
for (; __n && __pos < this->_M_len; ++__pos)
{
const _CharT* __p = traits_type::find(__str, __n,
}
template<typename _CharT, typename _Traits>
- constexpr typename basic_string_view<_CharT, _Traits>::size_type
+ /*constexpr*/ typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find_last_of(const _CharT* __str, size_type __pos, size_type __n) const
{
- __glibcxx_requires_string_len(__str, __n);
+ gdb_assert (__str != nullptr || __n == 0);
size_type __size = this->size();
if (__size && __n)
{
}
template<typename _CharT, typename _Traits>
- constexpr typename basic_string_view<_CharT, _Traits>::size_type
+ /*constexpr*/ typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find_first_not_of(const _CharT* __str, size_type __pos, size_type __n) const
{
- __glibcxx_requires_string_len(__str, __n);
+ gdb_assert (__str != nullptr || __n == 0);
for (; __pos < this->_M_len; ++__pos)
if (!traits_type::find(__str, __n, this->_M_str[__pos]))
return __pos;
}
template<typename _CharT, typename _Traits>
- constexpr typename basic_string_view<_CharT, _Traits>::size_type
+ /*constexpr*/ typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find_first_not_of(_CharT __c, size_type __pos) const noexcept
{
}
template<typename _CharT, typename _Traits>
- constexpr typename basic_string_view<_CharT, _Traits>::size_type
+ /*constexpr*/ typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find_last_not_of(const _CharT* __str, size_type __pos, size_type __n) const
{
- __glibcxx_requires_string_len(__str, __n);
+ gdb_assert (__str != nullptr || __n == 0);
size_type __size = this->_M_len;
if (__size)
{
}
template<typename _CharT, typename _Traits>
- constexpr typename basic_string_view<_CharT, _Traits>::size_type
+ /*constexpr*/ typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find_last_not_of(_CharT __c, size_type __pos) const noexcept
{
}
return npos;
}
-} // namespace fundamentals_v1
-} // namespace experimental
-
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace std
-
-#endif // __cplusplus <= 201103L
+} // namespace gdb
-#endif // _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC
+#endif // GDB_STRING_VIEW_TCC