public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Sylvain.Pion@mpi-sb.mpg.de
To: gcc-gnats@gcc.gnu.org
Cc: Sylvain.Pion@mpi-sb.mpg.de
Subject: libstdc++/10783: std::vector::reverse_iterator  could be smaller
Date: Wed, 14 May 2003 15:46:00 -0000	[thread overview]
Message-ID: <20030514153840.30740.qmail@sources.redhat.com> (raw)


>Number:         10783
>Category:       libstdc++
>Synopsis:       std::vector::reverse_iterator  could be smaller
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Wed May 14 15:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Sylvain Pion
>Release:        3.2, 3.3, 3.4 (2.95 doesn't have the problem, I don't have 3.[01])
>Organization:
>Environment:
Reading specs from ./GCC/Linux-3.2/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.2.3/specs
Configured with: ../gcc-3.2/configure --prefix=/home/spion/GCC/Linux-3.2 --enable-languages=c++
Thread model: posix
gcc version 3.2.3
>Description:
On my 32bit machine,
sizeof(std::vector<>::reverse_iterator) is 8.
Similarly for std::vector<>::const_reverse_iterator.

All other iterators from the STL containers (except deque)
have sizeof 4.

I believe it could be made also 4 bytes if the empty base class optimization applied, but it seems it doesn't.
Is it because there are 2 derivations from the same iterator<...> class ?  Is there a way to fix it ?
>How-To-Repeat:
#include <iostream>
#include <vector>
int main() {
  typedef std::vector<int> V;
  std::cout << "sizeof(iterator) = " << sizeof(V::iterator) << std::endl;
  std::cout << "sizeof(reverse_iterator) = " << sizeof(V::reverse_iterator) << std::endl;
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-05-14 15:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-14 15:46 Sylvain.Pion [this message]
2003-05-18 18:48 paolo
2003-05-18 19:36 Paolo Carlini
2003-05-18 22:46 Nathan Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030514153840.30740.qmail@sources.redhat.com \
    --to=sylvain.pion@mpi-sb.mpg.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).