Adding a constructor to UTF8Range that uses std::string
authorAditya Muttur <adityamuttur@fb.com>
Tue, 26 Apr 2016 22:53:40 +0000 (15:53 -0700)
committerFacebook Github Bot 0 <facebook-github-bot-0-bot@fb.com>
Tue, 26 Apr 2016 23:05:22 +0000 (16:05 -0700)
commit545134d11e72181e9df4bdcbd17ba6ccc8196c07
tree60734478d36ae778faab3c42b2bd544fac8ed02a
parent0be0a8cdb26cd0a5c5fdc3006ce67f8c40c1653a
Adding a constructor to UTF8Range that uses std::string

Summary:
Currently UTF8Range has a constructor that allows you construct an object of type UTF8Range using only an object of type folly::Range. Adding a constructor so that we can construct an UTF8Range object using a std::string.

Currently,
  void sampleMethod(UTF8StringPiece sp) {...}
  /*
  ...
  */
  std::string str = "example";
  folly::UTF8Range utf8Range(str);
  folly::StringPiece sp(str);
  sampleMethod(utf8Range); // works
  sampleMethod(sp); // works
  sampleMethod(str); // doesn't work

This diff hopes to fix this issue.

Reviewed By: ddrcoder

Differential Revision: D3221144

fb-gh-sync-id: dd6ec4d7790d4602dccb3b63a4861d358aed3608
fbshipit-source-id: dd6ec4d7790d4602dccb3b63a4861d358aed3608
folly/String.h
folly/test/StringTest.cpp