I would like to have a container
StdStyleSet<A>
of
class A : IComparable<A> { ... }
which satisfies the properties of std::set. This would especially be:
- The elements themselve are the keys
- Automatically sorted on insertion
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
SortedSet<T>: see documents – although technically, it’s in the .NET Framework.For earlier versions, you could use a HashSet and sort using LINQ, not ideal if you’re primarily consuming the set in an ordered fashion. Alternatively you could use a
SortedDictionary<TKey,TValue>with the value asObjectand store your elements in the keys with nulls for the values.