Skip to content

Added USING_STD_NAMESPACE macro to text module #1337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions modules/text/src/precomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
#include "text_config.hpp"

#ifdef HAVE_TESSERACT
#if !defined(USE_STD_NAMESPACE)
#define USE_STD_NAMESPACE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no mentions of this macro in the Opencv code? Why do you need this?

Copy link
Contributor

@LaurentBerger LaurentBerger Aug 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think problem is explained here
Problem is : at line using tesseract 4.00.0alpha

I don't understand problem at line there is a std:: before vector but no std before string.

Using std::string does not comply with Google's coding conventions.

@stweil

I don't think macro is good idea but problem must be solved.

@fifothekid if you need tesseract now insert std before string and problem is solved

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LaurentBerger exactly

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LaurentBerger, using that macro is the new correct way to solve the problem with string. I'm afraid that Google's coding conventions are something which we cannot change. The usage of std:: is inconsistent, yes.

In addition to the macro, I'd also add a comment which explains why the macro is needed. Maybe some day it won't be needed any more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fifothekid argee, comment is needed here and eliminate merge commit please.

Copy link
Contributor

@LaurentBerger LaurentBerger Aug 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Macro is here and only used by tesseract( on my knowledge). May be insert in precomp.hpp :

#include <string>
using std::string;

would be readable

@stweil I have got some difficulties to find rule in google coding convetion. Is it this?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LaurentBerger Thanks man, your code worked like a charm.

#endif
#include <tesseract/baseapi.h>
#include <tesseract/resultiterator.h>
#endif
Expand Down