mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Deprecate and inline historical functions in Abseil
PiperOrigin-RevId: 916125223 Change-Id: I79a4bb099685ef9119718f5ab468fdb2aff21ed0
This commit is contained in:
committed by
Copybara-Service
parent
07389c2182
commit
a20313e890
@@ -23,6 +23,7 @@
|
||||
#ifndef ABSL_TYPES_OPTIONAL_H_
|
||||
#define ABSL_TYPES_OPTIONAL_H_
|
||||
|
||||
#include <initializer_list>
|
||||
#include <optional>
|
||||
|
||||
#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 <typename T>
|
||||
ABSL_REFACTOR_INLINE constexpr decltype(std::make_optional(
|
||||
std::declval<T>())) make_optional(T&& value) {
|
||||
return std::make_optional(std::forward<T>(value));
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
constexpr decltype(std::make_optional<T>(
|
||||
std::declval<Args>()...)) make_optional(Args&&... args) {
|
||||
return std::make_optional<T>(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename T, typename U, typename... Args>
|
||||
constexpr decltype(std::make_optional<T>(
|
||||
std::declval<std::initializer_list<U>>(),
|
||||
std::declval<Args>()...)) make_optional(std::initializer_list<U> il,
|
||||
Args&&... args) {
|
||||
return std::make_optional<T>(il, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
using std::nullopt;
|
||||
|
||||
using nullopt_t ABSL_REFACTOR_INLINE
|
||||
|
||||
@@ -112,7 +112,19 @@ template <class T, T N>
|
||||
using make_integer_sequence ABSL_DEPRECATE_AND_INLINE() =
|
||||
std::make_integer_sequence<T, N>;
|
||||
|
||||
using std::move;
|
||||
template <class It, class OutIt>
|
||||
[[deprecated("Use std::move instead.")]]
|
||||
constexpr OutIt move(It&& begin, It&& end, OutIt&& output) {
|
||||
return std::move(std::forward<It>(begin), std::forward<It>(end),
|
||||
std::forward<OutIt>(output));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
[[deprecated("Use std::move instead.")]]
|
||||
[[nodiscard]] constexpr std::remove_reference_t<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
|
||||
|
||||
Reference in New Issue
Block a user