Which is the best way to implement several order relations for only one class? I have an idea with the Strategy Pattern but I’m not sure that’s a good idea. And if there is not a best way, why?
Share
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.
Create a functor class and initialize a member with the order relation you want to use. Have
operator()use the member to decide the ordering of the two operands.