Re: find() w/ a user defined functor
From: sklett (asasd_at_asdfasdfsd.com)
Date: 01/10/05
- Next message: red floyd: "Re: find() w/ a user defined functor"
- Previous message: Stephen Howe: "Re: find() w/ a user defined functor"
- In reply to: Stephen Howe: "Re: find() w/ a user defined functor"
- Next in thread: red floyd: "Re: find() w/ a user defined functor"
- Reply: red floyd: "Re: find() w/ a user defined functor"
- Reply: Stephen Howe: "Re: find() w/ a user defined functor"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 10 Jan 2005 14:26:48 -0800
ah, of course. Predicates..
I am now trying to use sort with a vector and getting a rather confusing
error. I have added operator < and > to my type, from what I can tell that
is all it needs. I'm getting the error:
error C2784: 'reverse_iterator<_RanIt>::difference_type
std::operator -(const std::reverse_iterator<_RanIt> &,const
std::reverse_iterator<_RanIt> &)' : could not deduce template argument for
'const std::reverse_iterator<_RanIt> &' from 'std::list<_Ty>::iterator'
with
[
_Ty=BeatGroupData
]
my comparison operators:
inline bool operator>(const int& right){ return (this->BeatID > right); };
inline bool operator<(const int& right){ return (this->BeatID < right); };
I have read some threads on google, but I don't see any dealing with
vectors, just list which has a member sort....
"Stephen Howe" <stephenPOINThoweATtns-globalPOINTcom> wrote in message
news:u9s6Kk19EHA.2608@TK2MSFTNGP10.phx.gbl...
> > I might want to use find() to match the id property of MyStruct and
later
> I
> > might want to use prefix. Do I need to overload the operator== or is
> there
> > a differe, STL-ish way?
>
> Use find_if() and give different predicates depending on whether you want
to
> match on prefix or id. I tend not to overload == if the object has no
> implicitly natural equality.
>
> Stephen Howe
>
>
>
- Next message: red floyd: "Re: find() w/ a user defined functor"
- Previous message: Stephen Howe: "Re: find() w/ a user defined functor"
- In reply to: Stephen Howe: "Re: find() w/ a user defined functor"
- Next in thread: red floyd: "Re: find() w/ a user defined functor"
- Reply: red floyd: "Re: find() w/ a user defined functor"
- Reply: Stephen Howe: "Re: find() w/ a user defined functor"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|