From: Giuseppe Ottaviano Date: Sat, 22 Oct 2016 18:31:19 +0000 (-0700) Subject: Remove dynamic's initializer_list constructor X-Git-Tag: v2016.10.24.00~1 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d458b0a14486b9d80d5644c7b4de60640c891df1;p=folly.git Remove dynamic's initializer_list constructor Summary: It has been deprecated for several months, time to nuke it. Reviewed By: yfeldblum Differential Revision: D4045250 fbshipit-source-id: 21b55a7c99602c42b1a87ced6a59788fe0ac25d7 --- diff --git a/folly/dynamic-inl.h b/folly/dynamic-inl.h index 909c5b28..a32da925 100644 --- a/folly/dynamic-inl.h +++ b/folly/dynamic-inl.h @@ -212,7 +212,7 @@ inline void dynamic::array(EmptyArrayTag) {} template inline dynamic dynamic::array(Args&& ...args) { - return dynamic(Array{std::forward(args)...}, PrivateTag()); + return dynamic(Array{std::forward(args)...}); } // This looks like a case for perfect forwarding, but our use of @@ -309,14 +309,6 @@ inline dynamic::dynamic(std::string&& s) : type_(STRING) { new (&u_.string) std::string(std::move(s)); } -inline dynamic::dynamic(std::initializer_list il) - : dynamic(Array(std::move(il)), PrivateTag()) {} - -inline dynamic& dynamic::operator=(std::initializer_list il) { - (*this) = dynamic(Array(std::move(il)), PrivateTag()); - return *this; -} - inline dynamic::dynamic(ObjectMaker&& maker) : type_(OBJECT) { @@ -674,7 +666,7 @@ inline void dynamic::pop_back() { ////////////////////////////////////////////////////////////////////// -inline dynamic::dynamic(Array&& r, PrivateTag) : type_(ARRAY) { +inline dynamic::dynamic(Array&& r) : type_(ARRAY) { new (&u_.array) Array(std::move(r)); } diff --git a/folly/dynamic.h b/folly/dynamic.h index 70879759..2dc49434 100644 --- a/folly/dynamic.h +++ b/folly/dynamic.h @@ -63,7 +63,6 @@ #pragma once #include -#include #include #include #include @@ -135,7 +134,6 @@ public: * d["something_else"] = dynamic::array(1, 2, 3, nullptr); */ private: - struct PrivateTag {}; struct EmptyArrayTag {}; struct ObjectMaker; @@ -167,22 +165,6 @@ public: /* implicit */ dynamic(ObjectMaker const&) = delete; /* implicit */ dynamic(ObjectMaker&&); - /* - * Create a new array from an initializer list. - * - * For example: - * - * dynamic v = { 1, 2, 3, "foo" }; - */ - // TODO(ott, 10300209): Remove once all uses have been eradicated. - - FOLLY_DEPRECATED( - "Initializer list syntax is deprecated (#10300209). Use dynamic::array.") - /* implicit */ dynamic(std::initializer_list il); - FOLLY_DEPRECATED( - "Initializer list syntax is deprecated (#10300209). Use dynamic::array.") - dynamic& operator=(std::initializer_list il); - /* * Conversion constructors from most of the other types. */ @@ -543,7 +525,7 @@ private: template struct GetAddrImpl; template struct PrintImpl; - dynamic(Array&& array, PrivateTag); + explicit dynamic(Array&& array); template T const& get() const; template T& get(); diff --git a/folly/experimental/bser/Load.cpp b/folly/experimental/bser/Load.cpp index 3f82dabb..9a64c07e 100644 --- a/folly/experimental/bser/Load.cpp +++ b/folly/experimental/bser/Load.cpp @@ -101,7 +101,7 @@ static dynamic decodeObject(Cursor& curs) { } static dynamic decodeTemplate(Cursor& curs) { - std::vector arr; + dynamic arr = folly::dynamic::array; // List of property names if ((BserType)curs.read() != BserType::Array) { @@ -110,7 +110,6 @@ static dynamic decodeTemplate(Cursor& curs) { auto names = decodeArray(curs); auto size = decodeInt(curs); - arr.reserve(size); while (size-- > 0) { dynamic obj = dynamic::object; @@ -126,10 +125,10 @@ static dynamic decodeTemplate(Cursor& curs) { obj[name.getString()] = parseBser(curs); } - arr.emplace_back(std::move(obj)); + arr.push_back(std::move(obj)); } - return dynamic(std::move(arr)); + return arr; } static dynamic parseBser(Cursor& curs) {