You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my use case i need to use a c++ lambda function with capture as progress_callback2. Something like this:
int16_t lastProgress;
*monitor = tesseract::ETEXT_DESC();
monitor->progress_callback2 = [&] (tesseract::ETEXT_DESC* monitor, int left, int right, int top, int bottom) -> bool {
int16_t progress = monitor->progress;
if (progress > lastProgress) {
lastProgress = progress;
}
progressLambda.value()(lastProgress);
returntrue;
};
progressLambda is another lambda function which i pass a std::optional<std::function>
But this wont work because of the capture [&]. It is apparently not possible to cast it to function pointer
Expected Behavior
Being able to pass the lambda function
Suggested Fix
I managed to fix it replacing the type of PROGRESS_FUNC2 to:
using PROGRESS_FUNC2 = std::function<bool(ETEXT_DESC *, int, int, int, int)>;
I can make a PR for this but i want to be sure first that it would be something you would access.
I think it would be a breaking change because pointer function cannot be casted to std::function.
tesseract -v
No response
Operating System
No response
Other Operating System
No response
uname -a
No response
Compiler
No response
CPU
No response
Virtualization / Containers
No response
Other Information
No response
The text was updated successfully, but these errors were encountered:
Current Behavior
progress_callback2
is a function pointerIn my use case i need to use a c++ lambda function with capture as
progress_callback2
. Something like this:progressLambda
is another lambda function which i pass astd::optional<std::function>
But this wont work because of the capture
[&]
. It is apparently not possible to cast it to function pointerExpected Behavior
Being able to pass the lambda function
Suggested Fix
I managed to fix it replacing the type of
PROGRESS_FUNC2
to:I can make a PR for this but i want to be sure first that it would be something you would access.
I think it would be a breaking change because pointer function cannot be casted to std::function.
tesseract -v
No response
Operating System
No response
Other Operating System
No response
uname -a
No response
Compiler
No response
CPU
No response
Virtualization / Containers
No response
Other Information
No response
The text was updated successfully, but these errors were encountered: