Modify

Ticket #3998 (closed Patches: wontfix)

Opened 4 years ago

Last modified 4 years ago

Provide light weight headers for extensibility features of BOOST_FOREACH

Reported by: Kazutoshi Satoda <k_satoda@…> Owned by: eric_niebler
Milestone: Boost 1.43.0 Component: foreach
Version: Boost 1.42.0 Severity: Optimization
Keywords: is_noncopyable is_lightweight_proxy Cc:

Description

To provide specialization as written in documentation, now users have to include the whole boost/foreach.hpp which is a somewhat heavy header, especially when BOOST_FOREACH is actually not used.

This patch extracts the extensibility interface to two new headers:

  • boost/foreach_extensibility_fwd.hpp: This includes only forward declations used by the extensibility features.
  • boost/foreach_extensibility.hpp: This includes also definition of the extensibility features.

Please take care to use "svn copy" from boost/foreach.hpp to create both two new headers to preserve the history.

Attachments

foreach_separate_headers_for_extensibility.patch Download (89.1 KB) - added by Kazutoshi Satoda <k_satoda@…> 4 years ago.
svn diff for trunk r60445

Change History

Changed 4 years ago by Kazutoshi Satoda <k_satoda@…>

svn diff for trunk r60445

comment:1 Changed 4 years ago by eric_niebler

  • Status changed from new to assigned

Although I don't see a need to put the implementation of is_lightweight_proxy and is_noncopyable in their own header, putting forward declarations for them in a separate header is a good suggestion.

comment:2 Changed 4 years ago by eric_niebler

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [62661]) add foreach_fwd.hpp for forward declarations of foreach's customization points, fixes #3998

comment:3 Changed 4 years ago by Kazutoshi Satoda <k_satoda@…>

  • Status changed from closed to reopened
  • Resolution fixed deleted

Although I don't see a need to put the implementation of ...

I'm sorry to have forgotten to put a link, but my another patch #3996 (for ptr_container) depends on the separation.

Could you please re-evaluate the separation?

comment:4 Changed 4 years ago by eric_niebler

What exactly is the problem you're experiencing? It's perfectly legal to specialize a template that has only been forward-declared, so the foreach_fwd.hpp should be all you need. If it's not, can you tell me what compiler/version you're using, send me the error message you're getting and code I can use to reproduce the problem? Thanks.

comment:5 Changed 4 years ago by eric_niebler

I looked more closely at your patch for #3996 and see the problem. For every instantiation of reversible_ptr_container, you are instantiating foreach::is_noncopyable to (optionally) inherit from noncopyable. This is the wrong way to do it and will lead to ODR violations when different translation units see different specializations of foreach::is_noncopyable. Instead, define a partial specialization of foreach::is_noncopyable< reversible_ptr_container<...> > as you first suggested.

comment:6 Changed 4 years ago by eric_niebler

  • Status changed from reopened to closed
  • Resolution set to wontfix
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.