I have a function that uses progress_display to show a loading bar. I would like to be able to be able to disable the output for testing. The loading bar prints the second it is inititialized, and if I initialize it in an if statement, I get an error from calling ++loading_bar; from another if statement. 
I was wondering if I could disable it by initializing it with my own stream that does nothing, but I have no idea how I would make this.
#include <boost/progress.hpp>
int myfuntion(bool silent)
{
  int computations = 100;
  boost::progress_display loading_bar(computations);
  ++loading_bar;
}
 
     
    