Situation shared_ptr in embedded systems
- Dominant language
- C++
- Stars
- 111
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Description
I have created Proof of Concept inside https://github.com/jplcz/smart_ptr/pull/1/files
General idea is to allow "nothrow" allocation of shared_ptr class of objects from smart_ptr library, however without need to go through expensive exception handling code, which can be ofter either disabled or it's usage available only in certain scopes (e.g. kernel mode code).
In such cases, developers may want to simply handle errors instead of crashing entire thread.
I have also added ``BOOST_SP_EMBEDDED`` ifdefs, which allow developer to disable any APIs which may throw. Currently it requires using ``sp_nothrow_tag`` to constructors. Plain functions get ``try`` prefix, such as ``try_make_unique`` or ``try_make_shared``. If anything fails, they simply return empty smart pointer. Another method is ``reset``, which now becomes ``try_reset`` - instead of leaving object in "partial" state, it doesn't modify the object if memory allocated would fail.
Are there any plans to introduce such feature in the library ?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.