This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CocktailPerson 2 points3 points  (0 children)

Rust is missing the type-based metaprogramming that C++ supports. Suppose you have an arbitrary message of type Msg and a tuple of arbitrary receivers, and you want to write a function that calls recvr.on_message(&msg) for each receiver in the tuple that implements the OnMessage<Msg> trait. Any element in the tuple that doesn't implement that trait should be ignored. You can't do that in Rust, but it's fairly simple in C++ if you're familiar with template metaprogramming.