diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-24 02:13:48 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-24 02:13:48 +0100 |
| commit | 65a8349aa5526d071b18cd4d42586c46faaa3823 (patch) | |
| tree | f6e2063319ceaaa02f523fb5c289e4f37411a2df /dev/examples/allocator_system | |
| parent | df4ec096491ded6d58b9ee094d6942e3188c2d4a (diff) | |
feat! breaking changes for OCL v1.0.48.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/examples/allocator_system')
| -rw-r--r-- | dev/examples/allocator_system/CMakeLists.txt | 16 | ||||
| -rw-r--r-- | dev/examples/allocator_system/allocator_system.cc | 53 |
2 files changed, 0 insertions, 69 deletions
diff --git a/dev/examples/allocator_system/CMakeLists.txt b/dev/examples/allocator_system/CMakeLists.txt deleted file mode 100644 index ee19842..0000000 --- a/dev/examples/allocator_system/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ - -cmake_minimum_required(VERSION 3.15...3.31) - -project( - Alloc - VERSION 1.0 - LANGUAGES CXX) - -find_package(Boost REQUIRED COMPONENTS container) - -add_executable(Alloc allocator_system.cc) - -target_link_libraries(Alloc PRIVATE Boost::container) - -set_property(TARGET Alloc PROPERTY CXX_STANDARD 20) -target_include_directories(Alloc PUBLIC ../../) diff --git a/dev/examples/allocator_system/allocator_system.cc b/dev/examples/allocator_system/allocator_system.cc deleted file mode 100644 index 6bf1de7..0000000 --- a/dev/examples/allocator_system/allocator_system.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * File: allocator_system.cc - * Purpose: Allocator System container. - * Author: Amlal El Mahrouss (amlal@nekernel.org) - * Copyright 2025, Amlal El Mahrouss, Licensed under the Boost Software License. Licensed under the BSL 1.0 license - */ - -#include <lib/memory/allocator_system.hpp> -#include <iostream> - -class MyClass final -{ -public: - int a{}; - std::string b{}; - - MyClass() : a(0), b("default") - { - std::cout << "MyClass() constructed\n"; - } - - MyClass(int x, std::string y) : a(x), b(std::move(y)) - { - std::cout << "MyClass(int, string) constructed\n"; - } - - ~MyClass() - { - std::cout << "~MyClass() destroyed\n"; - } -}; - -int main() -{ - ocl::standard_allocator_type<MyClass> 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<int, std::string>(42, "hello"); - std::cout << "ptr->a = " << ptr->a << ", ptr->b = " << ptr->b << "\n"; - - // `shared_ptr` will automatically delete the object - std::cout << "\n=== End of main ===\n"; -} |
