From 7efd8dc0f1075356e9c7caa950afd1ecf854e8b9 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 26 Jun 2018 10:45:35 -0700 Subject: Export of internal Abseil changes. -- 6bab63b2bcdbd768743c2ebcc4a8e19af20c5406 by Abseil Team : Reformats inlined_vector.h to match the current Google lint rules PiperOrigin-RevId: 202154101 -- 00cdeda6ea24591a9cb8ac8b3c2e2a042e1b15b1 by Gennadiy Rozental : Improve SplitterIsConvertibleTo implementation. PiperOrigin-RevId: 202095009 -- 7c24071afac45a17c47e819896f844a36e239bda by Greg Falcon : Internal change PiperOrigin-RevId: 201991288 GitOrigin-RevId: 6bab63b2bcdbd768743c2ebcc4a8e19af20c5406 Change-Id: Ic5a988ab39e78247285411f36287cd34d6f5afd3 --- absl/strings/internal/str_split_internal.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'absl/strings/internal') diff --git a/absl/strings/internal/str_split_internal.h b/absl/strings/internal/str_split_internal.h index a1b10f3..9cf0833 100644 --- a/absl/strings/internal/str_split_internal.h +++ b/absl/strings/internal/str_split_internal.h @@ -228,14 +228,31 @@ struct IsInitializerList // compiled in C++11 will get an error due to ambiguous conversion paths (in // C++11 std::vector::operator= is overloaded to take either a std::vector // or an std::initializer_list). + +template +struct SplitterIsConvertibleToImpl : std::false_type {}; + +template +struct SplitterIsConvertibleToImpl + : std::is_constructible {}; + +template +struct SplitterIsConvertibleToImpl + : absl::conjunction< + std::is_constructible, + std::is_constructible> {}; + template struct SplitterIsConvertibleTo - : std::enable_if< + : SplitterIsConvertibleToImpl< + C, #ifdef _GLIBCXX_DEBUG !IsStrictlyBaseOfAndConvertibleToSTLContainer::value && #endif // _GLIBCXX_DEBUG - !IsInitializerList::value && HasValueType::value && - HasConstIterator::value> { + !IsInitializerList< + typename std::remove_reference::type>::value && + HasValueType::value && HasConstIterator::value, + HasMappedType::value> { }; // This class implements the range that is returned by absl::StrSplit(). This @@ -281,7 +298,8 @@ class Splitter { // An implicit conversion operator that is restricted to only those containers // that the splitter is convertible to. template ::type> + typename = typename std::enable_if< + SplitterIsConvertibleTo::value>::type> operator Container() const { // NOLINT(runtime/explicit) return ConvertToContainer::value>()(*this); -- cgit v1.2.3