about summary refs log tree commit diff
path: root/absl/flags/internal/flag.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/flags/internal/flag.h')
-rw-r--r--absl/flags/internal/flag.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/absl/flags/internal/flag.h b/absl/flags/internal/flag.h
index 20de406f4615..21a10c7f85f8 100644
--- a/absl/flags/internal/flag.h
+++ b/absl/flags/internal/flag.h
@@ -416,6 +416,20 @@ T* MakeFromDefaultValue(EmptyBraces) {
   return new T;
 }
 
+// MakeFromDefaultValueOrEmpty is basically the same as MakeFromDefaultValue. It
+// also allows for empty macro parameter (hence no argument), which was somehow
+// widely used for ABSL_RETIRED_FLAG().
+
+template <typename T>
+T* MakeFromDefaultValueOrEmpty(T t) {
+  return MakeFromDefaultValue(std::move(t));
+}
+
+template <typename T>
+T* MakeFromDefaultValueOrEmpty() {
+  return MakeFromDefaultValue<T>(EmptyBraces());
+}
+
 }  // namespace flags_internal
 ABSL_NAMESPACE_END
 }  // namespace absl