[cfe-commits] [libcxx] r134327 - in /libcxx/trunk/include: __bit_reference bitset vector

Howard Hinnant hhinnant at apple.com
Sat Jul 2 13:33:23 PDT 2011


Author: hhinnant
Date: Sat Jul  2 15:33:23 2011
New Revision: 134327

URL: http://llvm.org/viewvc/llvm-project?rev=134327&view=rev
Log:
http://llvm.org/bugs/show_bug.cgi?id=10248

Modified:
    libcxx/trunk/include/__bit_reference
    libcxx/trunk/include/bitset
    libcxx/trunk/include/vector

Modified: libcxx/trunk/include/__bit_reference
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__bit_reference?rev=134327&r1=134326&r2=134327&view=diff
==============================================================================
--- libcxx/trunk/include/__bit_reference (original)
+++ libcxx/trunk/include/__bit_reference Sat Jul  2 15:33:23 2011
@@ -21,7 +21,13 @@
 template <class _C, bool _IsConst> class __bit_iterator;
 template <class _C> class __bit_const_reference;
 
-template <class _C>
+template <class _Tp>
+struct __has_storage_type
+{
+    static const bool value = false;
+};
+
+template <class _C, bool = __has_storage_type<_C>::value>
 class __bit_reference
 {
     typedef typename _C::__storage_type    __storage_type;
@@ -66,6 +72,11 @@
         : __seg_(__s), __mask_(__m) {}
 };
 
+template <class _C>
+class __bit_reference<_C, false>
+{
+};
+
 template <class _C, class _D>
 _LIBCPP_INLINE_VISIBILITY inline
 void

Modified: libcxx/trunk/include/bitset
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/bitset?rev=134327&r1=134326&r2=134327&view=diff
==============================================================================
--- libcxx/trunk/include/bitset (original)
+++ libcxx/trunk/include/bitset Sat Jul  2 15:33:23 2011
@@ -130,6 +130,15 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <size_t _N_words, size_t _Size>
+class __bitset;
+
+template <size_t _N_words, size_t _Size>
+struct __has_storage_type<__bitset<_N_words, _Size> >
+{
+    static const bool value = true;
+};
+
+template <size_t _N_words, size_t _Size>
 class __bitset
 {
 public:

Modified: libcxx/trunk/include/vector
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=134327&r1=134326&r2=134327&view=diff
==============================================================================
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Sat Jul  2 15:33:23 2011
@@ -1749,6 +1749,12 @@
 template <class _Allocator> struct hash<vector<bool, _Allocator> >;
 
 template <class _Allocator>
+struct __has_storage_type<vector<bool, _Allocator> >
+{
+    static const bool value = true;
+};
+
+template <class _Allocator>
 class _LIBCPP_VISIBLE vector<bool, _Allocator>
     : private __vector_base_common<true>
 {
@@ -1757,8 +1763,6 @@
     typedef bool                                     value_type;
     typedef _Allocator                               allocator_type;
     typedef allocator_traits<allocator_type>         __alloc_traits;
-    typedef __bit_reference<vector>                  reference;
-    typedef __bit_const_reference<vector>            const_reference;
     typedef typename __alloc_traits::size_type       size_type;
     typedef typename __alloc_traits::difference_type difference_type;
     typedef __bit_iterator<vector, false>            pointer;
@@ -1798,6 +1802,9 @@
     size_type                                              __size_;
     __compressed_pair<size_type, __storage_allocator> __cap_alloc_;
 
+    typedef __bit_reference<vector>                  reference;
+    typedef __bit_const_reference<vector>            const_reference;
+
     _LIBCPP_INLINE_VISIBILITY
     size_type& __cap() _NOEXCEPT
         {return __cap_alloc_.first();}





More information about the cfe-commits mailing list