30using type_t =
typename T::type;
34using value_type_t =
typename T::value_type;
36template <
bool B,
typename T =
void>
37using enable_if_t =
typename std::enable_if<B, T>::type;
39#pragma push_macro("DECL_ALIAS")
41#define DECL_ALIAS(Name) \
42 template <typename T> \
43 using Name##_t = type_t<std::Name<T>>
45DECL_ALIAS(make_signed);
46DECL_ALIAS(make_unsigned);
47DECL_ALIAS(remove_reference);
48DECL_ALIAS(remove_const);
49DECL_ALIAS(remove_volatile);
50DECL_ALIAS(remove_pointer);
52DECL_ALIAS(add_pointer);
54DECL_ALIAS(add_volatile);
55DECL_ALIAS(add_lvalue_reference);
56DECL_ALIAS(add_rvalue_reference);
57#pragma pop_macro("DECL_ALIAS")
59template <
typename... Ts>
60using common_type_t = type_t<std::common_type<Ts...>>;
64using remove_cvref_t = remove_cv_t<remove_reference_t<T>>;
68using const_reference_t = add_lvalue_reference_t<remove_cvref_t<T>
const>;
73template <
typename... Ts>
78using bool_constant = std::integral_constant<bool, B>;
87namespace impl_detection {
92 template <
class...>
class Oper,
98 typename SfinaeHere = Oper<Args...>>
99std::true_type is_detected_f(mp_list<Args...>*);
103template <
template <
class...>
class Oper>
104std::false_type is_detected_f(...);
107template <
bool IsDetected>
112struct detection<false> {
114 template <
typename Default,
template <
class...>
class,
typename...>
120struct detection<true> {
121 template <
typename,
template <
class...>
class Oper,
typename... Args>
122 using f = Oper<Args...>;
129 ~nonesuch() =
delete;
130 nonesuch(nonesuch
const&) =
delete;
131 void operator=(nonesuch
const&) =
delete;
139template <
template <
class...>
class Oper,
typename... Args>
140struct is_detected : decltype(impl_detection::is_detected_f<Oper>(static_cast<mp_list<Args...>*>(nullptr))) {};
147template <
typename Dflt,
template <
class...>
class Oper,
typename... Args>
149 typename impl_detection::detection<is_detected<Oper, Args...>::value>::template f<Dflt, Oper, Args...>;
156template <
template <
class...>
class Oper,
typename... Args>
157using detected_t = detected_or<nonesuch, Oper, Args...>;
165 template <
typename IfTrue,
typename>
170struct conditional<false> {
171 template <
typename,
typename IfFalse>
180template <
bool B,
typename T,
typename F>
181using conditional_t =
typename conditional<B>::template f<T, F>;
184namespace impl_logic {
186template <
typename FalseType,
typename Opers>
189template <
typename H,
typename... Tail>
190struct conj<bool_constant<H::
value || !sizeof...(Tail)>, mp_list<H, Tail...>> : H {};
192template <
typename F,
typename H,
typename... Tail>
193struct conj<F, mp_list<H, Tail...>> : conj<F, mp_list<Tail...>> {};
196struct conj<std::false_type, mp_list<H>> : H {};
199struct conj<std::false_type, mp_list<>> : std::true_type {};
201template <
typename TrueType,
typename Opers>
204template <
typename H,
typename... Tail>
205struct disj<bool_constant<H::
value && sizeof...(Tail)>, mp_list<H, Tail...>> : H {};
207template <
typename F,
typename H,
typename... Tail>
208struct disj<F, mp_list<H, Tail...>> : disj<F, mp_list<Tail...>> {};
211struct disj<std::true_type, mp_list<H>> : H {};
214struct disj<std::true_type, mp_list<>> : std::false_type {};
225template <
typename... Cond>
226struct conjunction : impl_logic::conj<std::false_type, mp_list<Cond...>> {};
234template <
typename... Cond>
235struct disjunction : impl_logic::disj<std::true_type, mp_list<Cond...>> {};
241struct negation : bool_constant<!T::value> {};
247template <
typename...>
248using true_t = std::true_type;
250namespace impl_requires {
253R norm_conjunction(R
const&);
255template <
typename R,
typename... Cs>
256conjunction<Cs...> norm_conjunction(conjunction<Cs...>
const&);
259using norm_conjunction_t =
decltype(norm_conjunction<T>(std::declval<T const&>()));
261template <
typename Constra
int,
typename =
void>
264template <
typename FailingRequirement>
265struct failed_requirement {
266 failed_requirement(
int) =
delete;
268 template <
typename T>
269 static T explain(failed_requirement);
272template <
typename... SubRequirements>
273struct failed_requirement<conjunction<SubRequirements...>> {
274 failed_requirement(
int) =
delete;
276 template <
typename T>
277 static auto explain(
int) -> common_type_t<
decltype(requirement<SubRequirements>::test::template explain<T>(0))...>;
280template <
typename Constra
int,
typename>
282 using test = failed_requirement<impl_requires::norm_conjunction_t<Constraint>>;
285template <
typename Constra
int>
286struct requirement<Constraint, enable_if_t<Constraint::
value>> {
288 template <
typename T>
289 static T explain(
int);
301template <
typename Type,
typename... Traits>
302#if defined _MSC_VER && _MSC_VER < 1920
304using requires_t = enable_if_t<conjunction<Traits...>::value, Type>;
307using requires_t =
decltype(impl_requires::requirement<conjunction<Traits...>>::test::template explain<Type>(0));
316template <
typename Type,
typename... Traits>
317using requires_not_t = requires_t<Type, negation<disjunction<Traits...>>>;
320namespace impl_invoke {
322template <
bool IsMemberObject,
bool IsMemberFunction>
324 template <
typename F,
typename... Args>
325 constexpr static auto apply(F&& fun, Args&&... args)
326 BSONCXX_PRIVATE_RETURNS(
static_cast<F&&
>(fun)(
static_cast<Args&&
>(args)...));
330struct invoker<false, true> {
331 template <
typename F,
typename Self,
typename... Args>
332 constexpr static auto apply(F&& fun, Self&& self, Args&&... args)
333 BSONCXX_PRIVATE_RETURNS((
static_cast<Self&&
>(self).*fun)(
static_cast<Args&&
>(args)...));
337struct invoker<true, false> {
338 template <
typename F,
typename Self>
339 constexpr static auto apply(F&& fun, Self&& self) BSONCXX_PRIVATE_RETURNS(
static_cast<Self&&
>(self).*fun);
344static constexpr struct invoke_fn {
350 template <
typename F,
typename... Args,
typename Fd = remove_cvref_t<F>>
351 constexpr auto operator()(F&& fn, Args&&... args)
const
352 BSONCXX_PRIVATE_RETURNS(impl_invoke::invoker<std::is_member_object_pointer<Fd>::value, std::is_member_function_pointer<Fd>::value>::apply(
static_cast<F&&
>(fn),
static_cast<Args&&
>(args)...));
360template <
typename F,
typename... Args>
361using invoke_result_t =
decltype(invoke(std::declval<F>(), std::declval<Args>()...));
367template <
typename F,
typename... Args>
368struct is_invocable : is_detected<invoke_result_t, F, Args...> {};
372template <
typename T,
typename U>
373struct is_alike : std::is_same<remove_cvref_t<T>, remove_cvref_t<U>> {};
379template <std::
size_t N>
389namespace swap_detection {
393template <
typename T,
typename U>
394auto is_swappable_f(rank<0>) -> std::false_type;
396template <
typename T,
typename U>
397auto is_swappable_f(rank<1>)
noexcept(
398 noexcept(
swap(std::declval<T>(), std::declval<U>())) &&
noexcept(
swap(std::declval<U>(), std::declval<T>())))
400 decltype(
swap(std::declval<T>(), std::declval<U>())),
401 decltype(
swap(std::declval<U>(), std::declval<T>()))>;
403template <
typename T,
typename U>
404auto is_nothrow_swappable_f(rank<0>) -> std::false_type;
406template <
typename T,
typename U>
407auto is_nothrow_swappable_f(rank<1>) -> bool_constant<
408 noexcept(
swap(std::declval<T>(), std::declval<U>())) &&
noexcept(
swap(std::declval<U>(), std::declval<T>()))>;
412template <
typename T,
typename U>
413struct is_swappable_with : decltype(swap_detection::is_swappable_f<T, U>(rank<1>{})) {};
415template <
typename T,
typename U>
416struct is_nothrow_swappable_with : decltype(swap_detection::is_nothrow_swappable_f<T, U>(rank<1>{})) {};
419struct is_swappable : is_swappable_with<T&, T&> {};
422struct is_nothrow_swappable : is_nothrow_swappable_with<T&, T&> {};
424template <
typename L,
typename R>
425auto is_equality_comparable_f(...) -> std::false_type;
427BSONCXX_PRIVATE_WARNINGS_PUSH();
428BSONCXX_PRIVATE_WARNINGS_DISABLE(GNU(
"-Wfloat-equal"));
429template <
typename L,
typename R>
430auto is_equality_comparable_f(
int,
bool b =
false)
432 decltype((std::declval<L const&>() == std::declval<R const&>()) ? 0 : 0, (std::declval<R const&>() == std::declval<L const&>()) ? 0 : 0, (std::declval<L const&>() != std::declval<R const&>()) ? 0 : 0, (std::declval<R const&>() != std::declval<L const&>()) ? 0 : 0)>;
433BSONCXX_PRIVATE_WARNINGS_POP();
438template <
typename L,
typename R = L>
439struct is_equality_comparable : decltype(is_equality_comparable_f<L, R>(0)) {};
441template <
typename L,
typename R>
442std::false_type is_partially_ordered_with_f(rank<0>);
444BSONCXX_PRIVATE_WARNINGS_PUSH();
445BSONCXX_PRIVATE_WARNINGS_DISABLE(Clang(
"-Wordered-compare-function-pointers"));
446template <
typename L,
typename R>
447auto is_partially_ordered_with_f(rank<1>) -> true_t<
448 decltype(std::declval<L const&>() > std::declval<R const&>()),
449 decltype(std::declval<L const&>() < std::declval<R const&>()),
450 decltype(std::declval<L const&>() >= std::declval<R const&>()),
451 decltype(std::declval<L const&>() <= std::declval<R const&>()),
452 decltype(std::declval<R const&>() < std::declval<L const&>()),
453 decltype(std::declval<R const&>() > std::declval<L const&>()),
454 decltype(std::declval<R const&>() <= std::declval<L const&>()),
455 decltype(std::declval<R const&>() >= std::declval<L const&>())>;
456BSONCXX_PRIVATE_WARNINGS_POP();
458template <
typename T,
typename U>
459struct is_partially_ordered_with : decltype(is_partially_ordered_with_f<T, U>(rank<1>{})) {};
462struct is_totally_ordered : conjunction<is_equality_comparable<T>, is_partially_ordered_with<T, T>> {};
464template <
typename T,
typename U>
465struct is_totally_ordered_with : conjunction<
466 is_totally_ordered<T>,
467 is_totally_ordered<U>,
468 is_equality_comparable<T, U>,
469 is_partially_ordered_with<T, U>> {};
The bsoncxx v1 macro guard postlude header.
The bsoncxx v1 macro guard prelude header.
bson_value::value value
Equivalent to bsoncxx::v_noabi::types::bson_value::value.
Definition value-fwd.hpp:35
void swap(packed_bit_element< Iterator > a, packed_bit_element< Iterator > b) noexcept
packed_bit_element is Swappable even when it's not an lvalue reference
Definition elements.hpp:172
The top-level namespace within which all bsoncxx library entities are declared.