53 typename std::enable_if<
55 decltype(func(string_view(), string_view())),
57 system::error_code>::type & ec)
59 using func_type =
typename std::decay<Func>::type;
60 auto f =
new (
memory_tag{}) func_type(std::forward<Func>(func));
63 BOOST_SQLITE_ASSIGN_EC(ec, SQLITE_NOMEM);
66 auto res = sqlite3_create_collation_v2(
71 +[](
void * data,
int len_l,
const void * str_l,
int len_r,
const void * str_r) ->
int
73 string_view l(static_cast<const char*>(str_l), len_l);
74 string_view r(static_cast<const char*>(str_r), len_r);
75 auto & impl = (*static_cast<func_type*>(data));
76 static_assert(noexcept(impl(l, r)),
77 "Collation function must be noexcept");
80 +[](
void * p) { delete_(static_cast<func_type*>(p)); }
83 BOOST_SQLITE_ASSIGN_EC(ec, res);
92#if !defined(BOOST_SQLITE_GENERATING_DOCS)
93 ->
typename std::enable_if<
95 decltype(func(string_view(), string_view())),
99 system::error_code ec;
102 detail::throw_error_code(ec, BOOST_CURRENT_LOCATION);
void create_collation(connection &conn, cstring_ref name, Func &&func, typename std::enable_if< std::is_convertible< decltype(func(string_view(), string_view())), int >::value, system::error_code >::type &ec)