Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 8, 2022

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Jul 8, 2022

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 henryiii July 8, 2022 01:52
@rwgk rwgk marked this pull request as ready for review July 8, 2022 01:53
@rwgk rwgk merged commit 432bc5c into pybind:master Jul 8, 2022
@rwgk rwgk deleted the clean_type_id_overload branch July 8, 2022 02:08
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jul 8, 2022
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Jul 8, 2022
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 free to 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