MyException - 我的异常网
当前位置:我的异常网» C++ » 小于符号重载有关问题

小于符号重载有关问题

www.MyException.Cn  网友分享于:2013-02-18  浏览:30次
小于符号重载问题
typedef struct tagBigramPairRecord
{
        std::string aph;
        std::string name;
        int count;
        int distance;

        tagBigramPairRecord()
        {
                aph      = "";
                name     = "";
                count    = 0;
                distance = 0;
        }

        bool operator<(const tagBigramPairRecord & rsc) const
        {
                if (aph < rsc.aph)
                {
                        return true;
                }
                if (aph > rsc.aph)
                {
                        return false;
                }
                if (name < rsc.name)
                {
                        return true;
                }
                return false;
        }

        bool operator==(const tagBigramPairRecord & rsc) const
        {
                if (aph == rsc.aph && name == rsc.name)
                {
                        return true;
                }
                return false;
        }
} BigramPairRecord;


set<BigramPairRecord> candidate_records;
set<BigramPairRecord>::iterator set_iter = candidate_records.find(stBigramPairRecord);         

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有