summaryrefslogtreecommitdiffhomepage
path: root/example
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-12-21 11:11:23 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-12-21 11:11:23 +0100
commit185335e8efcac46e96e25e5a50e0d4b93152f983 (patch)
tree8b5f824d4913aa7a3d3e70df0aaa6c0980b81122 /example
parent646d97f28c2891d634e3066535524fa28e297045 (diff)
feat: New release of `OCL.Core`, standalone module.v3.0
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'example')
-rw-r--r--example/option_example/example.cc14
-rw-r--r--example/simple_allocator_op/example.cc2
-rw-r--r--example/smart_ptr_example/example.cc1
3 files changed, 13 insertions, 4 deletions
diff --git a/example/option_example/example.cc b/example/option_example/example.cc
index e35f73b..c784dec 100644
--- a/example/option_example/example.cc
+++ b/example/option_example/example.cc
@@ -1,15 +1,23 @@
#include <ocl/crc_hash.hpp>
#include <ocl/print.hpp>
#include <ocl/option.hpp>
-// #include <ocl/is_same.hpp>
+struct invalid_callable {
+ explicit invalid_callable() = default;
+ void operator()(const char* reason)
+ {
+ ocl::detail::throw_runtime_error(BOOST_CURRENT_LOCATION.to_string());
+ }
+};
+
+/// \brief Option Monad example
int main(int argc, char** argv)
{
ocl::option opt{ocl::eval_eq(nullptr, nullptr)};
- opt.expect("is incorrect");
+ opt.expect("option::incorrect");
ocl::option opt2{ocl::eval_eq(argv, nullptr)};
- opt2.expect("is incorrect");
+ opt2.expect<invalid_callable>("option::incorrect");
return 0;
}
diff --git a/example/simple_allocator_op/example.cc b/example/simple_allocator_op/example.cc
index 83be033..433da22 100644
--- a/example/simple_allocator_op/example.cc
+++ b/example/simple_allocator_op/example.cc
@@ -1,7 +1,7 @@
#include <ocl/print.hpp>
#include <ocl/allocator_op.hpp>
-/// @brief Basic Send test
+/// \brief Allocation of ints example.
int main()
{
ocl::allocator<int> int_alloc;
diff --git a/example/smart_ptr_example/example.cc b/example/smart_ptr_example/example.cc
index a8293f2..e0f8555 100644
--- a/example/smart_ptr_example/example.cc
+++ b/example/smart_ptr_example/example.cc
@@ -2,6 +2,7 @@
#include <ocl/print.hpp>
#include <ocl/smart_ptr.hpp>
+/// \brief Smart pointer example.
auto main(int argc, char** argv) -> int
{
ocl::shared_ptr<std::ostream> smart = ocl::delete_ptr(&std::cout);