Wow, this is more useful than just the casting part. I find working with the expansion operator very cumbersome; maybe because I haven't studied all the rules. But with this syntax, you're moving the expansion at the top of the lambda, and you're free to use `strlike` as a single object inside the body. Awesome video!
Literally wrote a subsystem for transporting some version information between client and server, which had almost the exact same function and problem as this video. The function in question was just merging single tokens (from constexpr defines, strings at hand in the version constructing class and other string_view like identifier). WIth the lambda capture we can output a total_size from the single tokens (of whatever stringlike type) and create a new string with reserved size onto which to append
...iden is the syntax to inroduce a parameter pack with the name "iden". So 'strlike' is a pack that consists of string_views into the parameter strings.
I feel like this is the kind of code you can only read for a about a week after you write it, and then if you read it again at any point after that you get instantly lost in the folding expressions. They are not very intuitive.
string_view is never a copy, so it's just creating a view (pointer + length) for each string-like thing passed in. This is not 0 cost, necessarily, but it is very low cost. It might incur some strlen calls sometimes, but otherwise should just be copying 2 pointer-sized things per element.
It's this kind of garbage syntax why I've been working on my own language and the issue with strings is why the default string type in my language *is* a string view.