27using type_t =
typename T::type;
31using value_type_t =
typename T::value_type;
33template <
bool B,
typename T =
void>
34using enable_if_t =
typename std::enable_if<B, T>::type;
36#pragma push_macro("DECL_ALIAS")
38#define DECL_ALIAS(Name) \
39 template <typename T> \
40 using Name##_t = type_t<std::Name<T>>
42DECL_ALIAS(make_signed);
43DECL_ALIAS(make_unsigned);
44DECL_ALIAS(remove_reference);
45DECL_ALIAS(remove_const);
46DECL_ALIAS(remove_volatile);
47DECL_ALIAS(remove_pointer);
49DECL_ALIAS(add_pointer);
51DECL_ALIAS(add_volatile);
52DECL_ALIAS(add_lvalue_reference);
53DECL_ALIAS(add_rvalue_reference);
54#pragma pop_macro("DECL_ALIAS")
56template <
typename... Ts>
57using common_type_t = type_t<std::common_type<Ts...>>;
61using remove_cvref_t = remove_cv_t<remove_reference_t<T>>;
65using const_reference_t = add_lvalue_reference_t<const remove_cvref_t<T>>;
76template <
typename... Ts>
78#if defined(_MSC_VER) && _MSC_VER < 1910
81 typename just_void<Ts...>::type;
88using bool_constant = std::integral_constant<bool, B>;
97namespace impl_detection {
109 typename SfinaeHere = Oper<Args...>>
110std::true_type is_detected_f(mp_list<Args...>*);
114template <
template <
class...>
class Oper>
115std::false_type is_detected_f(...);
118template <
bool IsDetected>
123struct detection<false> {
125 template <
typename Default,
template <
class...>
class,
typename...>
131struct detection<true> {
132 template <
typename,
template <
class...>
class Oper,
typename... Args>
133 using f = Oper<Args...>;
138template <
typename Dflt,
typename Void,
template <
class...>
class Oper,
typename... Args>
139struct vc140_detection {
143template <
typename Dflt,
template <
class...>
class Oper,
typename... Args>
144struct vc140_detection<Dflt, void_t<Oper<Args...>>, Oper, Args...> {
145 using type = Oper<Args...>;
152 ~nonesuch() =
delete;
153 nonesuch(nonesuch
const&) =
delete;
154 void operator=(nonesuch
const&) =
delete;
162template <
template <
class...>
class Oper,
typename... Args>
164 : decltype(impl_detection::is_detected_f<Oper>(static_cast<mp_list<Args...>*>(nullptr))) {};
171template <
typename Dflt,
template <
class...>
class Oper,
typename... Args>
173#if defined(_MSC_VER) && _MSC_VER < 1910
174 typename impl_detection::vc140_detection<Dflt, void, Oper, Args...>::type
176 typename impl_detection::detection<
177 is_detected<Oper, Args...>::value>::template f<Dflt, Oper, Args...>
186template <
template <
class...>
class Oper,
typename... Args>
187using detected_t = detected_or<nonesuch, Oper, Args...>;
195 template <
typename IfTrue,
typename>
200struct conditional<false> {
201 template <
typename,
typename IfFalse>
210template <
bool B,
typename T,
typename F>
211using conditional_t =
typename conditional<B>::template f<T, F>;
214namespace impl_logic {
216template <
typename FalseType,
typename Opers>
219template <
typename H,
typename... Tail>
220struct conj<bool_constant<H::
value || !sizeof...(Tail)>, mp_list<H, Tail...>> : H {};
222template <
typename F,
typename H,
typename... Tail>
223struct conj<F, mp_list<H, Tail...>> : conj<F, mp_list<Tail...>> {};
226struct conj<
std::false_type, mp_list<H>> : H {};
229struct conj<
std::false_type, mp_list<>> : std::true_type {};
231template <
typename TrueType,
typename Opers>
234template <
typename H,
typename... Tail>
235struct disj<bool_constant<H::
value && sizeof...(Tail)>, mp_list<H, Tail...>> : H {};
237template <
typename F,
typename H,
typename... Tail>
238struct disj<F, mp_list<H, Tail...>> : disj<F, mp_list<Tail...>> {};
241struct disj<
std::true_type, mp_list<H>> : H {};
244struct disj<
std::true_type, mp_list<>> : std::false_type {};
255template <
typename... Cond>
256struct conjunction : impl_logic::conj<std::false_type, mp_list<Cond...>> {};
264template <
typename... Cond>
265struct disjunction : impl_logic::disj<std::true_type, mp_list<Cond...>> {};
271struct negation : bool_constant<!T::value> {};
277template <
typename...>
278using true_t = std::true_type;
280namespace impl_requires {
283R norm_conjunction(
const R&);
285template <
typename R,
typename... Cs>
286conjunction<Cs...> norm_conjunction(
const conjunction<Cs...>&);
289using norm_conjunction_t =
decltype(norm_conjunction<T>(std::declval<const T&>()));
291template <
typename Constra
int,
typename =
void>
294template <
typename FailingRequirement>
295struct failed_requirement {
296 failed_requirement(
int) =
delete;
298 template <
typename T>
299 static T explain(failed_requirement);
302template <
typename... SubRequirements>
303struct failed_requirement<conjunction<SubRequirements...>> {
304 failed_requirement(
int) =
delete;
306 template <
typename T>
307 static auto explain(
int)
308 -> common_type_t<
decltype(requirement<SubRequirements>::test::template explain<T>(0))...>;
311template <
typename Constra
int,
typename>
313 using test = failed_requirement<impl_requires::norm_conjunction_t<Constraint>>;
316template <
typename Constra
int>
317struct requirement<Constraint, enable_if_t<Constraint::
value>> {
319 template <
typename T>
320 static T explain(
int);
332template <
typename Type,
typename... Traits>
333#if defined _MSC_VER && _MSC_VER < 1920
335using requires_t = enable_if_t<conjunction<Traits...>::value, Type>;
339 decltype(impl_requires::requirement<conjunction<Traits...>>::test::template explain<Type>(0));
348template <
typename Type,
typename... Traits>
349using requires_not_t = requires_t<Type, negation<disjunction<Traits...>>>;
352namespace impl_invoke {
354template <
bool IsMemberObject,
bool IsMemberFunction>
356 template <
typename F,
typename... Args>
357 constexpr static auto apply(F&& fun, Args&&... args)
358 BSONCXX_RETURNS(
static_cast<F&&
>(fun)(
static_cast<Args&&
>(args)...));
362struct invoker<false, true> {
363 template <
typename F,
typename Self,
typename... Args>
364 constexpr static auto apply(F&& fun, Self&& self, Args&&... args)
365 BSONCXX_RETURNS((
static_cast<Self&&
>(self).*fun)(
static_cast<Args&&
>(args)...));
369struct invoker<true, false> {
370 template <
typename F,
typename Self>
371 constexpr static auto apply(F&& fun, Self&& self)
372 BSONCXX_RETURNS(
static_cast<Self&&
>(self).*fun);
377static constexpr struct invoke_fn {
383 template <
typename F,
typename... Args,
typename Fd = remove_cvref_t<F>>
384 constexpr auto operator()(F&& fn, Args&&... args)
const
385 BSONCXX_RETURNS(impl_invoke::invoker<std::is_member_object_pointer<Fd>::value,
386 std::is_member_function_pointer<Fd>::value>
387 ::apply(
static_cast<F&&
>(fn),
static_cast<Args&&
>(args)...));
395template <
typename F,
typename... Args>
396using invoke_result_t =
decltype(invoke(std::declval<F>(), std::declval<Args>()...));
402template <
typename F,
typename... Args>
403#if defined(_MSC_VER) && _MSC_VER < 1910
404using is_invocable = is_detected<invoke_result_t, F, Args...>;
406struct is_invocable : is_detected<invoke_result_t, F, Args...> {
412template <
typename T,
typename U>
413struct is_alike : std::is_same<remove_cvref_t<T>, remove_cvref_t<U>> {};
419template <std::
size_t N>
429namespace swap_detection {
435void swap(...) =
delete;
437template <
typename T,
typename U>
438auto is_swappable_f(rank<0>) -> std::false_type;
440template <
typename T,
typename U>
441auto is_swappable_f(rank<1>)
442 noexcept(
noexcept(swap(std::declval<T>(), std::declval<U>()))
443 &&
noexcept(swap(std::declval<U>(), std::declval<T>())))
444 -> true_t<
decltype(swap(std::declval<T>(), std::declval<U>())),
445 decltype(swap(std::declval<U>(), std::declval<T>()))>;
447template <
typename T,
typename U>
448auto is_nothrow_swappable_f(rank<0>) -> std::false_type;
450template <
typename T,
typename U>
451auto is_nothrow_swappable_f(rank<1>)
452 -> bool_constant<noexcept(swap(std::declval<T>(), std::declval<U>())) &&
453 noexcept(swap(std::declval<U>(), std::declval<T>()))>;
457template <
typename T,
typename U>
458struct is_swappable_with : decltype(swap_detection::is_swappable_f<T, U>(rank<1>{})) {};
460template <
typename T,
typename U>
461struct is_nothrow_swappable_with
462 : decltype(swap_detection::is_nothrow_swappable_f<T, U>(rank<1>{})) {};
465struct is_swappable : is_swappable_with<T&, T&> {};
468struct is_nothrow_swappable : is_nothrow_swappable_with<T&, T&> {};
The bsoncxx macro guard postlude header.
The bsoncxx macro guard prelude header.
BSONCXX_DEPRECATED typedef types::bson_value::view value
Equivalent to bsoncxx::v_noabi::types::bson_value::view.
Definition value.hpp:30
type
An enumeration of each BSON type.
Definition types.hpp:43
The top-level namespace within which all bsoncxx library entities are declared.
The top-level namespace reserved for the C++ standard library.