diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-09-15 13:42:10 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-09-15 13:42:10 +0200 |
commit | d6c958ba5fab8318be09d0c60a2eccd9ccbd7186 (patch) | |
tree | 1d7beabec94b0618d1c53c17e796d700ec6565a9 /test/src | |
parent | ca8f32a914ad724bab08b0bb1f930126b4fa8ce5 (diff) | |
download | qtlocation-mapboxgl-d6c958ba5fab8318be09d0c60a2eccd9ccbd7186.tar.gz |
[test] use recursive wrapper for recursive variant types
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/mbgl/test/conversion_stubs.hpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/src/mbgl/test/conversion_stubs.hpp b/test/src/mbgl/test/conversion_stubs.hpp index 63ed4e8b77..b80a2c98bd 100644 --- a/test/src/mbgl/test/conversion_stubs.hpp +++ b/test/src/mbgl/test/conversion_stubs.hpp @@ -15,8 +15,12 @@ namespace conversion { class Value; using ValueMap = std::unordered_map<std::string, Value>; using ValueVector = std::vector<Value>; -class Value : public mbgl::variant<std::string, float, bool, ValueMap, ValueVector> { - using variant::variant; +class Value : public mbgl::variant<std::string, + float, + bool, + mapbox::util::recursive_wrapper<ValueMap>, + mapbox::util::recursive_wrapper<ValueVector>> { + using variant::variant; }; inline bool isUndefined(const Value&) { @@ -25,19 +29,19 @@ inline bool isUndefined(const Value&) { } inline bool isArray(const Value& value) { - return value.is<ValueVector>(); + return value.is<mapbox::util::recursive_wrapper<ValueVector>>(); } inline std::size_t arrayLength(const Value& value) { - return value.get<ValueVector>().size(); + return value.get<mapbox::util::recursive_wrapper<ValueVector>>().get().size(); } inline Value arrayMember(const Value& value, std::size_t i) { - return value.get<ValueVector>()[i]; + return value.get<mapbox::util::recursive_wrapper<ValueVector>>().get()[i]; } inline bool isObject(const Value& value) { - return value.is<ValueMap>(); + return value.is<mapbox::util::recursive_wrapper<ValueMap>>(); } inline optional<Value> objectMember(const Value& value, const char* key) { |