diff --git a/absl/types/optional.h b/absl/types/optional.h index 96197ab1..c70efb15 100644 --- a/absl/types/optional.h +++ b/absl/types/optional.h @@ -23,6 +23,7 @@ #ifndef ABSL_TYPES_OPTIONAL_H_ #define ABSL_TYPES_OPTIONAL_H_ +#include #include #include "absl/base/config.h" @@ -35,7 +36,26 @@ ABSL_NAMESPACE_BEGIN using bad_optional_access ABSL_REFACTOR_INLINE = std::bad_optional_access; -using std::make_optional; +template +ABSL_REFACTOR_INLINE constexpr decltype(std::make_optional( + std::declval())) make_optional(T&& value) { + return std::make_optional(std::forward(value)); +} + +template +constexpr decltype(std::make_optional( + std::declval()...)) make_optional(Args&&... args) { + return std::make_optional(std::forward(args)...); +} + +template +constexpr decltype(std::make_optional( + std::declval>(), + std::declval()...)) make_optional(std::initializer_list il, + Args&&... args) { + return std::make_optional(il, std::forward(args)...); +} + using std::nullopt; using nullopt_t ABSL_REFACTOR_INLINE diff --git a/absl/utility/utility.h b/absl/utility/utility.h index 1289bba7..dd699d49 100644 --- a/absl/utility/utility.h +++ b/absl/utility/utility.h @@ -112,7 +112,19 @@ template using make_integer_sequence ABSL_DEPRECATE_AND_INLINE() = std::make_integer_sequence; -using std::move; +template +[[deprecated("Use std::move instead.")]] +constexpr OutIt move(It&& begin, It&& end, OutIt&& output) { + return std::move(std::forward(begin), std::forward(end), + std::forward(output)); +} + +template +[[deprecated("Use std::move instead.")]] +[[nodiscard]] constexpr std::remove_reference_t&& +move(T&& arg ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept { + return std::move(arg); // NOLINT(bugprone-move-forwarding-reference) +} #if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L // Backfill for std::nontype_t. An instance of this class can be provided as a