Hi,
You can look at the
MATLAB scripts in RTAB-Map source. Particularly, you can run the
RecursiveBayes.m script for a simple example of hypothesis propagation.
The C++ code does mostly the same, but it is more complex because of the memory management approach.
cheers