vector - swap two elements when elements have const members
<p>I have the following code</p>

<pre><code>class a {
public:
    const int aa;
    a(int aa) : aa(aa){}
};
int main() {
    std::vector&lt;a&gt; v;
    v.emplace_back(1);
    v.emplace_back(2);
    v.emplace_back(3);
    v.emplace_back(4);

    std::iter_swap(v.begin() + 1, v.rbegin());

    system("pause");
    return 0;
}
</code></pre>

<p>I get an error when I try to swap two elements of the vector.</p>

<pre><code>Error   C2280   'a &amp;a::operator =(const a &amp;)': attempting to reference a deleted function
</code></pre>

<p>I understand it's because <code>a</code> has a constant member, but I am not able to figure out how to get this to work.</p>