xref: /dflybsd-src/contrib/gcc-8.0/libstdc++-v3/include/experimental/string (revision 95059079af47f9a66a175f374f2da1a5020e3255)
138fd1498Szrj// <experimental/string> -*- C++ -*-
238fd1498Szrj
338fd1498Szrj// Copyright (C) 2015-2018 Free Software Foundation, Inc.
438fd1498Szrj//
538fd1498Szrj// This file is part of the GNU ISO C++ Library.  This library is free
638fd1498Szrj// software; you can redistribute it and/or modify it under the
738fd1498Szrj// terms of the GNU General Public License as published by the
838fd1498Szrj// Free Software Foundation; either version 3, or (at your option)
938fd1498Szrj// any later version.
1038fd1498Szrj
1138fd1498Szrj// This library is distributed in the hope that it will be useful,
1238fd1498Szrj// but WITHOUT ANY WARRANTY; without even the implied warranty of
1338fd1498Szrj// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1438fd1498Szrj// GNU General Public License for more details.
1538fd1498Szrj
1638fd1498Szrj// Under Section 7 of GPL version 3, you are granted additional
1738fd1498Szrj// permissions described in the GCC Runtime Library Exception, version
1838fd1498Szrj// 3.1, as published by the Free Software Foundation.
1938fd1498Szrj
2038fd1498Szrj// You should have received a copy of the GNU General Public License and
2138fd1498Szrj// a copy of the GCC Runtime Library Exception along with this program;
2238fd1498Szrj// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
2338fd1498Szrj// <http://www.gnu.org/licenses/>.
2438fd1498Szrj
2538fd1498Szrj/** @file experimental/string
2638fd1498Szrj *  This is a TS C++ Library header.
2738fd1498Szrj */
2838fd1498Szrj
2938fd1498Szrj#ifndef _GLIBCXX_EXPERIMENTAL_STRING
3038fd1498Szrj#define _GLIBCXX_EXPERIMENTAL_STRING 1
3138fd1498Szrj
3238fd1498Szrj#pragma GCC system_header
3338fd1498Szrj
3438fd1498Szrj#if __cplusplus >= 201402L
3538fd1498Szrj
3638fd1498Szrj#include <string>
3738fd1498Szrj#include <algorithm>
3838fd1498Szrj#include <experimental/memory_resource>
3938fd1498Szrj
4038fd1498Szrjnamespace std _GLIBCXX_VISIBILITY(default)
4138fd1498Szrj{
4238fd1498Szrj_GLIBCXX_BEGIN_NAMESPACE_VERSION
4338fd1498Szrj
4438fd1498Szrjnamespace experimental
4538fd1498Szrj{
4638fd1498Szrjinline namespace fundamentals_v2
4738fd1498Szrj{
4838fd1498Szrj  template<typename _CharT, typename _Traits, typename _Alloc,
4938fd1498Szrj	   typename _Predicate>
5038fd1498Szrj    inline void
5138fd1498Szrj    erase_if(basic_string<_CharT, _Traits, _Alloc>& __cont, _Predicate __pred)
5238fd1498Szrj    {
5338fd1498Szrj      __cont.erase(std::remove_if(__cont.begin(), __cont.end(), __pred),
5438fd1498Szrj		   __cont.end());
5538fd1498Szrj    }
5638fd1498Szrj
5738fd1498Szrj  template<typename _CharT, typename _Traits, typename _Alloc, typename _Up>
5838fd1498Szrj    inline void
5938fd1498Szrj    erase(basic_string<_CharT, _Traits, _Alloc>& __cont, const _Up& __value)
6038fd1498Szrj    {
6138fd1498Szrj      __cont.erase(std::remove(__cont.begin(), __cont.end(), __value),
6238fd1498Szrj		   __cont.end());
6338fd1498Szrj    }
6438fd1498Szrj
65*58e805e6Szrj#if _GLIBCXX_USE_CXX11_ABI
66*58e805e6Szrj  namespace pmr
67*58e805e6Szrj  {
6838fd1498Szrj    // basic_string using polymorphic allocator in namespace pmr
6938fd1498Szrj    template<typename _CharT, typename _Traits = char_traits<_CharT>>
7038fd1498Szrj      using basic_string =
7138fd1498Szrj	std::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>;
7238fd1498Szrj
7338fd1498Szrj    // basic_string typedef names using polymorphic allocator in namespace
7438fd1498Szrj    // std::experimental::pmr
7538fd1498Szrj    typedef basic_string<char> string;
7638fd1498Szrj    typedef basic_string<char16_t> u16string;
7738fd1498Szrj    typedef basic_string<char32_t> u32string;
7838fd1498Szrj    typedef basic_string<wchar_t> wstring;
7938fd1498Szrj
8038fd1498Szrj  } // namespace pmr
81*58e805e6Szrj#endif
8238fd1498Szrj} // namespace fundamentals_v2
8338fd1498Szrj} // namespace experimental
8438fd1498Szrj
8538fd1498Szrj_GLIBCXX_END_NAMESPACE_VERSION
8638fd1498Szrj} // namespace std
8738fd1498Szrj
8838fd1498Szrj#endif // C++14
8938fd1498Szrj
9038fd1498Szrj#endif // _GLIBCXX_EXPERIMENTAL_STRING
91