From a786997f304745ce3766a82be06dc6a5d0c2f02c Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 14 Oct 2025 04:35:26 +0200 Subject: feat: scl: major refactors and new version of SCL. Signed-off-by: Amlal El Mahrouss --- dev/examples/allocator_system/allocator_system.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'dev/examples/allocator_system') diff --git a/dev/examples/allocator_system/allocator_system.cc b/dev/examples/allocator_system/allocator_system.cc index c3cd689..169cd97 100644 --- a/dev/examples/allocator_system/allocator_system.cc +++ b/dev/examples/allocator_system/allocator_system.cc @@ -8,10 +8,11 @@ #include #include -struct MyClass +class MyClass final { - int a; - std::string b; +public: + int a{}; + std::string b{}; MyClass() : a(0), b("default") { @@ -31,17 +32,19 @@ struct MyClass int main() { - using Alloc = ocl::standard_allocator_type; - Alloc allocator; + scl::standard_allocator_type allocator; // Test 1: claim() + unclaim() std::cout << "=== Test 1: claim/unclaim ===\n"; + MyClass* raw = allocator.claim(); + std::cout << "raw->a = " << raw->a << ", raw->b = " << raw->b << "\n"; allocator.unclaim(raw); // Manual delete // Test 2: construct() → shared_ptr std::cout << "\n=== Test 2: construct (shared_ptr) ===\n"; + auto ptr = allocator.construct(42, "hello"); std::cout << "ptr->a = " << ptr->a << ", ptr->b = " << ptr->b << "\n"; -- cgit v1.2.3