In modern C++, function signatures communicate ownership intent. A function that takes ownership of a resource must make that intent explicit in its parameter type.
You are given a program where a buffer is managed by std::unique_ptr. The buffer must be consumed by a function, meaning ownership transfers to the function and the caller must no longer own it.
Your task is to fix the function API and the call site so that ownership transfer is explicit and correct.
This problem is about API design, not mechanics.
Program Flow:
Read N
Create a unique_ptr that owns a buffer of N bytes
Call a function that consumes the buffer
The function prints the buffer
After the call, the caller must have no ownership
Example Input:
4
10 20 30 40
Example Output:
10 20 30 40
No data
Constraints:
N ranges from 1 to 100
Ownership must be transferred to the function
The function must clearly express ownership transfer in its signature