summaryrefslogtreecommitdiffhomepage
path: root/examples/allocator_system
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-29 14:53:01 -0500
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-29 14:54:13 -0500
commita8e99f3a783069cf85b626c6cfb2fbe83ae4fd44 (patch)
tree8322b0d20dd02660c3f26fcfd37c2cc4dcd33cda /examples/allocator_system
parent463a0c01f96d86c9c91f02903bc1d194c5e55b15 (diff)
chore: new version of OCL and codebase cleanup.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'examples/allocator_system')
-rw-r--r--examples/allocator_system/CMakeLists.txt16
-rw-r--r--examples/allocator_system/allocator_system.cc53
2 files changed, 0 insertions, 69 deletions
diff --git a/examples/allocator_system/CMakeLists.txt b/examples/allocator_system/CMakeLists.txt
deleted file mode 100644
index a4bb69d..0000000
--- a/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 ../../include/ocl)
diff --git a/examples/allocator_system/allocator_system.cc b/examples/allocator_system/allocator_system.cc
deleted file mode 100644
index fd7ae56..0000000
--- a/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 <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";
-}