r/cpp • • Jun 27 '20

HTML++: Write HTML documents using C++ templates

https://github.com/csb6/html-plus-plus
260 Upvotes

27 comments sorted by

View all comments

55

u/looncraz Jun 27 '20

This, frankly, looks easier than writing HTML directly... Plus free error checking... Too bad template error messages are horrendously ugly.

1

u/guepier Bioinformatican Jun 28 '20

Then why not use function calls (or types) instead of templates? The syntax is the same — just use (…) instead of <…>) and evaluation can happen more flexibly at runtime where it makes sense. Type checking would be just as strict. I really don’t see the upside to using templates here, unless constructing the HTML is somehow a gigantic bottle-neck that must happen at compile-time.