⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _string.h

📁 A port of the original STL to many platforms.可以配合多种编译器使用,特别是在使用intel编译器时可以很好的优化代码性能.
💻 H
📖 第 1 页 / 共 3 页
字号:
    _Compare_Capacity(__old_capacity);
    return *this;
  }

  _Self& replace(iterator __f, iterator __l, const _Self& __s) {
    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
    size_type __old_capacity = capacity();
    _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s._M_non_dbg_impl);
    _Compare_Capacity(__old_capacity);
    return *this;
  }

  _Self& replace(iterator __f, iterator __l, const _CharT* __s, size_type __n) {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    size_type __old_capacity = capacity();
    _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s, __n);
    _Compare_Capacity(__old_capacity);
    return *this;
  }

  _Self& replace(iterator __f, iterator __l, const _CharT* __s) {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    size_type __old_capacity = capacity();
    _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s);
    _Compare_Capacity(__old_capacity);
    return *this;
  }

  _Self& replace(iterator __f, iterator __l, size_type __n, _CharT __c) {
    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
    size_type __old_capacity = capacity();
    _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __n, __c);
    _Compare_Capacity(__old_capacity);
    return *this;
  }

#if defined (_STLP_MEMBER_TEMPLATES)
private:
  template <class _RandomIter>
  void _M_replace_aux(iterator __first, iterator __last,
                      _RandomIter __f, _RandomIter __l, __true_type const& /*_IsIterator*/)
  { _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, __f._M_iterator, __l._M_iterator); }

  template <class _InputIter>
  void _M_replace_aux(iterator __first, iterator __last,
                      _InputIter __f, _InputIter __l, __false_type const& /*_IsIterator*/) {
    _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
                            _STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
  }

public:
  template <class _InputIter>
  _Self& replace(iterator __first, iterator __last,
                 _InputIter __f, _InputIter __l) {
    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))

    /* See insert comment for reson of iterator detection.
     */
    typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsNonConstIterator;
    typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
    typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _IsIterator;

    size_type __old_capacity = capacity();
    _M_replace_aux(__first, __last, __f, __l, _IsIterator());
    _Compare_Capacity(__old_capacity);
    return *this;
  }
#endif

#if !defined (_STLP_MEMBER_TEMPLATES) || \
    !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
  _Self& replace(iterator __first, iterator __last,
                 const_iterator __f, const_iterator __l) {
    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
    size_type __old_capacity = capacity();
    _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
                            __f._M_iterator, __l._M_iterator);
    _Compare_Capacity(__old_capacity);
    return *this;
  }

  _Self& replace(iterator __first, iterator __last,
                 const _CharT* __f, const _CharT* __l) {
    _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
    _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
    size_type __old_capacity = capacity();
    _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, __f, __l);
    _Compare_Capacity(__old_capacity);
    return *this;
  }
#endif

  // Other modifier member functions.
  void swap(_Self& __s) {
    _M_iter_list._Swap_owners(__s._M_iter_list);
    _M_non_dbg_impl.swap(__s._M_non_dbg_impl);
  }

  int compare(const _Self& __s) const
  { return _M_non_dbg_impl.compare(__s._M_non_dbg_impl); }
  int compare(size_type __pos, size_type __n, const _Self& __s) const
  { return _M_non_dbg_impl.compare(__pos, __n, __s._M_non_dbg_impl); }
  int compare(size_type __pos1, size_type __n1, const _Self& __s,
              size_type __pos2, size_type __n2) const
  { return _M_non_dbg_impl.compare(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2); }
  int compare(const _CharT* __s) const {
    _STLP_FIX_LITERAL_BUG(__s)
    return _M_non_dbg_impl.compare(__s);
  }
  int compare(size_type __pos, size_type __n, const _CharT* __s) const {
    _STLP_FIX_LITERAL_BUG(__s)
    return _M_non_dbg_impl.compare(__pos, __n, __s);
  }
  int compare(size_type __pos1, size_type __n1, const _CharT* __s,
              size_type __n2) const {
    _STLP_FIX_LITERAL_BUG(__s)
    return _M_non_dbg_impl.compare(__pos1, __n1, __s, __n2);
  }

  // Helper functions for compare.
  static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
                                   const _CharT* __f2, const _CharT* __l2)
  { return _Base::_M_compare(__f1, __l1, __f2, __l2); }
  static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1,
                                   const _CharT* __f2, const _CharT* __l2)
  { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2, __l2); }
  static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
                                   const_iterator __f2, const_iterator __l2)
  { return _Base::_M_compare(__f1, __l1, __f2._M_iterator, __l2._M_iterator); }
  static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1,
                                   const_iterator __f2, const_iterator __l2)
  { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2._M_iterator, __l2._M_iterator); }

  const _CharT* c_str() const { return _M_non_dbg_impl.c_str(); }
  const _CharT* data()  const { return _M_non_dbg_impl.data(); }

  size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
  { return _M_non_dbg_impl.copy(__s, __n, __pos); }

  // find.
  size_type find(const _Self& __s, size_type __pos = 0) const
  { return _M_non_dbg_impl.find(__s._M_non_dbg_impl, __pos); }
  size_type find(const _CharT* __s, size_type __pos = 0) const {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    return _M_non_dbg_impl.find(__s, __pos);
  }
  size_type find(const _CharT* __s, size_type __pos, size_type __n) const {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    return _M_non_dbg_impl.find(__s, __pos, __n);
  }
  // WIE: Versant schema compiler 5.2.2 ICE workaround
  size_type find(_CharT __c) const { return find(__c, 0); }
  size_type find(_CharT __c, size_type __pos /* = 0 */) const
  { return _M_non_dbg_impl.find(__c, __pos); }

  // rfind.
  size_type rfind(const _Self& __s, size_type __pos = npos) const
  { return _M_non_dbg_impl.rfind(__s._M_non_dbg_impl, __pos); }
  size_type rfind(const _CharT* __s, size_type __pos = npos) const {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    return _M_non_dbg_impl.rfind(__s, __pos);
  }
  size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    return _M_non_dbg_impl.rfind(__s, __pos, __n);
  }
  size_type rfind(_CharT __c, size_type __pos = npos) const
  { return _M_non_dbg_impl.rfind(__c, __pos); }

  // find_first_of
  size_type find_first_of(const _Self& __s, size_type __pos = 0) const
  { return _M_non_dbg_impl.find_first_of(__s._M_non_dbg_impl, __pos); }
  size_type find_first_of(const _CharT* __s, size_type __pos = 0) const {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    return _M_non_dbg_impl.find_first_of(__s, __pos);
  }
  size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    return _M_non_dbg_impl.find_first_of(__s, __pos, __n);
  }
  size_type find_first_of(_CharT __c, size_type __pos = 0) const
  { return _M_non_dbg_impl.find_first_of(__c, __pos); }

  // find_last_of
  size_type find_last_of(const _Self& __s, size_type __pos = npos) const
  { return _M_non_dbg_impl.find_last_of(__s._M_non_dbg_impl, __pos); }
  size_type find_last_of(const _CharT* __s, size_type __pos = npos) const {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    return _M_non_dbg_impl.find_last_of(__s, __pos);
  }
  size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    return _M_non_dbg_impl.find_last_of(__s, __pos, __n);
  }
  size_type find_last_of(_CharT __c, size_type __pos = npos) const
  { return _M_non_dbg_impl.rfind(__c, __pos); }

  // find_first_not_of
  size_type find_first_not_of(const _Self& __s, size_type __pos = 0) const
  { return _M_non_dbg_impl.find_first_not_of(__s._M_non_dbg_impl, __pos); }
  size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    return _M_non_dbg_impl.find_first_not_of(__s, __pos);
  }
  size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    return _M_non_dbg_impl.find_first_not_of(__s, __pos, __n);
  }
  size_type find_first_not_of(_CharT __c, size_type __pos = 0) const
  { return _M_non_dbg_impl.find_first_not_of(__c, __pos); }

  // find_last_not_of
  size_type find_last_not_of(const _Self& __s, size_type __pos = npos) const
  { return _M_non_dbg_impl.find_last_not_of(__s._M_non_dbg_impl, __pos); }
  size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    return _M_non_dbg_impl.find_last_not_of(__s, __pos);
  }
  size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const {
    _STLP_FIX_LITERAL_BUG(__s)
    _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
    return _M_non_dbg_impl.find_last_not_of(__s, __pos, __n);
  }
  size_type find_last_not_of(_CharT __c, size_type __pos = npos) const
  { return _M_non_dbg_impl.find_last_not_of(__c, __pos); }

#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
#  include <stl/debug/_string_sum_methods.h>
#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
};

// This is a hook to instantiate STLport exports in a designated DLL
#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
_STLP_MOVE_TO_PRIV_NAMESPACE
_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME <char, char_traits<char>, allocator<char> > >;
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_EXPORT_TEMPLATE_CLASS basic_string<char, char_traits<char>, allocator<char> >;
#  if defined (_STLP_HAS_WCHAR_T)
_STLP_MOVE_TO_PRIV_NAMESPACE
_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME <wchar_t, char_traits<wchar_t>, allocator<wchar_t> > >;
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_EXPORT_TEMPLATE_CLASS basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
#  endif
#endif /* _STLP_USE_TEMPLATE_EXPORT */

#undef _STLP_NON_DBG_STRING
#undef _STLP_NON_DBG_STRING_NAME

#if !defined (_STLP_STATIC_CONST_INIT_BUG)
#  if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
template <class _CharT, class _Traits, class _Alloc>
const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0;
#  else
template <class _CharT, class _Traits, class _Alloc>
const size_t basic_string<_CharT, _Traits, _Alloc>::npos;
#  endif
#endif

#if defined (basic_string)
_STLP_MOVE_TO_STD_NAMESPACE
#undef basic_string
#endif

_STLP_END_NAMESPACE

#endif /* _STLP_DBG_STRING */

// Local Variables:
// mode:C++
// End:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -