Click here to Skip to main content
15,904,348 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: How to handle strings in ATL. Pin
ThatsAlok5-Mar-08 4:55
ThatsAlok5-Mar-08 4:55 
GeneralWTL::CHyperLink and WM_CTLCOLORSTATIC Pin
siavan26-Feb-08 2:06
siavan26-Feb-08 2:06 
QuestionHow to implement IEnumString in ATL 3.0 Pin
MANISH RASTOGI25-Feb-08 1:16
MANISH RASTOGI25-Feb-08 1:16 
AnswerRe: How to implement IEnumString in ATL 3.0 Pin
Ernest Laurentin5-Mar-08 4:33
Ernest Laurentin5-Mar-08 4:33 
GeneralRe: How to implement IEnumString in ATL 3.0 Pin
MANISH RASTOGI7-Mar-08 17:50
MANISH RASTOGI7-Mar-08 17:50 
GeneralRe: How to implement IEnumString in ATL 3.0 Pin
Ernest Laurentin10-Mar-08 4:41
Ernest Laurentin10-Mar-08 4:41 
GeneralUsing find_if STL function [modified] Pin
ComplexLifeForm23-Feb-08 10:18
ComplexLifeForm23-Feb-08 10:18 
GeneralRe: Using find_if STL function Pin
Stuart Dootson24-Feb-08 20:57
professionalStuart Dootson24-Feb-08 20:57 
 First thing - what compiler are you using? If it's VC++ 6, then....upgrade if at all possible! I've just compiled your code with VC++2005 and it seems fine, aside from a) needing const qualification on NewPriceGrabber's operator(), b) this line
double newprice = find_if( OldNewPriceTable.begin(), OldNewPriceTable.end(),
                            bind2nd(NewPriceGrabber<NewPriceLookup, double, bool>(), oldprice));
which returns a vector iterator, not a double:

std::vector<NewPriceLookup>::const_iterator it = std::find_if( OldNewPriceTable.begin(), OldNewPriceTable.end(),
                                                               bind2nd(NewPriceGrabber<NewPriceLookup, double, bool>(), oldprice));
and c) I presume the '&npLookup(5)' is a typo, 'should be '&npLookup[5]'.

My other advice would be to use Boost.Bind[^] or Boost.Lambda[^] for function binders - I find them a lot less confusing. Your example would translate to:

bool NewPriceGrabber(NewPriceLookup const& arg1, double price)
{
   return (arg1.m_oldprice == price);
}

void x()
{
double oldprice = 15.0;
std::vector<NewPriceLookup>::const_iterator it = std::find_if( OldNewPriceTable.begin(), OldNewPriceTable.end(),
                                                               boost::bind(NewPriceGrabber, _1, oldprice)); 
}
Two advantages - 1) no function object needed, 2) the bind function takes a function reference/pointer (NewPriceGrabber here) as well as 1 value for each parameter of the function. You use placeholder arguments (that's the _1) where you don't want to bind a parameter to a value.



GeneralRe: Using find_if STL function Pin
Stuart Dootson24-Feb-08 21:10
professionalStuart Dootson24-Feb-08 21:10 
GeneralRe: Using find_if STL function Pin
ComplexLifeForm25-Feb-08 0:57
ComplexLifeForm25-Feb-08 0:57 
GeneralRe: Using find_if STL function Pin
Stuart Dootson25-Feb-08 3:02
professionalStuart Dootson25-Feb-08 3:02 
GeneralRe: Using find_if STL function Pin
ComplexLifeForm25-Feb-08 18:22
ComplexLifeForm25-Feb-08 18:22 
GeneralRe: Using find_if STL function Pin
Johann Gerell14-May-08 21:54
Johann Gerell14-May-08 21:54 
GeneralATL and javascript Pin
whizdom16-Feb-08 21:35
whizdom16-Feb-08 21:35 
GeneralRe: ATL and javascript Pin
Nathan Holt at EMOM18-Feb-08 11:48
Nathan Holt at EMOM18-Feb-08 11:48 
GeneralRe: ATL and javascript Pin
whizdom22-Feb-08 7:43
whizdom22-Feb-08 7:43 
QuestionPlease enlighten me on STL iterators and CriticalSection locking Pin
Kosta Cherry13-Feb-08 21:15
Kosta Cherry13-Feb-08 21:15 
GeneralRe: Please enlighten me on STL iterators and CriticalSection locking Pin
Andy Moore14-Feb-08 6:11
Andy Moore14-Feb-08 6:11 
GeneralRe: Please enlighten me on STL iterators and CriticalSection locking Pin
Kosta Cherry14-Feb-08 11:49
Kosta Cherry14-Feb-08 11:49 
GeneralUsing an activex control in an ATL project Pin
zon_cpp11-Feb-08 20:33
zon_cpp11-Feb-08 20:33 
GeneralRe: Using an activex control in an ATL project Pin
Stuart Dootson11-Feb-08 23:38
professionalStuart Dootson11-Feb-08 23:38 
GeneralATL: IDispEvent*Impl for n instances [modified] Pin
wickdom8-Feb-08 3:59
wickdom8-Feb-08 3:59 
GeneralRe: ATL: IDispEvent*Impl for n instances Pin
Stuart Dootson8-Feb-08 8:52
professionalStuart Dootson8-Feb-08 8:52 
GeneralRe: ATL: IDispEvent*Impl for n instances Pin
wickdom8-Feb-08 12:03
wickdom8-Feb-08 12:03 
Generalefficiency copy vector into a second vector Pin
manustone4-Feb-08 2:20
manustone4-Feb-08 2:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.