Some error while doing xor to all elements of a std::set
.
below is partial code. Don't know much about std::transform
. help pls :)
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
set<ll> e1 ;//suppose i had inserted few elements in it!
ll x2;
cin>>x2;
//now i want to xor all elements of set with x2.
std::transform(std::begin(e1), std::end(e1), std::begin(e1), [=](ll x){return x2^x;});
return 0;
}
Error message:
Error assignment of read-only location '__result.std::_Rb_tree_const_iterator<_Tp>::operator*()'