This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[Patch (Newb)]:libstdc++v3/tr1/array: Fix cast in array::end const so that it matches the return type of const_interator.
- From: Sashan Govender <sashang at gmail dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Sat, 16 Oct 2004 13:47:08 +1300
- Subject: [Patch (Newb)]:libstdc++v3/tr1/array: Fix cast in array::end const so that it matches the return type of const_interator.
- Domainkey-signature: a=rsa-sha1; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; b=RRqORpfB5QFXd1mIRBNJAKPy7UK6uBjfkSUD98jDdpKU4GTEzygX0xKrejV2gxX5wDJMsXgKIDv/TlCxEa6PW9y9TOMWyXqnROs/lb8Y6vYKv9LP7e4xkAGU0V1oCjrJgjZguTqkSd5y9BaNooEVOscIIoAmaYZXCnL9me6Mdfk
- Reply-to: Sashan Govender <sashang at gmail dot com>
Problem is that the reinterpret_cast performed by member function
array::end const is a cast to an iterator type. The return type of
array::end const is of type const_interator. The patch fixes this so
that the cast and the return type match.
Note that I have filed a form with the FSF for the GCC project. I
apologize in advance for any oversights in the patch submission.
Index: array
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/include/tr1/array,v
retrieving revision 1.1
diff -c -3 -p -r1.1 array
*** array 7 Oct 2004 22:06:22 -0000 1.1
--- array 16 Oct 2004 00:22:53 -0000
*************** namespace tr1
*** 82,88 ****
const_iterator
end() const
! { return reinterpret_cast<iterator>(&_M_instance[_S_index - 1]); }
reverse_iterator
rbegin()
--- 82,88 ----
const_iterator
end() const
! { return reinterpret_cast<const_iterator>(&_M_instance[_S_index - 1]); }
reverse_iterator
rbegin()
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/ChangeLog,v
retrieving revision 1.2702
diff -c -3 -p -r1.2702 ChangeLog
*** ChangeLog 13 Oct 2004 08:58:37 -0000 1.2702
--- ChangeLog 16 Oct 2004 00:32:50 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2004-10-16 Sashan Govender <sashang@gmail.com>
+ * include/tr1/array (array::end const): Fix casting from iterator to
+ const_iterator.
+
2004-10-13 Paolo Carlini <pcarlini@suse.de>
* include/bits/basic_string.tcc (_S_create): Use consistently