Article View: borland.public.cppbuilder.nativeapi
Article #1513Re: PHANDLE, HANDLE comparisions and vectors
From: Remy Lebeau (TeamB)
Date: Mon, 23 Jul 2007 22:55
Date: Mon, 23 Jul 2007 22:55
32 lines
1848 bytes
1848 bytes
"Mike Collins" <its@TheBottomOfThePost> wrote in message
news:46a52487$1@newsgroups.borland.com...
> vecFileWatch.push_back(SectionHandle); //Always seems to assign 1
into
> the vector...
I'm surprised that compiles at all, considering that push_back() would be
expecting a HANDLE instead of a PHANDLE. You probably do not have STRICT
defined.
PHANDLE is a pointer to a HANDLE, so to push it into your vector properly,
you need to deference the pointer to get the actual HANDLE value:
vecFileWatch.push_back(*SectionHandle);
> while loop used to ensure that we can exit as
> soon as a value is found.
You should use the STL's find() function instead of looping manually:
#include <algorithm>
if( std::find(vecFileWatch.begin(), vecFileWatch.end(), SectionHandle)
!= vecFileWatch.end() )
// SectionHandle was found ...
else
// SectionHandle not found ...
Gambit
Technical Details
Message-ID:
<46a5320b$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<46a52487$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,30800f5259a52803 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <46a52487$1@newsgroups.borland.com> Subject: Re: PHANDLE, HANDLE comparisions and vectors Date: Mon, 23 Jul 2007 15:55:26 -0700 Lines: 34 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 75.82.252.126 Message-ID: <46a5320b$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1185231371 75.82.252.126 (23 Jul 2007 15:56:11 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail