Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

1
Remove Duplicate tuple from a vector of tuples vector<tuple<int,int>> without changing the order of the vector
Post Flair (click to view more posts with a particular flair)
Post Body

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

Comments
[not loaded or deleted]

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

[not loaded or deleted]

yes and that's why I didn't use that

[not loaded or deleted]

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

[not loaded or deleted]

I used the code u provided it just erases the whole vector even if it has a duplicate or not

Author
Account Strength
0%
Account Age
4 years
Verified Email
Yes
Verified Flair
No
Total Karma
747
Link Karma
380
Comment Karma
111
Profile updated: 6 months ago
Posts updated: 6 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
2 years ago