Skip to content

Commit a6412b0

Browse files
committed
Mark get_type_index() as deprecated.
See #73.
1 parent 0511b66 commit a6412b0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

test/t/variant.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ TEST_CASE( "variant default constructor", "[variant][default constructor]" ) {
279279
using variant_type = mapbox::util::variant<int, double, std::string>;
280280
REQUIRE(variant_type{}.which() == 0);
281281
REQUIRE(variant_type{}.valid());
282-
REQUIRE(variant_type{mapbox::util::no_init()}.get_type_index() == mapbox::util::detail::invalid_value);
283282
REQUIRE_FALSE(variant_type{mapbox::util::no_init()}.valid());
284283
}
285284

variant.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,9 @@ class variant
782782
}
783783
}
784784

785-
VARIANT_INLINE std::size_t get_type_index() const
785+
// This function is deprecated because it returns an internal index field.
786+
// Use which() instead.
787+
VARIANT_INLINE MAPBOX_VARIANT_DEPRECATED std::size_t get_type_index() const
786788
{
787789
return type_index;
788790
}

0 commit comments

Comments
 (0)