template <class... Args>
inline dynamic dynamic::array(Args&& ...args) {
- return dynamic(std::initializer_list<dynamic>{std::forward<Args>(args)...},
- PrivateTag());
+ return dynamic(Array{std::forward<Args>(args)...}, PrivateTag());
}
// This looks like a case for perfect forwarding, but our use of
}
inline dynamic::dynamic(std::initializer_list<dynamic> il)
- : dynamic(std::move(il), PrivateTag()) {
-}
-
-inline dynamic::dynamic(std::initializer_list<dynamic> il, PrivateTag)
- : type_(ARRAY)
-{
- new (&u_.array) Array(il.begin(), il.end());
-}
+ : dynamic(Array(std::move(il)), PrivateTag()) {}
inline dynamic& dynamic::operator=(std::initializer_list<dynamic> il) {
- (*this) = dynamic(il, PrivateTag());
+ (*this) = dynamic(Array(std::move(il)), PrivateTag());
return *this;
}
//////////////////////////////////////////////////////////////////////
+inline dynamic::dynamic(Array&& r, PrivateTag) : type_(ARRAY) {
+ new (&u_.array) Array(std::move(r));
+}
+
#define FOLLY_DYNAMIC_DEC_TYPEINFO(T, str, val) \
template <> struct dynamic::TypeInfo<T> { \
static constexpr const char* name = str; \
FOLLY_DEPRECATED(
"Initializer list syntax is deprecated (#10300209). Use dynamic::array.")
/* implicit */ dynamic(std::initializer_list<dynamic> il);
- dynamic(std::initializer_list<dynamic> il, PrivateTag);
FOLLY_DEPRECATED(
"Initializer list syntax is deprecated (#10300209). Use dynamic::array.")
dynamic& operator=(std::initializer_list<dynamic> il);
template<class T> struct GetAddrImpl;
template<class T> struct PrintImpl;
+ dynamic(Array&& array, PrivateTag);
+
template<class T> T const& get() const;
template<class T> T& get();
template<class T> T* get_nothrow() & noexcept;