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

Minimal support for boost::type_erasure::any. #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

redboltz
Copy link
Contributor

@redboltz redboltz commented Aug 6, 2019

Just print the address of actual data.

You can get outputs as follows:

(gdb) p multi_index_container
$1 = boost::type_erasure::any<...> data = 0x555555571f10

If you know the acutual type, then you can cast as follows:

(gdb) p *(ActualType)0x555555571f10

Just print the address of actual data.

You can get outputs as follows:

```
(gdb) p multi_index_container
$1 = boost::type_erasure::any<...> data = 0x555555571f10
```

If you know the acutual type, then you can cast as follows:

```
(gdb) p *(ActualType)0x555555571f10
```
@redboltz
Copy link
Contributor Author

redboltz commented Aug 6, 2019

When I use boost::type_erasure::any<...>, especially as the member of the container, I got annoying outputs as follows:

boost::type_erasure::any_constructor_control<boost::type_erasure::any_constructor_impl<boost::mpl::vector<boost::type_erasure::copy_constructible<boost::type_erasure::_self>, has_foo<void () const, boost::type_erasure::_self>, has_get<int () const, boost::type_erasure::_self>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::type_erasure::_self>, void>> = {
    <boost::type_erasure::any_constructor_impl<boost::mpl::vector<boost::type_erasure::copy_constructible<boost::type_erasure::_self>, has_foo<void () const, boost::type_erasure::_self>, has_get<int () const, boost::type_erasure::_self>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::type_erasure::_self

This PR suppress the annoying outputs and print the address of the data that is owned by boost::type_erasure::any<...>.

User can cast the address as the actual type. Gdb can't get the actual type because type is erased. So user needs to do try and error the possible types. I think that it is good enough.

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.

1 participant