C++: error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const SPoint'
<p>This is my code:</p>

<pre><code>#include &lt;StdAfx.h&gt;;
#include &lt;iostream&gt;;
#include &lt;vector&gt;;
#include &lt;algorithm&gt;;
#include &lt;iterator&gt;;

using namespace std;
struct SPoint
{
    int id;
    int X;
    int Y;
};

bool operator&lt;(const SPoint&amp; p1, const SPoint&amp;p2){
    return p1.id &lt;p2.id;
}

vector&lt;SPoint&gt; points;
vector&lt;SPoint&gt; chosen;
vector&lt;SPoint&gt; cleared;

vector&lt;SPoint&gt;::iterator it;

void print_vect(const vector&lt;SPoint&gt; &amp; vect)
{
    for (int i = 0; i &lt; vect.size(); ++i)
    {
        cout &lt;&lt; vect[i].id &lt;&lt; " (" &lt;&lt; vect[i].X &lt;&lt; "," &lt;&lt; vect[i].Y &lt;&lt; ")"&lt;&lt;endl;               
    }           

    cout &lt;&lt; endl;   
}
bool compare(double val1, double val2)
{
    return val1 &gt; val2;
}
void sort_points(const vector&lt;SPoint&gt; &amp; vect, char command)
{
    bool cmp_result;
    SPoint temp;
    bool sorted=true;
    for (int i = 0; i &lt; vect.size()-1 ; i++)
    {
        sorted=true;
        for (int j = 1; j &lt;= vect.size()-1; j++)
        {
            switch (command) 
            {
                case 'x': 
                    {
                        cmp_result = compare(vect[j-1].X, vect[j].X); 
                        break;
                    }
                case 'y': 
                    {
                        cmp_result = compare(vect[j-1].Y, vect[j].Y); 
                        break;              
                    }               
                case 'i': 
                    {
                        cmp_result = compare(vect[j-1].id, vect[j].id); 
                        break;              
                    }           
            }

            if (cmp_result)
            {
                sorted = false;
                temp = vect[j-1];
                vect[j-1] = vect[j];
                vect[j] = temp;
            }

        }
        if (sorted) 
        {
            cout &lt;&lt; "Sorted:" &lt;&lt; endl;
            print_vect(vect);           
            break;
        }
    }
}

int _tmain(int argc, _TCHAR* argv[])
{
    SPoint temp;
    for (int i = 0; i &lt; 10; i++)
    {
        temp.id = i;
        temp.X = i;
        temp.Y = i;
        points.push_back(temp);
    }

    for (int i = 5; i &lt; 10; i++)
    {
        temp.id = i;
        temp.X = i;
        temp.Y = i;
        chosen.push_back(temp);
    }

    cout &lt;&lt; "Points:" &lt;&lt; endl;
    print_vect(points);
    cout &lt;&lt; endl &lt;&lt; endl;

    cout &lt;&lt; "Chosen:" &lt;&lt; endl;
    print_vect(chosen);

    system("pause");
    sort_points(points, 'i');
    sort_points(chosen, 'i');
    set_difference(points.begin(), points.end(), chosen.begin(), chosen.end(), back_inserter(cleared));
    print_vect(cleared);

    return 0;
}
</code></pre>

<p>Can anybody help me to understand why I am having these errors:</p>

<pre><code>1&gt;c:\users\гость\documents\visual studio 2010\projects\grablevskij2\grablevskij2\grablevskij2.cpp(110): error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const SPoint' (or there is no acceptable conversion)
1&gt;          c:\users\гость\documents\visual studio 2010\projects\grablevskij2\grablevskij2\grablevskij2.cpp(18): could be 'SPoint &amp;SPoint::operator =(const SPoint &amp;)'
1&gt;          while trying to match the argument list '(const SPoint, const SPoint)'
1&gt;c:\users\гость\documents\visual studio 2010\projects\grablevskij2\grablevskij2\grablevskij2.cpp(111): error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const SPoint' (or there is no acceptable conversion)
1&gt;          c:\users\гость\documents\visual studio 2010\projects\grablevskij2\grablevskij2\grablevskij2.cpp(18): could be 'SPoint &amp;SPoint::operator =(const SPoint &amp;)'
1&gt;          while trying to match the argument list '(const SPoint, SPoint)'
</code></pre>
