This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/43813] [DR1234] vector<T*>(3, NULL) fails to compile


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43813

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com,
                   |                            |jwakely.gcc at gmail dot
                   |                            |com

--- Comment #13 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-03-04 11:32:02 UTC ---
Thus, since we do have indeed sfinae-friendly iterator-traits, I mean to
consistently deply something like the below in all the relevant places. Even
better ideas? Speak now or remain silent forever ;)

Index: include/bits/stl_deque.h
===================================================================
--- include/bits/stl_deque.h    (revision 184879)
+++ include/bits/stl_deque.h    (working copy)
@@ -888,6 +888,20 @@
        *  input iterators are used, then this will do at most 2N calls to the
        *  copy constructor, and logN memory reallocations.
        */
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _InputIterator, typename = typename
+              enable_if<is_convertible<typename
+                        iterator_traits<_InputIterator>::iterator_category,
+                        input_iterator_tag>::value>::type>
+        deque(_InputIterator __first, _InputIterator __last,
+             const allocator_type& __a = allocator_type())
+       : _Base(__a)
+        {
+         typedef typename iterator_traits<_InputIterator>::
+           iterator_category _IterCategory;
+         _M_range_initialize(__first, __last, _IterCategory());
+       }
+#else
       template<typename _InputIterator>
         deque(_InputIterator __first, _InputIterator __last,
              const allocator_type& __a = allocator_type())
@@ -897,6 +911,7 @@
          typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_initialize_dispatch(__first, __last, _Integral());
        }
+#endif

       /**
        *  The dtor only erases the elements, and note that if the elements


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]