summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/debug/bitset
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-23 18:14:24 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-23 18:14:24 +0000
commitc3d5e955b3b3175deef8c213c12b50d859280b7c (patch)
tree83a429a496255d0aafa7fadcc8baf90768f93d21 /libstdc++-v3/include/debug/bitset
parentfaca49c2c8cfd949fb3d3143bc02fa18ba3111e8 (diff)
downloadppe42-gcc-c3d5e955b3b3175deef8c213c12b50d859280b7c.tar.gz
ppe42-gcc-c3d5e955b3b3175deef8c213c12b50d859280b7c.zip
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
Implement DR 396 [Ready]. * include/std/bitset (bitset<>::bitset(const std::basic_string<>&, size_t, size_t, _CharT, _CharT), bitset<>::bitset(const char*, char, char), bitset<>::to_string(_CharT, _CharT), bitset<>::_M_copy_from_string(const std::basic_string<>&, size_t, size_t, _CharT, _CharT), bitset<>::_M_copy_to_string (std::basic_string<>&, _CharT, _CharT), bitset<>::_M_copy_from_ptr( const _CharT*, size_t, size_t, size_t, _CharT, _CharT)): Add. (operator>>(std::basic_istream<>&, bitset<_Nb>&), operator<<( std::basic_ostream<>&, const bitset<_Nb>&)): Adjust. * include/debug/bitset (bitset<>::bitset(const std::basic_string<>&, size_t, size_t, _CharT, _CharT), bitset<>::bitset(const char*, char, char), bitset<>::to_string(_CharT, _CharT)): Add. * doc/xml/manual/intro.xml: Add an entry for DR 396. * testsuite/23_containers/bitset/cons/dr396.cc: Add. * testsuite/23_containers/bitset/to_string/dr396.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140607 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/debug/bitset')
-rw-r--r--libstdc++-v3/include/debug/bitset76
1 files changed, 61 insertions, 15 deletions
diff --git a/libstdc++-v3/include/debug/bitset b/libstdc++-v3/include/debug/bitset
index 75474c806b5..28e0282e992 100644
--- a/libstdc++-v3/include/debug/bitset
+++ b/libstdc++-v3/include/debug/bitset
@@ -1,6 +1,7 @@
// Debugging bitset implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
+// 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
@@ -125,20 +126,31 @@ namespace __debug
bitset(unsigned long __val) : _Base(__val) { }
- template<typename _CharT, typename _Traits, typename _Allocator>
+ template<typename _CharT, typename _Traits, typename _Alloc>
explicit
- bitset(const std::basic_string<_CharT,_Traits,_Allocator>& __str,
- typename std::basic_string<_CharT,_Traits,_Allocator>::size_type
+ bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str,
+ typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
__pos = 0,
- typename std::basic_string<_CharT,_Traits,_Allocator>::size_type
- __n = (std::basic_string<_CharT,_Traits,_Allocator>::npos))
+ typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
+ __n = (std::basic_string<_CharT, _Traits, _Alloc>::npos))
: _Base(__str, __pos, __n) { }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 396. what are characters zero and one.
+ template<class _CharT, class _Traits, class _Alloc>
+ bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str,
+ typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
+ __pos,
+ typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
+ __n,
+ _CharT __zero, _CharT __one = _CharT('1'))
+ : _Base(__str, __pos, __n, __zero, __one) { }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 778. std::bitset does not have any constructor taking a string literal
explicit
- bitset(const char* __s)
- : _Base(__s) { }
+ bitset(const char* __s, char __zero = '0', char __one = '1')
+ : _Base(__s, __zero, __one) { }
bitset(const _Base& __x) : _Base(__x), _Safe_base() { }
@@ -245,10 +257,20 @@ namespace __debug
using _Base::to_ulong;
- template <typename _CharT, typename _Traits, typename _Allocator>
- std::basic_string<_CharT, _Traits, _Allocator>
+ template <typename _CharT, typename _Traits, typename _Alloc>
+ std::basic_string<_CharT, _Traits, _Alloc>
to_string() const
- { return _M_base().template to_string<_CharT, _Traits, _Allocator>(); }
+ { return _M_base().template to_string<_CharT, _Traits, _Alloc>(); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 396. what are characters zero and one.
+ template<class _CharT, class _Traits, class _Alloc>
+ std::basic_string<_CharT, _Traits, _Alloc>
+ to_string(_CharT __zero, _CharT __one = _CharT('1')) const
+ {
+ return _M_base().template
+ to_string<_CharT, _Traits, _Alloc>(__zero, __one);
+ }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 434. bitset::to_string() hard to use.
@@ -257,6 +279,14 @@ namespace __debug
to_string() const
{ return to_string<_CharT, _Traits, std::allocator<_CharT> >(); }
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 396. what are characters zero and one.
+ template<class _CharT, class _Traits>
+ std::basic_string<_CharT, _Traits, std::allocator<_CharT> >
+ to_string(_CharT __zero, _CharT __one = _CharT('1')) const
+ { return to_string<_CharT, _Traits,
+ std::allocator<_CharT> >(__zero, __one); }
+
template<typename _CharT>
std::basic_string<_CharT, std::char_traits<_CharT>,
std::allocator<_CharT> >
@@ -266,11 +296,27 @@ namespace __debug
std::allocator<_CharT> >();
}
+ template<class _CharT>
+ std::basic_string<_CharT, std::char_traits<_CharT>,
+ std::allocator<_CharT> >
+ to_string(_CharT __zero, _CharT __one = _CharT('1')) const
+ {
+ return to_string<_CharT, std::char_traits<_CharT>,
+ std::allocator<_CharT> >(__zero, __one);
+ }
+
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
- to_string() const
- {
- return to_string<char,std::char_traits<char>,std::allocator<char> >();
- }
+ to_string() const
+ {
+ return to_string<char,std::char_traits<char>,std::allocator<char> >();
+ }
+
+ std::basic_string<char, std::char_traits<char>, std::allocator<char> >
+ to_string(char __zero, char __one = '1') const
+ {
+ return to_string<char, std::char_traits<char>,
+ std::allocator<char> >(__zero, __one);
+ }
using _Base::count;
using _Base::size;
OpenPOWER on IntegriCloud