I created the following class to create values of any type which are either fixed or recalculated everytime the call operator is used on them:
template