about summary refs log tree commit diff
path: root/absl/strings/str_cat.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/strings/str_cat.h')
-rw-r--r--absl/strings/str_cat.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/absl/strings/str_cat.h b/absl/strings/str_cat.h
index cba8ceb024ae..559ee0aa5294 100644
--- a/absl/strings/str_cat.h
+++ b/absl/strings/str_cat.h
@@ -56,6 +56,7 @@
 #include <cstdint>
 #include <string>
 #include <type_traits>
+#include <vector>
 
 #include "absl/base/port.h"
 #include "absl/strings/numbers.h"
@@ -268,6 +269,17 @@ class AlphaNum {
   AlphaNum(T e)  // NOLINT(runtime/explicit)
       : AlphaNum(static_cast<typename std::underlying_type<T>::type>(e)) {}
 
+  // vector<bool>::reference and const_reference require special help to
+  // convert to `AlphaNum` because it requires two user defined conversions.
+  template <
+      typename T,
+      typename std::enable_if<
+          std::is_class<T>::value &&
+          (std::is_same<T, std::vector<bool>::reference>::value ||
+           std::is_same<T, std::vector<bool>::const_reference>::value)>::type* =
+          nullptr>
+  AlphaNum(T e) : AlphaNum(static_cast<bool>(e)) {}  // NOLINT(runtime/explicit)
+
  private:
   absl::string_view piece_;
   char digits_[numbers_internal::kFastToBufferSize];