Allow catch-int to be nolinted
[folly.git] / folly / Range.h
index f556986544a54ccbee21d5bb30a5535626333df3..f61c76e9d4b577bad5d072d6d2cddc605f0815c2 100644 (file)
@@ -163,21 +163,21 @@ public:
   static const size_type npos;
 
   // Works for all iterators
-  Range() : b_(), e_() {
+  constexpr Range() : b_(), e_() {
   }
 
 public:
   // Works for all iterators
-  Range(Iter start, Iter end) : b_(start), e_(end) {
+  constexpr Range(Iter start, Iter end) : b_(start), e_(end) {
   }
 
   // Works only for random-access iterators
-  Range(Iter start, size_t size)
+  constexpr Range(Iter start, size_t size)
       : b_(start), e_(start + size) { }
 
 #if FOLLY_HAVE_CONSTEXPR_STRLEN
   // Works only for Range<const char*>
-  /* implicit */ constexpr Range(Iter str)
+  constexpr /* implicit */ Range(Iter str)
       : b_(str), e_(str + strlen(str)) {}
 #else
   // Works only for Range<const char*>
@@ -291,7 +291,7 @@ public:
   template <class OtherIter, typename std::enable_if<
      (!std::is_same<Iter, OtherIter>::value &&
       std::is_convertible<OtherIter, Iter>::value), int>::type = 0>
-  /* implicit */ Range(const Range<OtherIter>& other)
+  constexpr /* implicit */ Range(const Range<OtherIter>& other)
     : b_(other.begin()),
       e_(other.end()) {
   }
@@ -302,7 +302,7 @@ public:
     (!std::is_same<Iter, OtherIter>::value &&
      !std::is_convertible<OtherIter, Iter>::value &&
      std::is_constructible<Iter, const OtherIter&>::value), int>::type = 0>
-  explicit Range(const Range<OtherIter>& other)
+  constexpr explicit Range(const Range<OtherIter>& other)
     : b_(other.begin()),
       e_(other.end()) {
   }
@@ -803,7 +803,8 @@ typedef Range<char*> MutableStringPiece;
 typedef Range<const unsigned char*> ByteRange;
 typedef Range<unsigned char*> MutableByteRange;
 
-std::ostream& operator<<(std::ostream& os, const StringPiece& piece);
+std::ostream& operator<<(std::ostream& os, const StringPiece piece);
+std::ostream& operator<<(std::ostream& os, const MutableStringPiece piece);
 
 /**
  * Templated comparison operators
@@ -890,7 +891,7 @@ operator>=(const T& lhs, const U& rhs) {
 }
 
 struct StringPieceHash {
-  std::size_t operator()(const StringPiece& str) const {
+  std::size_t operator()(const StringPiece str) const {
     return static_cast<std::size_t>(str.hash());
   }
 };
@@ -956,15 +957,15 @@ size_t qfind(const Range<T>& haystack,
 
 namespace detail {
 
-size_t qfind_first_byte_of_nosse(const StringPiece& haystack,
-                                 const StringPiece& needles);
+size_t qfind_first_byte_of_nosse(const StringPiece haystack,
+                                 const StringPiece needles);
 
 #if FOLLY_HAVE_EMMINTRIN_H && __GNUC_PREREQ(4, 6)
-size_t qfind_first_byte_of_sse42(const StringPiece& haystack,
-                                 const StringPiece& needles);
+size_t qfind_first_byte_of_sse42(const StringPiece haystack,
+                                 const StringPiece needles);
 
-inline size_t qfind_first_byte_of(const StringPiece& haystack,
-                                  const StringPiece& needles) {
+inline size_t qfind_first_byte_of(const StringPiece haystack,
+                                  const StringPiece needles) {
   static auto const qfind_first_byte_of_fn =
     folly::CpuId().sse42() ? qfind_first_byte_of_sse42
                            : qfind_first_byte_of_nosse;
@@ -972,8 +973,8 @@ inline size_t qfind_first_byte_of(const StringPiece& haystack,
 }
 
 #else
-inline size_t qfind_first_byte_of(const StringPiece& haystack,
-                                  const StringPiece& needles) {
+inline size_t qfind_first_byte_of(const StringPiece haystack,
+                                  const StringPiece needles) {
   return qfind_first_byte_of_nosse(haystack, needles);
 }
 #endif // FOLLY_HAVE_EMMINTRIN_H