In embedded and firmware-oriented C++ systems, objects are frequently created inside factory functions and manage multiple dynamically allocated resources internally. Such objects often cannot rely on a default destructor and instead must be cleaned up using a specific cleanup routine to ensure deterministic and correct resource release.
You are given:
Your task is to use std::unique_ptr with a custom deleter so that:
delete or cleanup() are madeProgram Flow:
Nstd::unique_ptr with a custom deleterN integer values and store them in the objectInput:
N (1 ≤ N ≤ 100)N space-separated integers on the next lineNotes:
uint8_t buffersdelete or cleanup()Output:
The exact text:
Object cleaned
Example Input:
3
10 20 30 Example Output:
10 20 30
Object cleaned
Constraints:
1 ≤ N ≤ 100
Input
1 0
Expected Output
0 Object cleaned