Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Situation shared_ptr in embedded systems

Open
#116 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
embedded-iot

Research direction

Start by reviewing the proof of concept in https://github.com/jplcz/smart_ptr/pull/1/files and compare its proposed nothrow constructors, try-prefixed functions, and try_reset behavior with the smart_ptr module. Done would mean a maintainer-approved design and corresponding library changes that support failure handling without exception-based APIs.

Written by the indexing model from the issue text.

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 ?

Dominant language
C++
Stars
111
Forks
116
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/smart_ptr

All issues in boostorg/smart_ptr

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.