This post has been de-listed (Author was flagged for spam)
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
this is the instance
vector<tuple<int, int>> child_chromosome;
this is what I have tried
unordered_set<vector<tuple<int,int>>> s(child_chromosome.begin(), child_chromosome.end());
child_chromosome.assign(s.begin(), s.end());
This doesn't work giving compile time error
Error C2280 'std::_Uhash_compare<_Kty,_Hasher,_Keyeq>::_Uhash_compare(const std::_Uhash_compare<_Kty,_Hasher,_Keyeq> &)': attempting to reference a deleted functio
Also tried a solution from Scala: Remove duplicated integers from Vector( tuples(Int,Int) , ...) - Stack Overflow but to avail as its using a different language & no such attributes(groupBy,filter) exits in C
yes and that's why I didn't use that
unique leaves duplicates if the vector is not in order and I want my vector to be not in order I want randomness with no duplicates
I used the code u provided it just erases the whole vector even if it has a duplicate or not
Subreddit
Post Details
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/cpp_questio...
your code did the job but the as you said the O(n^2) increased to O(n^3) because where it's needed it already needs to be in the loop thanks for taking out the time to help