use heterogeneous lookup and mutation in folly::dynamic
Summary:
This diff allows `folly::dynamic` to lookup and mutate using any type that is
convertible to `StringPiece` (i.e., `const char*`, `std::string`, `fbstring`)
without having to construct a `dynamic` object (which requires copying the
string).
Previously (D8299863), we SFINAE'd and took `StringPiece` by reference. This
caused linker errors for non-member constexpr string constants like the
following which are odr-used.
  struct S {
    static constexpr auto kXXX = "xxx";
  };
  d.at(kXXX); // linker error
Hence in this diff, we template on types that are convertible to dynamic but
NOT to StringPiece, and add a separate overload which takes StringPiece by
value.
Reviewed By: yfeldblum
Differential Revision: D9540388
fbshipit-source-id: 529de31585200947b8b92fcf3126442a8ed51a73
Showing
Please register or sign in to comment
