/* * File: example.cpp * Purpose: Rope example. * Author: Amlal El Mahrouss (amlal@nekernel.org) * Copyright 2025-2026, Amlal El Mahrouss, licensed under the Boost Software License. */ #include #include #include #include #include #ifndef STANDALONE using namespace ocl; #else using namespace boost; #endif int main() { auto rope = tproc::crope("The Quick Brown Fox Jumps Over The Lazy Dog"); auto new_elem = std::make_unique(", and Jumps again"); auto new_elem_2 = std::make_unique(", and then Jumps down."); boost::asio::io_context ioc{1}; auto spawn_strand = boost::asio::make_strand(ioc); boost::asio::co_spawn(spawn_strand, [&new_elem, &new_elem_2, &rope]() -> boost::asio::awaitable { rope.concat(new_elem.get()); new_elem->concat(new_elem_2.get()); co_return; }, boost::asio::detached); ocl::asio::run<[]() { (void)0; }>(ioc); std::cout << rope << std::endl; }