blob: 52b5de53cbb3af9caa8ed84c740324aea6a3c953 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright 2026, Amlal El Mahrouss (amlal@nekernel.org)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Official repository: https://git.ocl.nekernel.org/core
#include <ocl/print.hpp>
#include <ocl/asio.hpp>
#include <ocl/allocator_op.hpp>
#include <future>
constexpr long int operator ""_USD(long double n)
{
return n * 1000.0;
}
/// @brief Wrap OCL in ASIO calls.
int main()
{
boost::asio::io_context ioc{1};
auto spawn_strand = boost::asio::make_strand(ioc);
boost::asio::co_spawn(spawn_strand, [&]() -> boost::asio::awaitable<void> {
ocl::allocator<int> int_alloc;
auto balance = int_alloc.construct_array<1>();
*balance = operator ""_USD(150);
ocl::io::println("USD: ", *balance);
co_return;
}, boost::asio::detached);
ocl::asio::run<[]() { std::terminate(); return; }>(ioc);
return EXIT_SUCCESS;
}
|