|
-
June 1st, 1999, 11:32 AM
#1
operator < with a "set"
I hope someone can shed some light on how I need to define this operator to compare.
I get this error:
:\program files\microsoft visual studio\vc98\include\functional(86) : error C2678: binary '<' : no operator defined which takes a left-hand operand of type 'const class FileToCopy' (or there is no acceptable conversion)
c:\program files\microsoft visual studio\vc98\include\functional(86) : while compiling class-template member function 'bool __thiscall std::less<class FileToCopy>: perator ()(const class FileToCopy &,const class FileToCopy &) const'
class FileToCopy //I've create dmy operator in here
{
private:
File src;
File dst;
public:
FileToCopy( const File &src_, const File &dst_)
: src( src_), dst( dst_)
{
}
FileToCopy()
{
}
const File &GetSrc() const { return src; }
const File &GetDst() const { return dst; }
operator < (const FileToCopy &listOfFilesToCopy);
};
If you require more infornmation please let me know.
Thank you in Advance
-
June 1st, 1999, 12:31 PM
#2
Re: operator < with a "set"
The only thing I see that stands out is your operator < declaration does not return a bool.
HTH,
chris
-
June 1st, 1999, 01:09 PM
#3
Re: operator < with a "set"
I've added the return boolean but I still get this error. I'm not exactly sure how this operator works. Shouldn't I be doing some logic in the operator function..Like a compare or something..
HELP!!!
c:\program files\microsoft visual studio\vc98\include\functional(86) : error C2678: binary '<' : no operator defined which takes a left-hand operand of type 'const class FileToCopy' (or there is no acceptable conversion)
c:\program files\microsoft visual studio\vc98\include\functional(86) : while compiling class-template member function 'bool __thiscall std::less<class FileToCopy>: perator ()(const class FileToCopy &,const class FileToCopy &) const'
// TEMPLATE STRUCT less
template<class _Ty>
struct less : binary_function<_Ty, _Ty, bool> {
bool operator()(const _Ty& _X, const _Ty& _Y) const
{return (_X < _Y); }
};
This is where the error ends up.
Thanks
-
June 1st, 1999, 01:22 PM
#4
Re: operator < with a "set"
two guesses:
1) try using CX: perator <(const CX& x)const
or
2) try an external friend operator
bool operator <(const CX& lhs, const CX& rhs);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|