// Profiling bitset implementation -*- C++ -*-
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 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
#include <bitset>
-namespace std
+namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
/// Class std::bitset wrapper with performance instrumentation.
template<size_t _Nb>
class bitset
- : public _GLIBCXX_STD_D::bitset<_Nb>
+ : public _GLIBCXX_STD_C::bitset<_Nb>
{
- typedef _GLIBCXX_STD_D::bitset<_Nb> _Base;
+ typedef _GLIBCXX_STD_C::bitset<_Nb> _Base;
public:
// bit reference:
};
// 23.3.5.1 constructors:
- bitset() : _Base() { }
+ _GLIBCXX_CONSTEXPR bitset() : _Base() { }
- bitset(unsigned long __val) : _Base(__val) { }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ constexpr bitset(unsigned long long __val)
+#else
+ bitset(unsigned long __val)
+#endif
+ : _Base(__val) { }
template<typename _CharT, typename _Traits, typename _Alloc>
explicit
bitset(const _Base& __x) : _Base(__x) { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- explicit
- bitset(const char* __str) : _Base(__str) { }
+ template<typename _CharT>
+ explicit
+ bitset(const _CharT* __str,
+ typename std::basic_string<_CharT>::size_type __n
+ = std::basic_string<_CharT>::npos,
+ _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'))
+ : _Base(__str, __n, __zero, __one) { }
#endif
// 23.3.5.2 bitset operations:
const bitset<_Nb>& __x)
{ return __os << __x._M_base(); }
} // namespace __profile
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // DR 1182.
+ /// std::hash specialization for bitset.
+ template<size_t _Nb>
+ struct hash<__profile::bitset<_Nb>>
+ : public __hash_base<size_t, __profile::bitset<_Nb>>
+ {
+ size_t
+ operator()(const __profile::bitset<_Nb>& __b) const
+ { return std::hash<_GLIBCXX_STD_C::bitset<_Nb>>()(__b._M_base()); }
+ };
+#endif
+
} // namespace std
#endif