merge(3p/absl): subtree merge of Abseil up to e19260f
... notably, this includes Abseil's own StatusOr type, which conflicted with our implementation (that was taken from TensorFlow). Change-Id: Ie7d6764b64055caaeb8dc7b6b9d066291e6b538f
This commit is contained in:
parent
cc27324d02
commit
082c006c04
854 changed files with 11260 additions and 5296 deletions
33
third_party/abseil_cpp/absl/flags/flag.h
vendored
33
third_party/abseil_cpp/absl/flags/flag.h
vendored
|
|
@ -144,11 +144,17 @@ class Flag {
|
|||
inline bool IsOfType() const {
|
||||
return GetImpl().template IsOfType<U>();
|
||||
}
|
||||
T Get() const { return GetImpl().Get(); }
|
||||
void Set(const T& v) { GetImpl().Set(v); }
|
||||
T Get() const {
|
||||
return flags_internal::FlagImplPeer::InvokeGet<T>(GetImpl());
|
||||
}
|
||||
void Set(const T& v) {
|
||||
flags_internal::FlagImplPeer::InvokeSet(GetImpl(), v);
|
||||
}
|
||||
void InvokeCallback() { GetImpl().InvokeCallback(); }
|
||||
|
||||
const CommandLineFlag& Reflect() const { return GetImpl().Reflect(); }
|
||||
const CommandLineFlag& Reflect() const {
|
||||
return flags_internal::FlagImplPeer::InvokeReflect(GetImpl());
|
||||
}
|
||||
|
||||
// The data members are logically private, but they need to be public for
|
||||
// this to be an aggregate type.
|
||||
|
|
@ -180,7 +186,7 @@ class Flag {
|
|||
// std::string first_name = absl::GetFlag(FLAGS_firstname);
|
||||
template <typename T>
|
||||
ABSL_MUST_USE_RESULT T GetFlag(const absl::Flag<T>& flag) {
|
||||
return flag.Get();
|
||||
return flags_internal::FlagImplPeer::InvokeGet<T>(flag);
|
||||
}
|
||||
|
||||
// SetFlag()
|
||||
|
|
@ -192,7 +198,7 @@ ABSL_MUST_USE_RESULT T GetFlag(const absl::Flag<T>& flag) {
|
|||
// but especially within performance-critical code.
|
||||
template <typename T>
|
||||
void SetFlag(absl::Flag<T>* flag, const T& v) {
|
||||
flag->Set(v);
|
||||
flags_internal::FlagImplPeer::InvokeSet(*flag, v);
|
||||
}
|
||||
|
||||
// Overload of `SetFlag()` to allow callers to pass in a value that is
|
||||
|
|
@ -201,7 +207,7 @@ void SetFlag(absl::Flag<T>* flag, const T& v) {
|
|||
template <typename T, typename V>
|
||||
void SetFlag(absl::Flag<T>* flag, const V& v) {
|
||||
T value(v);
|
||||
flag->Set(value);
|
||||
flags_internal::FlagImplPeer::InvokeSet(*flag, value);
|
||||
}
|
||||
|
||||
// GetFlagReflectionHandle()
|
||||
|
|
@ -216,7 +222,7 @@ void SetFlag(absl::Flag<T>* flag, const V& v) {
|
|||
|
||||
template <typename T>
|
||||
const CommandLineFlag& GetFlagReflectionHandle(const absl::Flag<T>& f) {
|
||||
return f.Reflect();
|
||||
return flags_internal::FlagImplPeer::InvokeReflect(f);
|
||||
}
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
|
|
@ -379,11 +385,12 @@ ABSL_NAMESPACE_END
|
|||
//
|
||||
// `default_value` is only used as a double check on the type. `explanation` is
|
||||
// unused.
|
||||
// TODO(rogeeff): Return an anonymous struct instead of bool, and place it into
|
||||
// the unnamed namespace.
|
||||
#define ABSL_RETIRED_FLAG(type, flagname, default_value, explanation) \
|
||||
ABSL_ATTRIBUTE_UNUSED static const bool ignored_##flagname = \
|
||||
([] { return type(default_value); }, \
|
||||
absl::flags_internal::RetiredFlag<type>(#flagname))
|
||||
// TODO(rogeeff): replace RETIRED_FLAGS with FLAGS once forward declarations of
|
||||
// retired flags are cleaned up.
|
||||
#define ABSL_RETIRED_FLAG(type, name, default_value, explanation) \
|
||||
static absl::flags_internal::RetiredFlag<type> RETIRED_FLAGS_##name; \
|
||||
ABSL_ATTRIBUTE_UNUSED static const auto RETIRED_FLAGS_REG_##name = \
|
||||
(RETIRED_FLAGS_##name.Retire(#name), \
|
||||
::absl::flags_internal::FlagRegistrarEmpty{})
|
||||
|
||||
#endif // ABSL_FLAGS_FLAG_H_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue