I am trying to sort this class but for some reason I cannot get it to work. Can someone please tell me what I am doing wrong.
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class CLog
{
public:
    string GetName()
    {
        return m_sName;
    }
    void SetName(string sName)
    {
        m_sName = sName;
    }
private:
    string m_sName = "";
};
bool sortByName(const CLog &lhs, const CLog &rhs)
{
    return lhs.GetName() < rhs.GetName();
}
int main()
{
    vector<CLog> lsLog;
    CLog oLog1;
    oLog1.SetName("b");
    lsLog.push_back(oLog1);
    CLog oLog2;
    oLog2.SetName("c");
    lsLog.push_back(oLog2);
    CLog oLog3;
    oLog3.SetName("a");
    lsLog.push_back(oLog3);
    sort(lsLog.begin(),
     lsLog.end(),
     sortByName
     );
    return 0;
}
This gives me these errors
25|error: passing ‘const CLog’ as ‘this’ argument of ‘std::string CLog::GetName()’ discards qualifiers [-fpermissive]|
25|error: passing ‘const CLog’ as ‘this’ argument of ‘std::string CLog::GetName()’ discards qualifiers [-fpermissive]|
 
     
    