From: Sarang Masti Date: Sat, 20 Dec 2014 00:44:37 +0000 (-0800) Subject: Allow conversion from StringPiece to StringPiece X-Git-Tag: v0.22.0~77 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5219f0705c87b87e07f87efe726a78082b24d40e;p=folly.git Allow conversion from StringPiece to StringPiece Summary: Allow conversion from folly::StringPiece to folly::StringPiece Test Plan: - fbconfig -r folly && fbmake runtests Reviewed By: mpawlowski@fb.com Subscribers: folly-diffs@ FB internal diff: D1752609 Signature: t1:1752609:1419037172:04846f658901306b53fb60c9eafbdf0f4d4d7005 --- diff --git a/folly/Conv.h b/folly/Conv.h index c90b4c03..def3d872 100644 --- a/folly/Conv.h +++ b/folly/Conv.h @@ -820,14 +820,15 @@ template void toAppendDelimFit(const De&, const Ts&) {} /** - * to(SomeString str) returns itself. As both std::string and - * folly::fbstring use Copy-on-Write, it's much more efficient by - * avoiding copying the underlying char array. + * to(SomeString str) or to(StringPiece str) returns + * itself. As both std::string and folly::fbstring use Copy-on-Write, it's much + * more efficient by avoiding copying the underlying char array. */ template typename std::enable_if< - IsSomeString::value && std::is_same::value, - Tgt>::type + (IsSomeString::value + || std::is_same::value) + && std::is_same::value, Tgt>::type to(const Src & value) { return value; }