Skip to content

Examples Overview

The arrp repository includes runnable, standalone example applications located in the examples/ directory. These examples demonstrate how to integrate arrp::resource_pool<T> and arrp::resource_guard<T> into C++ applications for managing various resource types.


Available Examples

Scoped File Example

Demonstrates wrapping standard C FILE* handles inside a move-only RAII class (ScopedFile) and managing file handles using a seeded arrp::resource_pool.

Scoped cURL Example

Demonstrates thread-safe asynchronous HTTP request handling with libcurl (CURL*), dynamic on-demand resource creation via try_borrow_create() with timeouts, and JSON statistics diagnostics.


Example Repository Directory

You can explore the source code for all examples directly in the repository:


Building the Examples

Each example project contains its own CMakeLists.txt and CMakePresets.json, allowing them to be built independently or as part of the overall workspace.

Building scoped_file

cd examples/scoped_file
cmake --fresh --preset=Apple-Debug
cmake --build --preset=Apple-Debug
./build/Apple-Debug/scoped_file

Building scoped_curl

Note: Building scoped_curl requires libcurl development headers installed on your system.

cd examples/scoped_curl
cmake --fresh --preset=Apple-Debug
cmake --build --preset=Apple-Debug
./build/Apple-Debug/scoped_curl