From b029c308f97b6e3418738eb55905f88bdbe7745b Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 1 Apr 2024 19:44:21 +0200 Subject: [PATCH] Library: sharpen detection of string conversion cases the metafunction `is_basically` performed only an equality match, while, given it's current usage, it should also include a subtype-interface-match. This changes especially the `is_StringLike` metafunction, both on const references and on classes built on top of string or string_view. --- src/lib/meta/trait.hpp | 9 ++++++++- tests/15library.tests | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/lib/meta/trait.hpp b/src/lib/meta/trait.hpp index a4f341e7a..e15d8a2ae 100644 --- a/src/lib/meta/trait.hpp +++ b/src/lib/meta/trait.hpp @@ -308,7 +308,7 @@ namespace meta { /** compare unadorned types, disregarding const and references */ template - struct is_basically + struct is_basicallySame : is_same ::TypeReferred ,typename Strip::TypeReferred> { }; @@ -323,6 +323,13 @@ namespace meta { , is_same > { }; + + /** compare for unadorned base type, disregarding const and references */ + template + struct is_basically + : is_Subclass ::TypeReferred + ,typename Strip::TypeReferred> + { }; /** verify the first (special) type can stand-in for the second */ template diff --git a/tests/15library.tests b/tests/15library.tests index 87b191763..afdeba960 100644 --- a/tests/15library.tests +++ b/tests/15library.tests @@ -251,13 +251,13 @@ out-lit: can_lexical2string : Yes out-lit: can_convertToString : Yes out-lit: use_StringConversion4Stream : No out-lit: Type: StrConstRef ...... -out-lit: is_StringLike : No -out-lit: BasicallyString : No +out-lit: is_StringLike : Yes +out-lit: BasicallyString : Yes out-lit: BasicallyCString : No out-lit: std::is_arithmetic : No -out-lit: can_lexical2string : No +out-lit: can_lexical2string : Yes out-lit: can_convertToString : Yes -out-lit: use_StringConversion4Stream : Yes +out-lit: use_StringConversion4Stream : No out-lit: Type: CharLit ...... out-lit: is_StringLike : Yes out-lit: BasicallyString : No