Skip to content

Commit 83a3118

Browse files
committed
🔧 fix cpp std global namespace
1 parent 2b36228 commit 83a3118

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

src/R/src/Rsomoclu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <Rcpp.h>
22
#include <iostream>
33

4-
using namespace std;
4+
using std::string;
55
using namespace Rcpp;
66

77
#include"somoclu.h"

src/io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <string>
2-
using namespace std;
2+
using std::string;
33

44
#ifndef SOMOCLU_IO_H
55
#define SOMOCLU_IO_H

src/somoclu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include "somoclu.h"
4141
#include "io.h"
4242

43-
using namespace std;
43+
using std::string;
4444

4545
/// For synchronized timing
4646
#ifndef MPI_WTIME_IS_GLOBAL

src/somoclu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* SOFTWARE.
2424
**/
2525
#include <string>
26-
using namespace std;
26+
using std::string;
2727

2828
#ifndef SOMOCLU_H
2929
#define SOMOCLU_H

src/training.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
#include "somoclu.h"
3535
#ifndef HAVE_R
36-
using namespace std;
36+
using std::string;
3737
#endif
3838
// From https://stackoverflow.com/questions/17432502/how-can-i-measure-cpu-time-and-wall-clock-time-on-both-linux-windows
3939
// Windows
@@ -72,6 +72,10 @@ using Rcpp::Rcerr;
7272
#else
7373
#include <iostream>
7474
#include <iomanip>
75+
using std::cout;
76+
using std::cerr;
77+
using std::endl;
78+
using std::flush;
7579
#endif // HAVE_R
7680

7781
void cuda_abort(string err) {
@@ -188,7 +192,7 @@ void train(int itask, float *data, svm_node **sparseData,
188192
/// Parameters for SOM
189193
///
190194
if (radius0 == 0) {
191-
unsigned int minDim = min(map.nSomX, map.nSomY);
195+
unsigned int minDim = std::min(map.nSomX, map.nSomY);
192196
radius0 = minDim / 2.0f; /// init radius for updating neighbors
193197
}
194198
if (radiusN == 0) {

0 commit comments

Comments
 (0)