Prevent compiler warning about mixing enumeral and non-enumeral types in ternary...
authorJon Maltiel Swenson <jmswen@fb.com>
Wed, 24 Aug 2016 16:35:48 +0000 (09:35 -0700)
committerFacebook Github Bot 2 <facebook-github-bot-2-bot@fb.com>
Wed, 24 Aug 2016 16:38:39 +0000 (09:38 -0700)
Summary:
The GCC warning "warning: enumeral and non-enumeral type in conditional expression"
is logged a lot in many builds since lots of code depends on small_vector.  This diff
should prevent those warnings.

Reviewed By: yfeldblum

Differential Revision: D3762835

fbshipit-source-id: 49831e4364e716592287c05d1dbf1912326324f6

folly/small_vector.h

index 3da912d2bd15a97aff553d43227ce463ccaf5e65..c1d6cd5f27ceec1e09a3719a28711e10efaa6a68 100644 (file)
@@ -345,12 +345,10 @@ class small_vector
    * the user asks for less inlined elements than we can fit unioned
    * into our value_type*, we will inline more than they asked.)
    */
-  enum {
-    MaxInline =
-        constexpr_max(sizeof(Value*) / sizeof(Value), RequestedMaxInline),
-  };
+  static constexpr std::size_t MaxInline{
+      constexpr_max(sizeof(Value*) / sizeof(Value), RequestedMaxInline)};
 
-public:
+ public:
   typedef std::size_t        size_type;
   typedef Value              value_type;
   typedef value_type&        reference;