Questions comes like this:
I tried to use class progress_display(boost/progress.hpp)to count and display the progress of my program.
Proper usage of class:
1.Instantiation: progress_display pd(count);
2.for( ; ; ){
pd++;
}
3.With the increment of 'pd', the progress is display in console in real-time.
My trouble:
The core function which does most of the computing is an iterative function, and I tried to pass the object ‘pd’ into that function so that when the execution of a sub-iterative function finished, the object ‘pd’ will carry out the “++” operation.
#include<Windows.h>
#include<boost/progress.hpp>
using namespace std;
using namespace boost;
void functest(progress_display pdInput){
pdInput++;
}
int _tmain(int argc, _TCHAR* argv[])
{
vector<int> L;
progress_display pd(100);
functest(pd);
return 0;
}
However, here comes an error: error C2248:”boost::noncopyable_::noncopyable::noncopuable”: unable to access private member(declared in class”boost::noncopyable_::noncopyalbe).
I still don’t know this error comes from the wrong usage of instantiated object, which will occur in all common class or it’s all about the imported boost library?
Thanks to anyone who will give me more helpful information!
The class
progress_displaycannot be copied, so do not pass it as a parameter by value. Pass either by [const] reference or by pointer.