diff --git a/folly/Range.h b/folly/Range.h index 9ddf04525737514debbcdf69290c5079dd8a67b0..65b7441d0b53055ab5fd2ffb7db4341c62496e6c 100644 --- a/folly/Range.h +++ b/folly/Range.h @@ -188,9 +188,10 @@ public: // Allow implicit conversion from Range<const char*> (aka StringPiece) to // Range<const unsigned char*> (aka ByteRange), as they're both frequently // used to represent ranges of bytes. - template <typename std::enable_if< - (std::is_same<Iter, const unsigned char*>::value), int>::type = 0> - /* implicit */ Range(const Range<const char*>& other) + template <class OtherIter, typename std::enable_if< + (std::is_same<Iter, const unsigned char*>::value && + std::is_same<OtherIter, const char*>::value), int>::type = 0> + /* implicit */ Range(const Range<OtherIter>& other) : b_(reinterpret_cast<const unsigned char*>(other.begin())), e_(reinterpret_cast<const unsigned char*>(other.end())) { }