Opened 6 years ago

#12442 new Bugs

container_traits is closed for extension

Reported by: erdem.cilingir@… Owned by: Jeremiah Willcock
Milestone: To Be Determined Component: graph
Version: Boost 1.61.0 Severity: Problem
Keywords: graph, container_traits, container_category Cc: erdem.cilingir@…

Description

I was split between filing this as a request to add support for std::deque to boost/pending/container_traits or the current title. Chose the latter. I believe container traits is only used by graph library and I could not see a component for "pending" so filing as a graph ticket.

Summary: The problem is that the definitions for the supported containers and all the functions used for dispatching wrt to the given container are within a single file. So it is not easy/possible to extend it to add support for new containers. Especially for containers within the std namespace where it would be illegal extend into.

Details: When trying to add support for std::deque to be used with adjacency_list, I kept getting compile errors as the compiler would not pick up the definitions for the specialized container traits.

The attached file fails to compile with basically multiple variations of the error message "no matching function for container_category(...)" in the push_dispatch() function:

{

return push_dispatch(c, BOOST_PENDING_FWD_VALUE(T, v), container_category(c));

}

Possible fix: Separate the container_traits to multiple files so that it would be possible to define specializations for other containers using the existing tags. For example for std::deque, existing tags are completely enough to specify. It can be defined by "random_access_container_tag" and "back_insertion_sequence_tag". If the tag definitions would be moved to another header file, then it would be possible to include that to define a new container in terms of the existing tag specifications.

Please see the attached repro.

Attachments (1)

container_traits_issue.cpp (1.6 KB ) - added by anonymous 6 years ago.

Download all attachments as: .zip

Change History (1)

by anonymous, 6 years ago

Attachment: container_traits_issue.cpp added
Note: See TracTickets for help on using tickets.