[OpenCV 2.2] using namespace std; in the .h body !! (Bug #846)


Added by Eloi Du Bois about 14 years ago. Updated about 14 years ago.


Status:Done Start date:
Priority:Blocker Due date:
Assignee:Marius Muja % Done:

0%

Category:flann
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

Hi,

There is a mistake in opencv 2.2, very tedious when working on big projects with many dependencies:
In the "opencv2/flann/" module, there are several files containing a using namespace std in the common body of the .h. This implies that when including cv.h, we get conflicts with other types.

I recommand to put the "using namespace std" inside the cv namespace. This doesn't implies any changes for you but a lot for people using OpenCV.

Example:

h30. ORIGINAL

#ifndef OPENCV_RESULTSET_H
#define OPENCV_RESULTSET_H

#include <algorithm>
#include <limits>
#include <vector>
#include "opencv2/flann/dist.h"

using namespace std;

namespace cvflann {
[...]

h30. FIXED

#ifndef OPENCV_RESULTSET_H
#define OPENCV_RESULTSET_H

#include <algorithm>
#include <limits>
#include <vector>
#include "opencv2/flann/dist.h"

namespace cvflann {

using namespace std;
[...]

Thank you in advance,
Eloi du Bois.


Associated revisions

Revision 7d42dbdd
Added by Marius Muja about 14 years ago

Removing 'using namespace std' from header files, closes bugs #730 and #846

Revision 2faa2ada
Added by Andrey Pavlenko almost 12 years ago

Merge pull request #846 from smart-mobile-software:tuto_crash

History

Updated by Dmitry Bely about 14 years ago

I have also run into that. Really a showstopper.

Updated by Marius Muja about 14 years ago

Fixed in r4727.

  • Status changed from Open to Done
  • (deleted custom field) set to fixed

Also available in: Atom PDF