From 5219f0705c87b87e07f87efe726a78082b24d40e Mon Sep 17 00:00:00 2001 From: Sarang Masti Date: Fri, 19 Dec 2014 16:44:37 -0800 Subject: [PATCH] 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 --- folly/Conv.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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; } -- 2.34.1