Skip to content

Commit 9a55d22

Browse files
BillyDonahuehjmjohnson
authored andcommitted
remove JSON_HAS_RVALUE_REFERENCES
1 parent 00558b3 commit 9a55d22

File tree

4 files changed

+0
-44
lines changed

4 files changed

+0
-44
lines changed

include/json/config.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -97,30 +97,6 @@ msvc_pre1900_c99_snprintf(char* outBuf, size_t size, const char* format, ...);
9797
#define JSONCPP_OP_EXPLICIT
9898
#endif
9999

100-
#ifndef JSON_HAS_RVALUE_REFERENCES
101-
102-
#if defined(_MSC_VER)
103-
#define JSON_HAS_RVALUE_REFERENCES 1
104-
#endif // MSVC >= 2013
105-
106-
#ifdef __clang__
107-
#if __has_feature(cxx_rvalue_references)
108-
#define JSON_HAS_RVALUE_REFERENCES 1
109-
#endif // has_feature
110-
111-
#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
112-
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
113-
#define JSON_HAS_RVALUE_REFERENCES 1
114-
#endif // GXX_EXPERIMENTAL
115-
116-
#endif // __clang__ || __GNUC__
117-
118-
#endif // not defined JSON_HAS_RVALUE_REFERENCES
119-
120-
#ifndef JSON_HAS_RVALUE_REFERENCES
121-
#define JSON_HAS_RVALUE_REFERENCES 0
122-
#endif
123-
124100
#ifdef __clang__
125101
#if __has_extension(attribute_deprecated_with_message)
126102
#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))

include/json/value.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,10 @@ class JSON_API Value {
251251
CZString(ArrayIndex index);
252252
CZString(char const* str, unsigned length, DuplicationPolicy allocate);
253253
CZString(CZString const& other);
254-
#if JSON_HAS_RVALUE_REFERENCES
255254
CZString(CZString&& other);
256-
#endif
257255
~CZString();
258256
CZString& operator=(const CZString& other);
259-
260-
#if JSON_HAS_RVALUE_REFERENCES
261257
CZString& operator=(CZString&& other);
262-
#endif
263258

264259
bool operator<(CZString const& other) const;
265260
bool operator==(CZString const& other) const;
@@ -468,10 +463,7 @@ Json::Value obj_value(Json::objectValue); // {}
468463
///
469464
/// Equivalent to jsonvalue[jsonvalue.size()] = value;
470465
Value& append(const Value& value);
471-
472-
#if JSON_HAS_RVALUE_REFERENCES
473466
Value& append(Value&& value);
474-
#endif
475467

476468
/// Access an object value by name, create a null member if it does not exist.
477469
/// \note Because of our implementation, keys are limited to 2^30 -1 chars.

src/lib_json/json_value.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,10 @@ Value::CZString::CZString(const CZString& other) {
276276
storage_.length_ = other.storage_.length_;
277277
}
278278

279-
#if JSON_HAS_RVALUE_REFERENCES
280279
Value::CZString::CZString(CZString&& other)
281280
: cstr_(other.cstr_), index_(other.index_) {
282281
other.cstr_ = nullptr;
283282
}
284-
#endif
285283

286284
Value::CZString::~CZString() {
287285
if (cstr_ && storage_.policy_ == duplicate) {
@@ -304,14 +302,12 @@ Value::CZString& Value::CZString::operator=(const CZString& other) {
304302
return *this;
305303
}
306304

307-
#if JSON_HAS_RVALUE_REFERENCES
308305
Value::CZString& Value::CZString::operator=(CZString&& other) {
309306
cstr_ = other.cstr_;
310307
index_ = other.index_;
311308
other.cstr_ = nullptr;
312309
return *this;
313310
}
314-
#endif
315311

316312
bool Value::CZString::operator<(const CZString& other) const {
317313
if (!cstr_)
@@ -1169,11 +1165,9 @@ Value const& Value::operator[](CppTL::ConstString const& key) const {
11691165

11701166
Value& Value::append(const Value& value) { return (*this)[size()] = value; }
11711167

1172-
#if JSON_HAS_RVALUE_REFERENCES
11731168
Value& Value::append(Value&& value) {
11741169
return (*this)[size()] = std::move(value);
11751170
}
1176-
#endif
11771171

11781172
Value Value::get(char const* begin,
11791173
char const* end,
@@ -1198,11 +1192,7 @@ bool Value::removeMember(const char* begin, const char* end, Value* removed) {
11981192
if (it == value_.map_->end())
11991193
return false;
12001194
if (removed)
1201-
#if JSON_HAS_RVALUE_REFERENCES
12021195
*removed = std::move(it->second);
1203-
#else
1204-
*removed = it->second;
1205-
#endif
12061196
value_.map_->erase(it);
12071197
return true;
12081198
}

src/test_lib_json/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,15 +2499,13 @@ JSONTEST_FIXTURE(IteratorTest, const) {
24992499
struct RValueTest : JsonTest::TestCase {};
25002500

25012501
JSONTEST_FIXTURE(RValueTest, moveConstruction) {
2502-
#if JSON_HAS_RVALUE_REFERENCES
25032502
Json::Value json;
25042503
json["key"] = "value";
25052504
Json::Value moved = std::move(json);
25062505
JSONTEST_ASSERT(moved != json); // Possibly not nullValue; definitely not
25072506
// equal.
25082507
JSONTEST_ASSERT_EQUAL(Json::objectValue, moved.type());
25092508
JSONTEST_ASSERT_EQUAL(Json::stringValue, moved["key"].type());
2510-
#endif
25112509
}
25122510

25132511
int main(int argc, const char* argv[]) {

0 commit comments

Comments
 (0)