After writing out the main functionality for my templatized data structure, I am stumbling with the syntax to allow for Compare (so the user can provide a definition for less). If I am not mistaken, I need to add at least another constructor. I tried reading the STL implementations for priority_queue and the such, but the syntax looked rather cryptic. Can someone please either point me in the direction of decent documentation (since I cannot seem to find any) or provide me with instructions?
Jump to Post
I could be mistaken, though I believe that the STL sorted containers expect a type with a valid operator<. If the type doesn't provide one, then overloaded constructor(s) will take an additional parameter in the form of a compare function, or a function object which overloads operator() instead.
All 3 RepliesReply to this topic
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.