Skip to content

Commit aa811c3

Browse files
committed
SERVER-14938 Remove string streaming operators from OpTime and Date_t
1 parent 018b95b commit aa811c3

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

src/mongo/bson/optime.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,4 @@ namespace mongo {
4242
return OpTime(t, i);
4343
}
4444

45-
std::ostream& operator<<(std::ostream &s, const OpTime &ot) {
46-
return s << ot.toString();
47-
}
4845
}

src/mongo/bson/optime.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,4 @@ namespace mongo {
144144
};
145145
#pragma pack()
146146

147-
std::ostream& operator<<(std::ostream &s, const OpTime &ot);
148-
149147
} // namespace mongo

src/mongo/db/repl/repl_coordinator_impl_test.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@
5050
#include "mongo/util/log.h"
5151

5252
namespace mongo {
53+
54+
// So that you can ASSERT_EQUALS two OpTimes
55+
std::ostream& operator<<( std::ostream &s, const OpTime &ot ) {
56+
s << ot.toString();
57+
return s;
58+
}
59+
// So that you can ASSERT_EQUALS two Date_ts
60+
std::ostream& operator<<( std::ostream &s, const Date_t &t ) {
61+
s << t.toString();
62+
return s;
63+
}
64+
5365
namespace repl {
5466
namespace {
5567

src/mongo/db/repl/topology_coordinator_impl_test.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@
3636
#include "mongo/util/time_support.h"
3737

3838
namespace mongo {
39+
40+
// So that you can ASSERT_EQUALS two OpTimes
41+
std::ostream& operator<<( std::ostream &s, const OpTime &ot ) {
42+
s << ot.toString();
43+
return s;
44+
}
45+
// So that you can ASSERT_EQUALS two Date_ts
46+
std::ostream& operator<<( std::ostream &s, const Date_t &t ) {
47+
s << t.toString();
48+
return s;
49+
}
50+
3951
namespace repl {
4052
namespace {
4153

src/mongo/util/time_support.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ namespace mongo {
7070
}
7171
}
7272

73-
std::ostream& operator<<(std::ostream &s, const Date_t &t) {
74-
return s << t.toString();
75-
}
76-
7773
// jsTime_virtual_skew is just for testing. a test command manipulates it.
7874
long long jsTime_virtual_skew = 0;
7975
boost::thread_specific_ptr<long long> jsTime_virtual_thread_skew;

src/mongo/util/time_support.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ namespace mongo {
6464
bool isFormatable() const;
6565
};
6666

67-
std::ostream& operator<<(std::ostream &s, const Date_t &t);
68-
6967
// uses ISO 8601 dates without trailing Z
7068
// colonsOk should be false when creating filenames
7169
std::string terseCurrentTime(bool colonsOk=true);

0 commit comments

Comments
 (0)