Opened 13 years ago

Closed 12 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:

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

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

Download all attachments as: .zip

Change History (7)

by Kazutoshi Satoda <k_satoda@…>, 13 years ago

svn diff for trunk r60445

comment:1 by Eric Niebler, 12 years ago

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

Resolution: fixed
Status: assignedclosed

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

comment:3 by Kazutoshi Satoda <k_satoda@…>, 12 years ago

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

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

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

Resolution: wontfix
Status: reopenedclosed
Note: See TracTickets for help on using tickets.