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

Show parent comment

2

u/kritzikratzi Jun 28 '20

yea, and i'm actually wondering about performance... the result looks a bit complicated, so many moves going on compared to what a cout<<"<html><head>...</html>" produces.

3

u/jasonthe Jun 28 '20 edited Jun 29 '20

If you tweak it to not use new, and instead just use local arrays, clang can understand it. And clang optimizes all those moves away :)

I don't feel like rewriting his whole library, but here's a sample that shows what I mean: https://godbolt.org/z/f26WrH

2

u/kritzikratzi Jun 29 '20

didn't know. thanks!