c10::string_view -> std::string_view in pytorch (#143591)

Test Plan: Sandcastle

Differential Revision: D67312322

Pull Request resolved: https://github.com/pytorch/pytorch/pull/143591
Approved by: https://github.com/malfet
This commit is contained in:
Richard Barnes
2025-01-13 21:44:04 +00:00
committed by PyTorch MergeBot
parent 5129d6ef51
commit 1dab79470d
3 changed files with 7 additions and 1611 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -33,7 +33,7 @@ TEST(TypeMetaTest, Names) {
TypeMeta int_meta = TypeMeta::Make<int>();
EXPECT_EQ("int", int_meta.name());
TypeMeta string_meta = TypeMeta::Make<string>();
EXPECT_TRUE(c10::string_view::npos != string_meta.name().find("string"));
EXPECT_TRUE(std::string_view::npos != string_meta.name().find("string"));
}
TEST(TypeMetaTest, TypeMeta) {
@@ -66,8 +66,8 @@ TEST(TypeMetaTest, TypeMeta) {
EXPECT_EQ(bar_meta.itemsize(), TypeMeta::ItemSize<TypeMetaTestBar>());
EXPECT_EQ(int_meta.name(), "int");
EXPECT_EQ(float_meta.name(), "float");
EXPECT_NE(foo_meta.name().find("TypeMetaTestFoo"), c10::string_view::npos);
EXPECT_NE(bar_meta.name().find("TypeMetaTestBar"), c10::string_view::npos);
EXPECT_NE(foo_meta.name().find("TypeMetaTestFoo"), std::string_view::npos);
EXPECT_NE(bar_meta.name().find("TypeMetaTestBar"), std::string_view::npos);
}
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)

View File

@@ -135,7 +135,7 @@ struct TypeMetaData final {
PlacementDelete* placementDelete,
Delete* deleteFn,
TypeIdentifier id,
c10::string_view name) noexcept
std::string_view name) noexcept
: itemsize_(itemsize),
new_(newFn),
placementNew_(placementNew),
@@ -152,7 +152,7 @@ struct TypeMetaData final {
PlacementDelete* placementDelete_;
Delete* delete_;
TypeIdentifier id_;
c10::string_view name_;
std::string_view name_;
};
// Mechanism for throwing errors which can't be prevented at compile time
@@ -411,7 +411,7 @@ class C10_API TypeMeta final {
/**
* Returns a printable name for the type.
*/
c10::string_view name() const noexcept {
std::string_view name() const noexcept {
return data().name_;
}
@@ -430,7 +430,7 @@ class C10_API TypeMeta final {
}
template <class T>
static c10::string_view TypeName() noexcept {
static std::string_view TypeName() noexcept {
return c10::util::get_fully_qualified_type_name<T>();
}