17 #include <bsoncxx/builder/basic/sub_array.hpp>
18 #include <bsoncxx/builder/basic/sub_document.hpp>
19 #include <bsoncxx/util/functor.hpp>
21 #include <bsoncxx/config/prelude.hpp>
24 BSONCXX_INLINE_NAMESPACE_BEGIN
30 using takes_document =
typename util::is_functor<T, void(sub_document)>;
33 using takes_array =
typename util::is_functor<T, void(sub_array)>;
36 BSONCXX_INLINE
typename std::enable_if<takes_document<T>::value,
void>::type generic_append(
37 core* core, T&& func) {
38 core->open_document();
39 func(sub_document(core));
40 core->close_document();
44 BSONCXX_INLINE
typename std::enable_if<takes_array<T>::value,
void>::type generic_append(core* core,
47 func(sub_array(core));
53 typename std::enable_if<!takes_document<T>::value && !takes_array<T>::value,
void>::type
54 generic_append(core* core, T&& t) {
55 core->append(std::forward<T>(t));
59 BSONCXX_INLINE
void value_append(core* core, T&& t) {
60 generic_append(core, std::forward<T>(t));
66 BSONCXX_INLINE_NAMESPACE_END
69 #include <bsoncxx/config/postlude.hpp>
Definition: element.hpp:24