10#include <ocl/detail/config.hpp>
11#include <ocl/print_fwd.hpp>
18 enum struct return_type :
int
24 count = unknown - okay + 1,
29 using option_error = std::runtime_error;
31 inline void throw_option_invalid_type_error(
const boost::source_location& loc = BOOST_CURRENT_LOCATION)
33 ::boost::throw_exception(option_error(
""), loc);
45 if (ret_ == return_type::invalid)
46 detail::throw_option_invalid_type_error();
56 assert(ret_ != return_type::invalid);
58 if (ret_ == return_type::err)
60 io::println(input ? input :
"basic_option::error");
61 detail::throw_option_invalid_type_error();
67 template <
typename Handleable>
70 assert(ret_ != return_type::invalid);
72 if (ret_ == return_type::err)
75 Handleable{}(input ? input :
"basic_option::error");
82 return_type ret_{return_type::invalid};
90 struct eq_teller final
92 template <
class ObjFirst,
class ObjLast>
93 bool operator()(ObjFirst a, ObjLast b)
noexcept
99 struct greater_than_teller final
101 template <
class ObjFirst,
class ObjLast>
102 bool operator()(ObjFirst a, ObjLast b)
noexcept
108 struct less_than_teller final
110 template <
class ObjFirst,
class ObjLast>
111 bool operator()(ObjFirst a, ObjLast b)
noexcept
118 template <
typename Teller,
typename... Lst>
119 inline return_type eval(
const Teller& tell, Lst&&... arg)
121 return tell(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err;
124 template <
typename... Lst>
125 inline return_type eval_less_than(Lst&&... arg)
127 return detail::less_than_teller{}(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err;
130 template <
typename... Lst>
131 inline return_type eval_eq(Lst&&... arg)
133 return detail::eq_teller{}(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err;
136 template <
typename... Lst>
137 inline return_type eval_greater_than(Lst&&... arg)
139 return detail::greater_than_teller{}(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err;
142 inline return_type eval_true() noexcept
144 return return_type::okay;
147 inline return_type eval_false() noexcept
149 return return_type::err;
152 inline return_type eval_invalid() noexcept
154 return return_type::invalid;
157 using option = basic_option;
Definition option_fwd.hpp:38
Memory allocator for OCL support.
Definition allocator_fwd.hpp:16