Opened 8 years ago

Closed 7 years ago

#3998 closed Patches (wontfix)

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:


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 (1)

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

Download all attachments as: .zip

Change History (7)

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

svn diff for trunk r60445

comment:1 Changed 7 years ago by Eric Niebler

Status: newassigned

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 7 years ago by Eric Niebler

Resolution: fixed
Status: assignedclosed

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

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

Resolution: fixed
Status: closedreopened

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 7 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 7 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 7 years ago by Eric Niebler

Resolution: wontfix
Status: reopenedclosed

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Eric Niebler.
The resolution will be deleted.

Add Comment

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

Note: See TracTickets for help on using tickets.