nix-vector-routing: Code and Performance optimizations
This MR has the patches for:
- Add
unordered_map
Ptr<NetDevice>
toPtr<IpInterface>
- Remove
RunIf
construct defined and useif constexpr
instead (Works since C++17) - Add a condition in subnet matching to check if remote address is link-local.
- Remove the C++ template specialization and use
if constexpr
instead. The reason for this is:- Template specialization was done to accommodate for some differences in IPv4 and IPv6.
- Here, the
RunIf
was a viable option but we went with template specialization because of better code redability. - Due to C++17, we can use
if constexpr
which makes the code readability better than template specialization and remove any code redundancy. - Performance-wise, it should remain the same as both specialized functions and
if constexpr
will generate similar code (in previous case and this MR) for both the instantiations at compile time.
Signed-off-by: Ameya Deshpande ameyanrd@outlook.com
Edited by Ameya Deshpande