seldon-code / seldon

A code for opinion dynamics simulations.
GNU General Public License v3.0
7 stars 2 forks source link

Doubt #44

Closed User-DK closed 5 months ago

User-DK commented 5 months ago

https://github.com/seldon-code/seldon/blob/5bd6f9e6b440e0716d11afb17c3d1f568b2c5515/include/network.hpp#L119-L127

I was working on creating bindings for the Network header but encountered this two same named functions means the doubt is why do we require both in the bindings?

MSallermann commented 5 months ago

Hey @User-DK,

this function is just overloaded based on the const qualifier.

The first definition gives read-only access to the neighbour list (hence it returns std::span<const size_t>) and is invoked only if you have a const Network.

The second function gives read-write access (hence it returns a std::span<size_t>) and, therefore, you can modify the neighbour list through the returned span.

User-DK commented 5 months ago

thanks @MSallermann