Add default constructor to dynamic, make other constructors simpler and stricter
authorGiuseppe Ottaviano <ott@fb.com>
Wed, 26 Oct 2016 23:47:00 +0000 (16:47 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Wed, 26 Oct 2016 23:53:30 +0000 (16:53 -0700)
commit94e964976c1b65e79b0f7bdd960cfec260399a52
tree4991184ed1ea1342242fbce7c7dd75762afa4489
parente4431011e41842cf1f7e0f3ac1eba097568a1a56
Add default constructor to dynamic, make other constructors simpler and stricter

Summary:
Now that the initializer list syntax has been removed we can add a default constructor.
Also,
- The `dynamic(T)` constructor was unconstrained, so it would match any type but then fail to compile (as a side effect, `is_convertible<T, dynamic>` would be always true). This also leaked the implementation details of `Array` and `Object`, as they were accepted as arguments. The diff makes the constructor accept only integral and float arguments, and all other types are SFINAEd out.
- `dynamic(Iterator, Iterator)` is made `explicit` to avoid accepting statements like `dynamic d = {"a", "b"};`.
- `object(...)` methods are simplified.

Reviewed By: luciang

Differential Revision: D4065021

fbshipit-source-id: ac289da7bece67c674b7036b7b51d5e016b297e5
folly/docs/Dynamic.md
folly/dynamic-inl.h
folly/dynamic.h
folly/test/DynamicTest.cpp