Fix clang issue on NotificationQueue::size
[folly.git] / folly / small_vector.h
index 318fcbfdf7ece46dc425c9ef5abbe484a1d87493..8f7641366581e57521d8d6310a0ec7f702eb65b8 100644 (file)
@@ -23,8 +23,6 @@
 #ifndef FOLLY_SMALL_VECTOR_H_
 #define FOLLY_SMALL_VECTOR_H_
 
-#include <folly/Portability.h>
-
 #include <stdexcept>
 #include <cstdlib>
 #include <type_traits>
 #include <boost/mpl/count.hpp>
 #include <boost/mpl/max.hpp>
 
+#include <folly/FormatTraits.h>
 #include <folly/Malloc.h>
+#include <folly/Portability.h>
 
-#if defined(__GNUC__) && FOLLY_X64
+#if defined(__GNUC__) && (FOLLY_X64 || FOLLY_PPC64)
 # include <folly/SmallLocks.h>
 # define FB_PACK_ATTR FOLLY_PACK_ATTR
 # define FB_PACK_PUSH FOLLY_PACK_PUSH
@@ -883,7 +883,7 @@ private:
       // With iterators that only allow a single pass, we can't really
       // do anything sane here.
       while (first != last) {
-        push_back(*first++);
+        emplace_back(*first++);
       }
       return;
     }
@@ -1058,7 +1058,7 @@ private:
     }
   } FB_PACK_ATTR;
 
-#if FOLLY_X64
+#if (FOLLY_X64 || FOLLY_PPC64)
   typedef unsigned char InlineStorageType[sizeof(value_type) * MaxInline];
 #else
   typedef typename std::aligned_storage<
@@ -1141,7 +1141,17 @@ void swap(small_vector<T,MaxInline,A,B,C>& a,
 
 //////////////////////////////////////////////////////////////////////
 
-}
+namespace detail {
+
+// Format support.
+template <class T, size_t M, class A, class B, class C>
+struct IndexableTraits<small_vector<T, M, A, B, C>>
+  : public IndexableTraitsSeq<small_vector<T, M, A, B, C>> {
+};
+
+}  // namespace detail
+
+}  // namespace folly
 
 #pragma GCC diagnostic pop