20#include <bsoncxx/config/prelude.hpp>
33template <
typename FunctionLike,
typename Signature>
34using is_functor = std::is_convertible<FunctionLike, std::function<Signature>>;
40template <
typename,
typename>
41struct build_free_function;
43template <
typename F,
typename R,
typename... Args>
44struct build_free_function<F, R(Args...)> {
45 typedef R (*type)(Args...);
48template <
typename,
typename>
49struct build_class_function;
51template <
typename C,
typename R,
typename... Args>
52struct build_class_function<C, R(Args...)> {
53 typedef R (C::*
type)(Args...);
57struct strip_cv_from_class_function;
59template <
typename C,
typename R,
typename... Args>
60struct strip_cv_from_class_function<R (C::*)(Args...)> {
61 typedef R (C::*
type)(Args...);
64template <
typename C,
typename R,
typename... Args>
65struct strip_cv_from_class_function<R (C::*)(Args...) const> {
66 typedef R (C::*
type)(Args...);
69template <
typename C,
typename R,
typename... Args>
70struct strip_cv_from_class_function<R (C::*)(Args...) volatile> {
71 typedef R (C::*
type)(Args...);
74template <
typename C,
typename S>
75struct is_class_method_with_signature {
81 static typename std::enable_if<std::is_convertible<typename build_class_function<C, S>::type,
82 typename strip_cv_from_class_function<
83 decltype(&T::operator())>::type>::value,
88 static no sfinae(...);
90 static bool constexpr value =
sizeof(sfinae<C>(
nullptr)) ==
sizeof(yes);
93template <
typename F,
typename S>
94struct is_function_with_signature
95 : std::is_convertible<F, typename build_free_function<F, S>::type> {};
97template <
typename C,
typename S,
bool>
98struct is_functor_impl : is_class_method_with_signature<C, S> {};
100template <
typename F,
typename S>
101struct is_functor_impl<F, S, false> : is_function_with_signature<F, S> {};
105template <
typename C,
typename S>
106struct is_functor : functor::is_functor_impl<C, S, std::is_class<C>::value> {};
114#include <bsoncxx/config/postlude.hpp>
type
An enumeration of each BSON type.
Definition types.hpp:48
The top-level namespace for bsoncxx library entities.
Definition element-fwd.hpp:19