aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/ext/rc_string_base.h
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2005-12-11 00:41:29 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2005-12-11 00:41:29 +0000
commitb6105bf2c397ba0aba21454a17e013974e0fe657 (patch)
tree6f2dff5fbecaa3fc1d3a8fbc15ad8d28758c8d84 /libstdc++-v3/include/ext/rc_string_base.h
parent42e25796b5a0f59d44e06c4e0a8e1c203b953fbc (diff)
downloadgcc-b6105bf2c397ba0aba21454a17e013974e0fe657.zip
gcc-b6105bf2c397ba0aba21454a17e013974e0fe657.tar.gz
gcc-b6105bf2c397ba0aba21454a17e013974e0fe657.tar.bz2
sso_string_base.h (__sso_string_base<>::_M_compare): Add...
2005-12-10 Paolo Carlini <pcarlini@suse.de> * include/ext/sso_string_base.h (__sso_string_base<>::_M_compare): Add, specialized for char and wchar_t to immediately return true when a string is compared to itself. * include/ext/rc_string_base.h (__rc_string_base<>::_M_compare): Likewise, for the same _Rep. * include/ext/vstring.h (compare(const string&)): Use it. * include/ext/sso_string_base.h (__sso_string_base<>::_M_destroy): Deallocate passed size + 1. (_M_dispose, _M_reserve): Adjust. From-SVN: r108372
Diffstat (limited to 'libstdc++-v3/include/ext/rc_string_base.h')
-rw-r--r--libstdc++-v3/include/ext/rc_string_base.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/libstdc++-v3/include/ext/rc_string_base.h b/libstdc++-v3/include/ext/rc_string_base.h
index 9636a81..43a69c2 100644
--- a/libstdc++-v3/include/ext/rc_string_base.h
+++ b/libstdc++-v3/include/ext/rc_string_base.h
@@ -334,6 +334,10 @@ namespace __gnu_cxx
void
_M_erase(size_type __pos, size_type __n);
+
+ bool
+ _M_compare(const __rc_string_base&) const
+ { return false; }
};
template<typename _CharT, typename _Traits, typename _Alloc>
@@ -670,6 +674,28 @@ namespace __gnu_cxx
_M_rep()->_M_set_length(__new_size);
}
+
+ template<>
+ inline bool
+ __rc_string_base<char, std::char_traits<char>,
+ std::allocator<char> >::
+ _M_compare(const __rc_string_base& __rcs) const
+ {
+ if (_M_rep() == __rcs._M_rep())
+ return true;
+ return false;
+ }
+
+ template<>
+ inline bool
+ __rc_string_base<wchar_t, std::char_traits<wchar_t>,
+ std::allocator<wchar_t> >::
+ _M_compare(const __rc_string_base& __rcs) const
+ {
+ if (_M_rep() == __rcs._M_rep())
+ return true;
+ return false;
+ }
} // namespace __gnu_cxx
#endif /* _RC_STRING_BASE_H */