The first parameter of runningTimeTest became const.
authoralpar
Wed, 16 Nov 2005 13:21:57 +0000
changeset 18061530c115580f
parent 1805 d284f81f02a5
child 1807 5f2f3d982eba
The first parameter of runningTimeTest became const.
It is necessary to enable to pass of temporary objects.
lemon/time_measure.h
     1.1 --- a/lemon/time_measure.h	Wed Nov 16 13:19:05 2005 +0000
     1.2 +++ b/lemon/time_measure.h	Wed Nov 16 13:21:57 2005 +0000
     1.3 @@ -219,7 +219,7 @@
     1.4    ///\endcode
     1.5    ///
     1.6    ///The \ref Timer can also be \ref stop() "stopped" and
     1.7 -  ///\ref start() "started" again, so it is easy to compute collected
     1.8 +  ///\ref start() "started" again, so it is possible to compute collected
     1.9    ///running times.
    1.10    ///
    1.11    ///\warning Depending on the operation system and its actual configuration
    1.12 @@ -371,14 +371,14 @@
    1.13    ///\return The average running time of \c f.
    1.14    
    1.15    template<class F>
    1.16 -  TimeStamp runningTimeTest(F &f,double min_time=10,int *num = NULL,
    1.17 +  TimeStamp runningTimeTest(const F &f,double min_time=10,int *num = NULL,
    1.18  			TimeStamp *full_time=NULL)
    1.19    {
    1.20      Timer t;
    1.21      TimeStamp full;
    1.22      int total=0;
    1.23      for(int tn=1;tn < 1<<24; tn*=2) {
    1.24 -      for(;total<tn;total++) f();
    1.25 +      for(;total<tn;total++) const_cast<F &>(f)();
    1.26        full=t;
    1.27        if(full.realTime()>min_time) {
    1.28  	if(num) *num=total;