Fixes bug when multiple varconfs use the same variable

When multiple varconfs that have the same variable are used, only the
configurations for the last varconf is executed, because the others are
overwritten.
Throw an error when CDFs are attempted outside the variables domain
Use std::stable_sort when sorting pairs to avoid reorder of ties

std::sort can change the order of elements that are tied.
std::stable_sort avoids this.
Fixes behaviour of getLowerIndex and getUpperIndex

When the nearest elements below x are tied, the index at the first tied
element is returned by getLowerIndex. This is not ideal, because it
causes discontinuity. Instead the index at the last such returned.
Similar for getUpperIndex.