Opened 10 years ago

Closed 10 years ago

#7722 closed Bugs (fixed)

smart_ptr includes <new> even if not needed

Reported by: romuloceccon@… Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

I'm using a subset of Boost in a project compiled with armcc and custom libraries. It's for an embedded system. As expected the compiler and/or libraries are broken, but I was able to workaround almost all problems with the macros BOOST_NO_RTTI, BOOST_EXCEPTION_DISABLE etc.

However, the compiler still complains about the missing header <new> (not included in the library), because it's included by smart_ptr/detail/shared_count.hpp to have std::bad_alloc declared.

But since std::bad_alloc is used only when BOOST_NO_EXCEPTIONS is defined (I'm not defining it) it's not always really needed. I attached a patch which alleviates the problem for those of us dealing with broken compilers and brings (I believe) no side effect for the rest of the community.

Attachments (1)

shared_count.patch (616 bytes ) - added by romuloceccon@… 10 years ago.

Download all attachments as: .zip

Change History (4)

by romuloceccon@…, 10 years ago

Attachment: shared_count.patch added

comment:1 by Peter Dimov, 10 years ago

(In [81488]) Apply patch from #7722. Refs #7722.

comment:2 by Peter Dimov, 10 years ago

It seems to me that you could also create an empty <new> header instead of fixing all includes of it, but the patch doesn't hurt, so I applied it.

comment:3 by Peter Dimov, 10 years ago

Resolution: fixed
Status: newclosed

(In [81714]) Merged revision(s) 81488 from trunk: Apply patch from #7722. Fixes #7722.

Note: See TracTickets for help on using tickets.