On 01/30/2014 05:13 PM, Erik Erlandson wrote:
Or, we might unify all of it into a single parameter:
_terminate = cost(cost_thresold, [bool exception - defaults to false]) _terminate = time(time_threshold, etc) _terminate = memory(mem_threhold, etc)
That is, 'cost', 'time' and 'memory' are data types that carry an appropriate threshold and a termination policy flag that defaults to 'false', aka 'fallback without exception.' The above assumes only one kind of termination condition. That might be OK. Time, memory and cost are roughly surrogates of each other, and limiting any one of them limits the other two.
This looks like a really good solution (and I assume that you are also going to rename _max_cost_exception to _terminate_exception.) You may consider using duration() (possibly chrono::duration()) instead of time().