Skip to content

Add std::string clean_type_id(const char *typeid_name) overload. - #4049

Merged
rwgk merged 1 commit into
pybind:masterfrom
rwgk:clean_type_id_overload
Jul 8, 2022
Merged

Add std::string clean_type_id(const char *typeid_name) overload.#4049
rwgk merged 1 commit into
pybind:masterfrom
rwgk:clean_type_id_overload

Conversation

@rwgk

@rwgkrwgk commented Jul 8, 2022

Copy link
Copy Markdown
Collaborator

Description

Add std::string clean_type_id(const char *typeid_name) overload (in namespace detail).

Very minor refactoring to ease development and debugging.

Having to declare a local std::string has bugged me many times. Nice to get this little nuisance out of the way.

Extracted from PR #4022, where it is used like this:

 std::fprintf(stdout,
"\nTYPE_CASTER_ODR_GUARD_IMPL %s %s\n",
clean_type_id(intrinsic_type_info.name()).c_str(),
source_file_line_from_sloc.c_str());

Suggested changelog entry:

… namespace detail).
Very minor refactoring to ease development and debugging.
Having to declare a local `std::string` has bugged me many times. Nice to get this little nuisance out of the way.
Extracted from PR pybind#4022, where it is used like this:
```
std::fprintf(stdout,
"\nTYPE_CASTER_ODR_GUARD_IMPL %s %s\n",
clean_type_id(intrinsic_type_info.name()).c_str(),
source_file_line_from_sloc.c_str());
```
@rwgk
rwgk requested review from Skylion007 and henryiiiJuly 8, 2022 01:52
@rwgk
rwgk marked this pull request as ready for review July 8, 2022 01:53
Comment threadinclude/pybind11/detail/typeid.h
@rwgk
rwgk merged commit 432bc5c into pybind:masterJul 8, 2022
@rwgk
rwgk deleted the clean_type_id_overload branch July 8, 2022 02:08
@github-actionsgithub-actionsBot added the needs changelog Possibly needs a changelog entry label Jul 8, 2022
@rwgkrwgk removed the needs changelog Possibly needs a changelog entry label Jul 8, 2022
@rwgkrwgk mentioned this pull request Feb 10, 2023
cielavenir pushed a commit to cielavenir/pybind11 that referenced this pull request Jun 12, 2023
… namespace detail). (pybind#4049)
Very minor refactoring to ease development and debugging.
Having to declare a local `std::string` has bugged me many times. Nice to get this little nuisance out of the way.
Extracted from PR pybind#4022, where it is used like this:
```
std::fprintf(stdout,
"\nTYPE_CASTER_ODR_GUARD_IMPL %s %s\n",
clean_type_id(intrinsic_type_info.name()).c_str(),
source_file_line_from_sloc.c_str());
```
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@rwgk@Skylion007