diff options
Diffstat (limited to 'example')
| -rw-r--r-- | example/allocator_op_example/example.cpp | 14 | ||||
| -rw-r--r-- | example/asio_example/example.cpp | 17 | ||||
| -rw-r--r-- | example/asio_example_2/example.cpp | 14 |
3 files changed, 22 insertions, 23 deletions
diff --git a/example/allocator_op_example/example.cpp b/example/allocator_op_example/example.cpp index 7c521fd..bd34955 100644 --- a/example/allocator_op_example/example.cpp +++ b/example/allocator_op_example/example.cpp @@ -23,11 +23,11 @@ int task() int main() { - auto ret = std::async(std::launch::deferred, task); - auto ret2 = std::async(std::launch::deferred, task); - auto ret3 = std::async(std::launch::deferred, task); - - ret.get(); - ret2.get(); - ret3.get(); + auto ret = std::async(std::launch::deferred, task); + auto ret2 = std::async(std::launch::deferred, task); + auto ret3 = std::async(std::launch::deferred, task); + + ret.get(); + ret2.get(); + ret3.get(); } diff --git a/example/asio_example/example.cpp b/example/asio_example/example.cpp index d5abe0a..7b7fc16 100644 --- a/example/asio_example/example.cpp +++ b/example/asio_example/example.cpp @@ -8,9 +8,9 @@ #include <ocl/allocator_op.hpp> #include <future> -constexpr long int operator ""_USD(long double n) +constexpr long int operator""_USD(long double n) { - return n * 1000.0; + return n * 1000.0; } /// @brief Wrap OCL in ASIO calls. @@ -19,19 +19,18 @@ int main() boost::asio::io_context ioc{1}; auto spawn_strand = boost::asio::make_strand(ioc); - ocl::allocator<int> int_alloc; + ocl::allocator<int> int_alloc; - boost::asio::co_spawn(spawn_strand, [&int_alloc]() -> boost::asio::awaitable<void> { + boost::asio::co_spawn(spawn_strand, [&int_alloc]() -> boost::asio::awaitable<void> { auto balance = int_alloc.construct_array<1>(); *balance = operator ""_USD(150); ocl::io::println("Balance USD: ", *balance); - co_return; - }, boost::asio::detached); + co_return; }, boost::asio::detached); - auto balances = int_alloc.construct_array<5>(); + auto balances = int_alloc.construct_array<5>(); - ocl::asio::run<[]() { (void)0; }>(ioc); + ocl::asio::run<[]() { (void)0; }>(ioc); - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/example/asio_example_2/example.cpp b/example/asio_example_2/example.cpp index c3bfeef..42410d7 100644 --- a/example/asio_example_2/example.cpp +++ b/example/asio_example_2/example.cpp @@ -9,18 +9,18 @@ #include <future> #include <boost/process.hpp> -namespace asio = ::boost::asio; +namespace asio = ::boost::asio; namespace process = ::boost::process; /// @brief Wrap OCL in ASIO calls. int main() { - asio::io_context ioc; - process::process proc(ioc, "/usr/bin/g++", {"--version"}, process::v2::process_stdio{{ /* in to default */}, {}, nullptr}); - - proc.wait(); + asio::io_context ioc; + process::process proc(ioc, "/usr/bin/g++", {"--version"}, process::v2::process_stdio{{/* in to default */}, {}, nullptr}); - ocl::asio::run<[]() { (void)0; }>(ioc); + proc.wait(); - return EXIT_SUCCESS; + ocl::asio::run<[]() { (void)0; }>(ioc); + + return EXIT_SUCCESS; } |
