write back
  #   %ˆl–Ü4ý(”†»â‚À¹q§Å£Ð„e×_wÀÍ ?÷     %// Debugging string implementation -*- C++ -*-

// Copyright (C) 2003-2021 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file debug/string
 *  This file is a GNU debug extension to the Standard C++ Library.
 */

#ifndef _GLIBCXX_DEBUG_STRING
#define _GLIBCXX_DEBUG_STRING 1

#pragma GCC system_header

#include <string>
#include <debug/safe_sequence.h>
#include <debug/safe_container.h>
#include <debug/safe_iterator.h>

#define _GLIBCXX_DEBUG_VERIFY_STR_COND_AT(_Cond,_File,_Line,_Func)	\
  if (! (_Cond))							\
    __gnu_debug::_Error_formatter::_S_at(_File, _Line, _Func)		\
      ._M_message(#_Cond)._M_error()

#if _GLIBCXX_USE_CXX11_ABI && __cplusplus >= 201103
# define _GLIBCXX_INSERT_RETURNS_ITERATOR 1
# define _GLIBCXX_INSERT_RETURNS_ITERATOR_ONLY(expr) expr
#else
# define _GLIBCXX_INSERT_RETURNS_ITERATOR 0
# define _GLIBCXX_INSERT_RETURNS_ITERATOR_ONLY(expr)
#endif

namespace __gnu_debug
{
  /** Checks that __s is non-NULL or __n == 0, and then returns __s. */
  template<typename _CharT, typename _Integer>
    inline const _CharT*
    __check_string(const _CharT* __s,
		   _Integer __n __attribute__((__unused__)),
		   const char* __file __attribute__((__unused__)),
		   unsigned int __line __attribute__((__unused__)),
		   const char* __function __attribute__((__unused__)))
    {
#ifdef _GLIBCXX_DEBUG_PEDANTIC
      _GLIBCXX_DEBUG_VERIFY_STR_COND_AT(__s != 0 || __n == 0,
					__file, __line, __function);
#endif
      return __s;
    }

  /** Checks that __s is non-NULL and then returns __s. */
  template<typename _CharT>
    inline const _CharT*
    __check_string(const _CharT* __s,
		   const char* __file __attribute__((__unused__)),
		   unsigned int __line __attribute__((__unused__)),
		   const char* __function __attribute__((__unused__)))
    {
#ifdef _GLIBCXX_DEBUG_PEDANTIC
      _GLIBCXX_DEBUG_VERIFY_STR_COND_AT(__s != 0,
					__file, __line, __function);
#endif
      return __s;
    }

#define __glibcxx_check_string_n_constructor(_Str, _Size) \
  __check_string(_Str, _Size, __FILE__, __LINE__, __PRETTY_FUNCTION__)

#define __glibcxx_check_string_constructor(_Str) \
  __check_string(_Str, __FILE__, __LINE__, __PRETTY_FUNCTION__)

  /// Class std::basic_string with safety/checking/debug instrumentation.
  template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
	   typename _Allocator = std::allocator<_CharT> >
    class basic_string
      : public __gnu_debug::_Safe_container<
	  basic_string<_CharT, _Traits, _Allocator>,
	  _Allocator, _Safe_sequence, bool(_GLIBCXX_USE_CXX11_ABI)>,
	public std::basic_string<_CharT, _Traits, _Allocator>
    {
      typedef std::basic_string<_CharT, _Traits, _Allocator>	_Base;
      typedef __gnu_debug::_Safe_container<
	basic_string, _Allocator, _Safe_sequence, bool(_GLIBCXX_USE_CXX11_ABI)>
      _Safe;

      template<typename _ItT, typename _SeqT, typename _CatT>
	friend class ::__gnu_debug::_Safe_iterator;

      // type used for positions in insert, erase etc.
      typedef __gnu_debug::_Safe_iterator<
	typename _Base::__const_iterator, basic