ispringtech / FastSignals

Easy to use, fast and lightweight C++17 signals and slots library, drop-in replacement for the Boost.Signals2
MIT License
25 stars 10 forks source link

Fixes exception safety issue in signal_impl::add() #15

Closed alexey-malov closed 5 years ago

alexey-malov commented 5 years ago

Original signal_impl is not exception safe. If the 2nd emplace_back throws, signal state becomes inconsistent. This PR fixes signal_impl::add(). It also makes connection ids start from 1, not 2

Warboss-rus commented 5 years ago

Tried putting both id and function into the same vector (using std::pair), but that slows benchmark down too much. Merging this solution does not affect perfomance as much.