From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Remove non-standard public members in std::bitset
Date: Fri, 30 Sep 2022 21:57:08 +0100 [thread overview]
Message-ID: <20220930205708.170313-1-jwakely@redhat.com> (raw)
Tested x86_64-linux. Pushed to trunk.
-- >8 --
This makes _M_copy_from_ptr, _M_copy_from_string and _M_copy_to_string
private, and declares operator<< and operator>> as friends.
Also remove the historical _M_copy_from_string and _M_copy_to_string
overloads. Those were used before DR 396 was implemented but are
not needed now. There are no tests or docs describing them, so I don't
think we intend to support them as extensions.
libstdc++-v3/ChangeLog:
* include/std/bitset (_M_copy_from_ptr, _M_copy_from_string)
(_M_copy_to_string): Change access to private.
(_M_copy_from_string(const basic_string&, size_t, size_t)):
Remove.
(_M_copy_to_string(const basic_string&)): Remove.
---
libstdc++-v3/include/std/bitset | 69 ++++++++++++++++-----------------
1 file changed, 33 insertions(+), 36 deletions(-)
diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index 3fe8b18735c..757da020ffe 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -1321,42 +1321,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
return to_string<char, std::char_traits<char>,
std::allocator<char> >(__zero, __one);
}
-
- // Helper functions for string operations.
- template<class _CharT, class _Traits>
- _GLIBCXX23_CONSTEXPR
- void
- _M_copy_from_ptr(const _CharT*, size_t, size_t, size_t,
- _CharT, _CharT);
-
- template<class _CharT, class _Traits, class _Alloc>
- _GLIBCXX23_CONSTEXPR
- void
- _M_copy_from_string(const std::basic_string<_CharT,
- _Traits, _Alloc>& __s, size_t __pos, size_t __n,
- _CharT __zero, _CharT __one)
- { _M_copy_from_ptr<_CharT, _Traits>(__s.data(), __s.size(), __pos, __n,
- __zero, __one); }
-
- template<class _CharT, class _Traits, class _Alloc>
- _GLIBCXX23_CONSTEXPR
- void
- _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>&,
- _CharT, _CharT) const;
-
- // NB: Backward compat.
- template<class _CharT, class _Traits, class _Alloc>
- _GLIBCXX23_CONSTEXPR
- void
- _M_copy_from_string(const std::basic_string<_CharT,
- _Traits, _Alloc>& __s, size_t __pos, size_t __n)
- { _M_copy_from_string(__s, __pos, __n, _CharT('0'), _CharT('1')); }
-
- template<class _CharT, class _Traits, class _Alloc>
- _GLIBCXX23_CONSTEXPR
- void
- _M_copy_to_string(std::basic_string<_CharT, _Traits,_Alloc>& __s) const
- { _M_copy_to_string(__s, _CharT('0'), _CharT('1')); }
#endif // HOSTED
/// Returns the number of bits which are set.
@@ -1463,6 +1427,39 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
size_t
_Find_next(size_t __prev) const _GLIBCXX_NOEXCEPT
{ return this->_M_do_find_next(__prev, _Nb); }
+
+ private:
+ // Helper functions for string operations.
+ template<class _CharT, class _Traits>
+ _GLIBCXX23_CONSTEXPR
+ void
+ _M_copy_from_ptr(const _CharT*, size_t, size_t, size_t,
+ _CharT, _CharT);
+
+#if _GLIBCXX_HOSTED
+ template<class _CharT, class _Traits, class _Alloc>
+ _GLIBCXX23_CONSTEXPR
+ void
+ _M_copy_from_string(const std::basic_string<_CharT,
+ _Traits, _Alloc>& __s, size_t __pos, size_t __n,
+ _CharT __zero, _CharT __one)
+ { _M_copy_from_ptr<_CharT, _Traits>(__s.data(), __s.size(), __pos, __n,
+ __zero, __one); }
+
+ template<class _CharT, class _Traits, class _Alloc>
+ _GLIBCXX23_CONSTEXPR
+ void
+ _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>&,
+ _CharT, _CharT) const;
+
+ template<class _CharT, class _Traits, size_t _Nb2>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>&, bitset<_Nb2>&);
+
+ template <class _CharT, class _Traits, size_t _Nb2>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>&, const bitset<_Nb2>&);
+#endif
};
#if _GLIBCXX_HOSTED
--
2.37.3
reply other threads:[~2022-09-30 20:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220930205708.170313-1-jwakely@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).