Container System 0.1.0
High-performance C++20 type-safe container framework with SIMD-accelerated serialization
Loading...
Searching...
No Matches
async_coroutine_example.cpp File Reference

C++20 coroutine-based async serialization, file I/O, and streaming. More...

#include <iostream>
#include <memory>
#include <vector>
#include <chrono>
#include <thread>
#include <iomanip>
#include <filesystem>
#include "container.h"
Include dependency graph for async_coroutine_example.cpp:

Go to the source code of this file.

Functions

void print_section (const std::string &title)
 Helper to print section headers.
 
void print_success (const std::string &message)
 Helper to print success message.
 
void print_error (const std::string &message)
 Helper to print error message.
 
int main ()
 

Detailed Description

C++20 coroutine-based async serialization, file I/O, and streaming.

Definition in file async_coroutine_example.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 336 of file async_coroutine_example.cpp.

336 {
337#if CONTAINER_HAS_COROUTINES
338 // Run the demo coroutine
339 auto demo_task = run_all_demos();
340
341 // Wait for completion (simple busy-wait for demo purposes)
342 while (!demo_task.done()) {
343 std::this_thread::sleep_for(std::chrono::milliseconds(1));
344 }
345
346 std::cout << "\nDemo completed successfully!" << std::endl;
347#else
348 std::cout << "C++20 coroutines are not available." << std::endl;
349 std::cout << "Please compile with a C++20 compliant compiler:" << std::endl;
350 std::cout << " - GCC 10+ (full support in 11+)" << std::endl;
351 std::cout << " - Clang 13+" << std::endl;
352 std::cout << " - MSVC 2019 16.8+" << std::endl;
353#endif
354
355 return 0;
356}

◆ print_error()

void print_error ( const std::string & message)

Helper to print error message.

Examples
async_coroutine_example.cpp.

Definition at line 62 of file async_coroutine_example.cpp.

62 {
63 std::cout << "[ERROR] " << message << std::endl;
64}

◆ print_section()

void print_section ( const std::string & title)

Helper to print section headers.

Definition at line 46 of file async_coroutine_example.cpp.

46 {
47 std::cout << "\n" << std::string(60, '=') << std::endl;
48 std::cout << " " << title << std::endl;
49 std::cout << std::string(60, '=') << std::endl;
50}

◆ print_success()

void print_success ( const std::string & message)

Helper to print success message.

Definition at line 55 of file async_coroutine_example.cpp.

55 {
56 std::cout << "[OK] " << message << std::endl;
57}