Skip to content

Commit d0d4c59

Browse files
Abseil Teamcopybara-github
authored andcommitted
Deprecate and inline some historical inline variables in Abseil
PiperOrigin-RevId: 911711219 Change-Id: Icf6fa5f06d4c9f251d1f4139f942182c078db743
1 parent 9517566 commit d0d4c59

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

absl/types/variant.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,17 @@ template <size_t I, typename T>
5656
using variant_alternative_t ABSL_REFACTOR_INLINE
5757
= std::variant_alternative_t<I, T>;
5858

59-
using std::variant_npos;
59+
inline constexpr size_t variant_npos ABSL_REFACTOR_INLINE
60+
= std::variant_npos;
6061

6162
template <typename T>
6263
using variant_size ABSL_REFACTOR_INLINE
6364
= std::variant_size<T>;
6465

65-
using std::variant_size_v;
66+
template <typename T>
67+
inline constexpr size_t variant_size_v ABSL_REFACTOR_INLINE
68+
= std::variant_size_v<T>;
69+
6670
using std::visit;
6771

6872
namespace variant_internal {

absl/utility/utility.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,22 @@ ABSL_NAMESPACE_BEGIN
3838
using std::apply;
3939
using std::exchange;
4040
using std::forward;
41-
using std::in_place;
42-
using std::in_place_index;
41+
42+
inline constexpr const std::in_place_t& in_place ABSL_DEPRECATE_AND_INLINE() =
43+
std::in_place;
44+
45+
template <size_t I>
46+
inline constexpr const std::in_place_index_t<I>& in_place_index
47+
ABSL_DEPRECATE_AND_INLINE() = std::in_place_index<I>;
4348

4449
template <size_t I>
4550
using in_place_index_t ABSL_DEPRECATE_AND_INLINE() = std::in_place_index_t<I>;
4651

4752
using in_place_t ABSL_DEPRECATE_AND_INLINE() = std::in_place_t;
4853

49-
using std::in_place_type;
54+
template <class T>
55+
inline constexpr const std::in_place_type_t<T>& in_place_type
56+
ABSL_DEPRECATE_AND_INLINE() = std::in_place_type<T>;
5057

5158
template <class T>
5259
using in_place_type_t ABSL_DEPRECATE_AND_INLINE() = std::in_place_type_t<T>;

0 commit comments

Comments
 (0)