Export of internal Abseil changes
-- 2aa4544070113a4943f93464df74759f043bab92 by CJ Johnson <johnsoncj@google.com>: Spelling fix in InlinedVector PiperOrigin-RevId: 308241764 -- 0d8a8ff71023df845c490c73811da598a42f12d9 by Todd Jackson <tjackson@google.com>: Fix CMake warnings on absl/types/CMakeLists.txt. PiperOrigin-RevId: 308123331 -- f35fbd79437ba999097b1499770103b7865078e5 by Samuel Benzaquen <sbenza@google.com>: Speed up the integral printer. PiperOrigin-RevId: 308081531 -- b1676b869ed0547e1cca23c83bb370f459bdf2cb by Samuel Benzaquen <sbenza@google.com>: Collapse the template arguments to enums earlier to reduce the number of instantiations of FormatSpecTemplate. This doesn't affect opt builds much, but reduces the bloat in non-opt builds. PiperOrigin-RevId: 308066155 -- edda0c227adad392cfff2af6ed532822c481f013 by Abseil Team <absl-team@google.com>: Minor documentation fix for `absl::Status` CTOR. PiperOrigin-RevId: 308037725 -- 8326b85569f0fdb15632b0076e38baba4c69794b by Derek Mauro <dmauro@google.com>: Internal change PiperOrigin-RevId: 307914168 GitOrigin-RevId: 2aa4544070113a4943f93464df74759f043bab92 Change-Id: I553ce3838c5e35d04954f560dc75ec24033919af
This commit is contained in:
parent
68494aae95
commit
cde2e2410e
8 changed files with 189 additions and 165 deletions
|
|
@ -60,7 +60,7 @@ class UntypedFormatSpecImpl {
|
|||
size_t size_;
|
||||
};
|
||||
|
||||
template <typename T, typename...>
|
||||
template <typename T, FormatConversionCharSet...>
|
||||
struct MakeDependent {
|
||||
using type = T;
|
||||
};
|
||||
|
|
@ -68,7 +68,7 @@ struct MakeDependent {
|
|||
// Implicitly convertible from `const char*`, `string_view`, and the
|
||||
// `ExtendedParsedFormat` type. This abstraction allows all format functions to
|
||||
// operate on any without providing too many overloads.
|
||||
template <typename... Args>
|
||||
template <FormatConversionCharSet... Args>
|
||||
class FormatSpecTemplate
|
||||
: public MakeDependent<UntypedFormatSpec, Args...>::type {
|
||||
using Base = typename MakeDependent<UntypedFormatSpec, Args...>::type;
|
||||
|
|
@ -105,13 +105,11 @@ class FormatSpecTemplate
|
|||
|
||||
// Good format overload.
|
||||
FormatSpecTemplate(const char* s) // NOLINT
|
||||
__attribute__((enable_if(ValidFormatImpl<ArgumentToConv<Args>()...>(s),
|
||||
"bad format trap")))
|
||||
__attribute__((enable_if(ValidFormatImpl<Args...>(s), "bad format trap")))
|
||||
: Base(s) {}
|
||||
|
||||
FormatSpecTemplate(string_view s) // NOLINT
|
||||
__attribute__((enable_if(ValidFormatImpl<ArgumentToConv<Args>()...>(s),
|
||||
"bad format trap")))
|
||||
__attribute__((enable_if(ValidFormatImpl<Args...>(s), "bad format trap")))
|
||||
: Base(s) {}
|
||||
|
||||
#else // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
|
||||
|
|
@ -121,19 +119,14 @@ class FormatSpecTemplate
|
|||
|
||||
#endif // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
|
||||
|
||||
template <Conv... C, typename = typename std::enable_if<
|
||||
AllOf(sizeof...(C) == sizeof...(Args),
|
||||
Contains(ArgumentToConv<Args>(),
|
||||
C)...)>::type>
|
||||
template <Conv... C,
|
||||
typename = typename std::enable_if<
|
||||
AllOf(sizeof...(C) == sizeof...(Args), Contains(Args,
|
||||
C)...)>::type>
|
||||
FormatSpecTemplate(const ExtendedParsedFormat<C...>& pc) // NOLINT
|
||||
: Base(&pc) {}
|
||||
};
|
||||
|
||||
template <typename... Args>
|
||||
struct FormatSpecDeductionBarrier {
|
||||
using type = FormatSpecTemplate<Args...>;
|
||||
};
|
||||
|
||||
class Streamable {
|
||||
public:
|
||||
Streamable(const UntypedFormatSpecImpl& format,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue