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

Custom container leads to "invalid use of incomplete type" for "struct boost::container::dtl::container_rebind" #250

Open
adambadura opened this issue Jun 19, 2023 · 0 comments

Comments

@adambadura
Copy link

In our project we have custom container (let's call it CustomContainer) that doesn't match boost::container::dtl::container_rebind specializations in the include/boost/container/detail/container_rebind.hpp file.

Such a container is used in flat_map the following way:

template<typename T, std::size_t size>
class CustomContainer;

constexpr std::uint8_t size{...};
using FlatMapType = boost::container::flat_map<
    KeyType,
    MappedType,
    std::less<>,
    CustomContainer<std::pair<KeyType, MappedType>, size>>;

And with GCC 10.2 and Boost 1.79 we are getting compilation errors:

{prefix}/usr/include/boost/container/detail/container_or_allocator_rebind.hpp:30:8: error: invalid use of incomplete type 'struct boost::container::dtl::container_rebind<CustomContainer<std::pair<KeyType, MappedType>, {size}>>, boost::container::dtl::pair<KeyType, MappedType> >'
   30 | struct container_or_allocator_rebind_impl
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I have reproduced the same on Compiler Explorer: https://godbolt.org/z/eGTsYer6r. It seems to apply still in Boost 1.82 as well.

My guess would be we need to provide container_rebind specialization for our container. It does seem to work.

However, container_rebind is not documented as an extension point. Furthermore, it is introduced by a header in detail/ subdirectory, making it even more uneasy to tweak with it in the user code.

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

No branches or pull requests

1 participant