6 ms·
how is it better than https://github.com/boost-ext/sml https://github.com/boost-ext/sml ? there are about 1 million c++ state machines, and sml happens to be t
by wangii 1y ago
how is it better than https://github.com/boost-ext/sml https://github.com/boost-ext/sml ?
there are about 1 million c++ state machines, and sml happens to be the best, or one of them. how does yours differentiate?
- canyp 1y agoI was about to complain about the use of strings in both libraries, both for the lack of type safety as well as the possible runtime allocation, but then I looked at the assembly for the sml example and there are no strings in the binary other than the obvious "send" one. What exactly happened there? It looks like make_transition_table() is doing some serious magic. Or are the state transitions evaluated at compile-time given that there is no input in the example, and then the transition table gets compiled out? Anyway, I think it would help OP's library to have some assembly output in the readme as well.
- aw1621107 1y agoLooks like SML is using user-defined literals [0, 1] to effectively pre-process the string literal into state/event objects. Looks like the string itself is turned into a template parameter in the process and I believe those shouldn't show up in the compiled code (maybe unless there's some mangling-related thing going on?) [0]: https://en.cppreference.com/w/cpp/language/user_literal.html https://en.cppreference.com/w/cpp/language/user_literal.html [1]: https://github.com/boost-ext/sml/blob/f232328b49adf708737bef5173d5620855d88446/include/boost/sml.hpp#L2860 https://github.com/boost-ext/sml/blob/f232328b49adf708737bef...
- canyp 1y agoThanks, I didn't know that was a thing.