eclipse-iceoryx / eclipse-iceoryx/iceoryx
Return user header ptr instead of reference
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 492
- Avg merge
- 18h 57m
- Merged PRs (30d)
- 1
Description
## Brief feature description
The user header pointer should be returned in `Sample`, `Request`, `Response`.
To cite @elBoberido from #1081
I know you want to prevent to use a raw pointer her, but in this case it is error prone to use a reference. Consider the following scenario
```cpp
auto request = whatEverReturnsARequest();
auto reqHeader = request.getResponseHeader();
reqHeader.setFireAndForget();
request.send();
```
Do you spot the error?
We either have to use `std::reference_wrapper` or a similar implementation, maybe even with tracking of all the handed over references.
Currently I would favor to return the raw pointer
### Related to
[#1071 Replace raw pointer with std::reference_wrapper where applicable](https://github.com/eclipse-iceoryx/iceoryx/issues/1071)
Contributor guide
Research direction
Start by locating the C++ definitions and accessors for Sample, Request, and Response, then read the discussion in related issues #1081 and #1071 about references and raw pointers. Confirm how header lifetimes are handled before changing the return types; the work is done when all three APIs consistently return the intended user-header pointer and their existing usage remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100