problem_format: add C++ templates
Many templates have been floating around in the DMOJ community for validation and input handling in checkers. This commit aims to consolidate them. It has two main goals:
-
Correct. Duh.
-
Simple. Other templates that circulate, including the ones I have published, are too complex. People naively try and write their own. I am sick and tired of reading over incorrect validators.
These templates forgo some principles of good design (such as object-oriented programming) in favour of pure simplicity. They should be simple enough that they are understandable by the broader community, and are not a black box. Hopefully this also dissuades re-writing.
Can we make sure the templates pass clang-format?
Yes, I'd be happy to add CI for that. Would you also like me to add some tests for the methods using ctest?
Would you also like me to add some tests for the methods using
ctest?
Sure, but at least make sure they build or something.