@@ -244,12 +244,12 @@ protected:
244244 friend struct variant_size<variant_base>;
245245
246246 constexpr void reset() {
247- if (discriminator != npos) {
247+ if (_impl_discriminator != npos) {
248248 _visit_impl::visit_at<void>(
249- discriminator ,
249+ _impl_discriminator ,
250250 [](auto&& member) { std::destroy_at(std::addressof(member)); },
251251 *this);
252- discriminator = npos;
252+ _impl_discriminator = npos;
253253 }
254254 }
255255
@@ -280,7 +280,7 @@ protected:
280280 std::construct_at(&lhs, idx, std::forward<T>(rhs_alternative));
281281 },
282282 std::forward<V>(rhs));
283- lhs.discriminator = index_type(rhs_index);
283+ lhs._impl_discriminator = index_type(rhs_index);
284284 }
285285
286286public:
@@ -292,13 +292,11 @@ public:
292292 using index_type = std::conditional_t<(alternatives.count >= 255), unsigned short, unsigned char>;
293293 static constexpr auto npos = index_type(-1ULL);
294294
295- protected:
296295 union {
297- Storage storage ;
296+ Storage _impl_storage ;
298297 };
299- index_type discriminator = npos;
298+ index_type _impl_discriminator = npos;
300299
301- public:
302300 // default constructor, only if alternative #0 is default constructible
303301 constexpr variant_base() //
304302 noexcept(is_nothrow_default_constructible_type(alternatives.types[0])) // [variant.ctor]/5
@@ -364,11 +362,11 @@ public:
364362 template <std::size_t Idx, typename... Args>
365363 constexpr explicit variant_base(std::in_place_index_t<Idx>, Args&&... args) //
366364 noexcept(is_nothrow_constructible_type(alternatives.types[Idx], {^^Args...}))
367- : discriminator (Idx) {
365+ : _impl_discriminator (Idx) {
368366 // Primary constructor
369367
370- std::construct_at(&storage , '\0');
371- std::construct_at(alternatives.template get_addr<Idx>(storage ), std::forward<Args>(args)...);
368+ std::construct_at(&_impl_storage , '\0');
369+ std::construct_at(alternatives.template get_addr<Idx>(_impl_storage ), std::forward<Args>(args)...);
372370 }
373371
374372 template <std::size_t Idx, typename U, typename... Args>
@@ -377,11 +375,11 @@ public:
377375 Args&&... args) //
378376 noexcept(std::is_nothrow_constructible_v< //
379377 typename[:alternatives.types[Idx]:], std::initializer_list<U>&, Args...>)
380- : discriminator (Idx) {
378+ : _impl_discriminator (Idx) {
381379 // Primary constructor
382380
383- std::construct_at(&storage , '\0');
384- std::construct_at(alternatives.template get_addr<Idx>(storage ),
381+ std::construct_at(&_impl_storage , '\0');
382+ std::construct_at(alternatives.template get_addr<Idx>(_impl_storage ),
385383 init_list,
386384 std::forward<Args>(args)...);
387385 }
@@ -429,11 +427,11 @@ public:
429427 = default;
430428 constexpr ~variant_base() { reset(); }
431429 [[nodiscard]] constexpr bool valueless_by_exception() const noexcept {
432- return discriminator == npos;
430+ return _impl_discriminator == npos;
433431 }
434432 [[nodiscard]] constexpr std::size_t index() const noexcept {
435- if (discriminator != npos) {
436- return discriminator ;
433+ if (_impl_discriminator != npos) {
434+ return _impl_discriminator ;
437435 }
438436 return variant_npos;
439437 }
@@ -443,8 +441,8 @@ public:
443441 static_assert(Idx < alternatives.count, "Alternative index out of bounds");
444442
445443 reset();
446- std::construct_at(alternatives.template get_addr<Idx>(storage ), std::forward<Args>(args)...);
447- discriminator = Idx;
444+ std::construct_at(alternatives.template get_addr<Idx>(_impl_storage ), std::forward<Args>(args)...);
445+ _impl_discriminator = Idx;
448446 }
449447
450448 template <typename T, typename... Args>
@@ -456,7 +454,7 @@ public:
456454 template <std::size_t Idx, typename Self>
457455 constexpr decltype(auto) get_alt(this Self&& self) {
458456 static_assert(Idx < alternatives.count, "Alternative index out of bounds");
459- return alternatives.template get<Idx>(std::forward<Self>(self).storage );
457+ return alternatives.template get<Idx>(std::forward<Self>(self)._impl_storage );
460458 }
461459
462460 template <std::size_t Idx, typename Self>
@@ -929,10 +927,10 @@ public:
929927
930928 using tags = E;
931929
932- storage_type* operator->() { return &this->storage ; }
933- storage_type const* operator->() const { return &this->storage ; }
934- storage_type* operator*() { return &this->storage ; }
935- storage_type const* operator*() const { return &this->storage ; }
930+ storage_type* operator->() { return &this->_impl_storage ; }
931+ storage_type const* operator->() const { return &this->_impl_storage ; }
932+ storage_type* operator*() { return &this->_impl_storage ; }
933+ storage_type const* operator*() const { return &this->_impl_storage ; }
936934
937935 explicit(false) operator E() const { return _tagged_variant_impl::transitions<E>[this->index()]; }
938936
0 commit comments