incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov (JIRA)" <j...@apache.org>
Subject [jira] Updated: (STDCXX-611) vector container does not work with types that implement unary operator&
Date Tue, 23 Oct 2007 17:41:51 GMT

     [ https://issues.apache.org/jira/browse/STDCXX-611?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Farid Zaripov updated STDCXX-611:
---------------------------------

     Patch Info: [Patch Available]
    Environment: All

The proposed patch:

----------------------------
Index: vector.cc
===================================================================
--- vector.cc	(revision 587486)
+++ vector.cc	(working copy)
@@ -268,6 +268,8 @@
 
     _RWSTD_ASSERT (_C_make_iter (__movbeg) == __it);
 
+    _C_value_alloc_type __alloc = _RWSTD_VALUE_ALLOC_CAST (*this);
+
     if (__movend <= _C_end) {
 
         // the end of the range of existing elements after being
@@ -281,7 +283,7 @@
 
         // construct copies of elements that will be moved beyond
         // the current end of the sequence controlled by *this
-        _STD::uninitialized_copy (__ucpbeg, _C_end, _C_end);
+        _STD::uninitialized_copy (__ucpbeg, _C_end, _C_end, __alloc);
 
         // advance end to maintain consistent state
         _C_end += __n;
@@ -298,7 +300,7 @@
         const size_type __n1 = size () - __size1;
         const size_type __n2 = __n - __n1;
 
-        _STD::uninitialized_fill_n (_C_end, __n2, __x);
+        _STD::uninitialized_fill_n (_C_end, __n2, __x, __alloc);
 
         const pointer __end = _C_end;
 
@@ -306,7 +308,7 @@
 
         // construct copies of the range of elements [pos, end)
         // past the end of the range of elements inserted above
-        _STD::uninitialized_copy (__movbeg, __end, _C_end);
+        _STD::uninitialized_copy (__movbeg, __end, _C_end, __alloc);
 
         _C_end += __end - __movbeg;
 
----------------------------


> vector container does not work with types that implement unary operator&
> ------------------------------------------------------------------------
>
>                 Key: STDCXX-611
>                 URL: https://issues.apache.org/jira/browse/STDCXX-611
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 23. Containers
>    Affects Versions: 4.2
>         Environment: All
>            Reporter: Travis Vitek
>            Assignee: Farid Zaripov
>             Fix For: 4.2.1
>
>
> This could result in failure to compile or unexpected runtime behavior. Discussion on
this issue can be found here http://tinyurl.com/2t7vjp
> #include <vector>      // for vector
> struct S
> {
>    void operator& () const {};
> };
> int main ()
> {
>    const S s [3];
>    // this is just a compile test, it is not intended to run
>    std::vector<S> v;
>    v.assign (1, s [0]);
>    v.assign (s, s+3);
>    v.at (0);
>    v.back ();
>    v.begin ();
>    v.capacity ();
>    v.empty ();
>    v.end ();
>    v.front ();
>    v.insert (v.begin (), s [0]);
>    v.insert (v.begin (), s, s+3);
>    v.insert (v.begin (), 2, s [0]);
>    v.erase (v.begin ());
>    v.erase (v.begin (), v.end ());
>    v.max_size ();
>    v.pop_back ();
>    v.push_back (s[0]);
>    v.rbegin ();
>    v.rend ();
>    v.reserve (10);
>    v.resize (10);
>    v.size ();
>    std::vector<S>().swap (v);
>    return 0;
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message