19 #include <type_traits>
21 #include <bsoncxx/types.hpp>
23 #include <bsoncxx/config/prelude.hpp>
26 BSONCXX_INLINE_NAMESPACE_BEGIN
33 namespace bson_value {
60 #define BSONCXX_ENUM(type, val) explicit view(b_##type) noexcept;
61 #include <bsoncxx/enums/type.hpp>
71 view& operator=(const
view&) noexcept;
82 friend BSONCXX_API
bool BSONCXX_CALL operator==(const bson_value::
view&,
83 const bson_value::
view&);
84 friend BSONCXX_API
bool BSONCXX_CALL operator!=(const bson_value::
view&,
85 const bson_value::
view&);
264 friend class document::element;
265 friend class bson_value::
value;
267 view(const std::uint8_t* raw, std::uint32_t length, std::uint32_t offset, std::uint32_t keylen);
268 view(
void* internal_value) noexcept;
270 void _init(
void* internal_value) noexcept;
272 void BSONCXX_PRIVATE destroy() noexcept;
302 template <
typename T>
303 using not_view =
typename std::enable_if<
304 std::is_constructible<bson_value::view, T>::value &&
309 template <
typename T>
310 BSONCXX_INLINE not_view<T> operator==(
const bson_value::view& lhs, T&& rhs) {
314 template <
typename T>
315 BSONCXX_INLINE not_view<T> operator==(T&& lhs,
const bson_value::view& rhs) {
316 return bson_value::view{std::forward<T>(lhs)} == rhs;
319 template <
typename T>
320 BSONCXX_INLINE not_view<T> operator!=(
const bson_value::view& lhs, T&& rhs) {
321 return lhs != bson_value::view{std::forward<T>(rhs)};
324 template <
typename T>
325 BSONCXX_INLINE not_view<T> operator!=(T&& lhs,
const bson_value::view& rhs) {
326 return bson_value::view{std::forward<T>(lhs)} != rhs;
332 BSONCXX_INLINE_NAMESPACE_END
335 #include <bsoncxx/config/postlude.hpp>