10#include <ocl/detail/config.hpp>
11#include <ocl/print_fwd.hpp>
18 enum struct return_type :
int
23 count = err - okay + 1,
28 using option_error = std::runtime_error;
30 inline void throw_option_invalid_type_error(
const boost::source_location& loc = BOOST_CURRENT_LOCATION)
32 ::boost::throw_exception(option_error(
""), loc);
44 if (ret_ == return_type::invalid)
45 detail::throw_option_invalid_type_error();
55 assert(ret_ != return_type::invalid);
57 if (ret_ == return_type::err)
59 io::println(input ? input :
"basic_option::error");
60 detail::throw_option_invalid_type_error();
66 template <
typename Handleable>
69 assert(ret_ != return_type::invalid);
71 if (ret_ == return_type::err)
74 Handleable{}(input ? input :
"basic_option::error");
81 return_type ret_{return_type::invalid};
89 struct eq_teller final
91 template <
class ObjFirst,
class ObjLast>
92 bool operator()(ObjFirst a, ObjLast b)
noexcept
98 struct greater_than_teller final
100 template <
class ObjFirst,
class ObjLast>
101 bool operator()(ObjFirst a, ObjLast b)
noexcept
107 struct less_than_teller final
109 template <
class ObjFirst,
class ObjLast>
110 bool operator()(ObjFirst a, ObjLast b)
noexcept
117 template <
typename Teller,
typename... Lst>
118 inline return_type eval(
const Teller& tell, Lst&&... arg)
120 return tell(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err;
123 template <
typename... Lst>
124 inline return_type eval_less_than(Lst&&... arg)
126 return detail::less_than_teller{}(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err;
129 template <
typename... Lst>
130 inline return_type eval_eq(Lst&&... arg)
132 return detail::eq_teller{}(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err;
135 template <
typename... Lst>
136 inline return_type eval_greater_than(Lst&&... arg)
138 return detail::greater_than_teller{}(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err;
141 inline return_type eval_true() noexcept
143 return return_type::okay;
146 inline return_type eval_false() noexcept
148 return return_type::err;
151 inline return_type eval_invalid() noexcept
153 return return_type::invalid;
156 using option = basic_option;
Definition option_fwd.hpp:37
Memory allocator for OCL support.
Definition allocator_fwd.hpp:16