Re: Binary predicate for std::list::unique() in VC++ 6?

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Craig Kelly (cnkelly.nospam_at_nospam.net)
Date: 01/25/05


Date: Tue, 25 Jan 2005 21:01:14 GMT


"Tom Widmer" wrote:

<snipping my inane previous post>

> I'm afraid that's not going to work - not_equal_to<T>::operator() is not a
> virtual function!

<snip>

> In the above, paths_eq() gets sliced into a not_equal_to object, and
> not_equal_to still ends up being called.

You know, I wouldn't feel so stupid if I had just gotten confused about C++
inheritance and conversion mechanisms... but somehow in my late-night
posting brain I decided that binary_function defined operator() as virtual
and that VC6's list::unique defined as unique(no_equal_to<T>&). Which is
really stupid considering the fact that I actually posted the correct
signature!

Thank you for correcting me.

> The other is to modify the list header to make unique a template member,
> since that does just about work with VC6

I didn't know this! I vastly prefer VC 7.x but I'll keep that in mind for
the future... Thanks again for stopping my (well-intended) campaign of
ignorance :)

Craig