public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeffrey Holle <jeff.holle@verizon.net>
To: gcc-help@gcc.gnu.org
Subject: question about std::distance
Date: Sun, 19 Sep 2004 23:22:00 -0000	[thread overview]
Message-ID: <cil4as$olr$1@sea.gmane.org> (raw)

I'm using gcc v3.4.2.

For the first time, I'm attempting to use std::distance and std::advance 
and am having trouble with at least std::distance.

Basically, I'm trying to deal with duplicates.
In the following code, I want to iterate thru just the non-duplicates.
In my test case, edges has a size of 47 and there are two sets of 4 
duplicates each.  So I want the for loop to execute 41 times.

typedef std::multiset<DataEdge,ltEdgeDescritor> Edges;
Edges edges;

<populate edges>

for(Edges::iterator iter=edges.begin();
                     iter!=edges.end(); 
advance(iter,distance(edges.lower_bound(*iter),edges.upper_bound(*iter)))
{
.....
}

What I find is that my program enters distance and doesn't leave.

Am I somehow misusing distance?

Can someone sugguest an alternate method for me to accomplish what I'm 
trying to do?

             reply	other threads:[~2004-09-19 23:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-19 23:22 Jeffrey Holle [this message]
2004-09-20  0:49 ` Jeffrey Holle
2004-09-20  5:11   ` Jeffrey Holle
2004-09-23  3:06     ` Jeffrey Holle

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='cil4as$olr$1@sea.gmane.org' \
    --to=jeff.holle@verizon.net \
    --cc=gcc-help@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).