Conditionally show_progress ?

I would like to do something like this void Conditional(const bool show) { unsigned int NumIters = 1e9; boost::progress_display show_progress; if(show) show_progress = boost::progress_display(NumIters); double temp; for(unsigned int i = 0; i < NumIters; i++) { temp = sin(i) / i; if(show) ++show_progress; } } It doesn't seem like I can instantiate a progress_display like this. Is there a way to conditionally have a progress display? Thanks, Dave

David Doria wrote:
I would like to do something like this
void Conditional(const bool show) { unsigned int NumIters = 1e9;
boost::progress_display show_progress; if(show) show_progress = boost::progress_display(NumIters);
double temp; for(unsigned int i = 0; i < NumIters; i++) { temp = sin(i) / i; if(show) ++show_progress; } }
It doesn't seem like I can instantiate a progress_display like this. Is there a way to conditionally have a progress display?
Use pointer to progress_display? - Volodya

AMDG David Doria wrote:
I would like to do something like this
void Conditional(const bool show) { unsigned int NumIters = 1e9;
boost::progress_display show_progress; if(show) show_progress = boost::progress_display(NumIters);
double temp; for(unsigned int i = 0; i < NumIters; i++) { temp = sin(i) / i; if(show) ++show_progress; } }
It doesn't seem like I can instantiate a progress_display like this. Is there a way to conditionally have a progress display?
boost::optional? In Christ, Steven Watanabe
participants (3)
-
David Doria
-
Steven Watanabe
-
Vladimir Prus