MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/hh0cjp/html_write_html_documents_using_c_templates/fw9afdg/?context=3
r/cpp • u/csb06 • Jun 27 '20
27 comments sorted by
View all comments
13
This is super dumb, I love it :P
I was able to get the whole thing to run at compile-time!
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!
2
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.
cout<<"<html><head>...</html>"
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!
3
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 :)
new
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!
didn't know. thanks!
13
u/jasonthe Jun 28 '20
This is super dumb, I love it :P
I was able to get the whole thing to run at compile-time!