MongoDB C++ Driver  mongocxx-3.7.0
Public Member Functions | List of all members
bsoncxx::view_or_value< View, Value > Class Template Reference

Class representing a view-or-value variant type. More...

#include <view_or_value.hpp>

Public Member Functions

 view_or_value ()=default
 Class View must be constructible from an instance of class Value. More...
 
 view_or_value (View view)
 Construct a view_or_value from a View. More...
 
 view_or_value (Value &&value)
 Constructs a view_or_value from a Value type. More...
 
 view_or_value (const view_or_value &other)
 Construct a view_or_value from a copied view_or_value.
 
view_or_valueoperator= (const view_or_value &other)
 Assign to this view_or_value from a copied view_or_value.
 
 view_or_value (view_or_value &&other) noexcept
 Construct a view_or_value from a moved-in view_or_value. More...
 
view_or_valueoperator= (view_or_value &&other) noexcept
 Assign to this view_or_value from a moved-in view_or_value. More...
 
bool is_owning () const noexcept
 Return whether or not this view_or_value owns an underlying Value. More...
 
 operator View () const
 This type may be used as a View. More...
 
const View & view () const
 Get a View for the type. More...
 

Related Functions

(Note that these are not member functions.)

template<typename View , typename Value >
bool operator== (const view_or_value< View, Value > &lhs, const view_or_value< View, Value > &rhs)
 Compare view_or_value objects for (in)-equality.
 
template<typename View , typename Value >
bool operator== (const view_or_value< View, Value > &lhs, View rhs)
 Mixed (in)-equality operators for view_or_value against View or Value types.
 

Detailed Description

template<typename View, typename Value>
class bsoncxx::view_or_value< View, Value >

Class representing a view-or-value variant type.

Constructor & Destructor Documentation

◆ view_or_value() [1/4]

template<typename View , typename Value >
bsoncxx::view_or_value< View, Value >::view_or_value ( )
default

Class View must be constructible from an instance of class Value.

Class View must be default constructible. Default-constructs a view_or_value. This is equivalent to constructing a view_or_value with a default-constructed View.

◆ view_or_value() [2/4]

template<typename View , typename Value >
bsoncxx::view_or_value< View, Value >::view_or_value ( View  view)
inline

Construct a view_or_value from a View.

When constructed with a View, this object is non-owning. The Value underneath the given View must outlive this object.

Parameters
viewA non-owning View.

◆ view_or_value() [3/4]

template<typename View , typename Value >
bsoncxx::view_or_value< View, Value >::view_or_value ( Value &&  value)
inline

Constructs a view_or_value from a Value type.

This object owns the passed-in Value.

Parameters
valueA Value type.

◆ view_or_value() [4/4]

template<typename View , typename Value >
bsoncxx::view_or_value< View, Value >::view_or_value ( view_or_value< View, Value > &&  other)
inlinenoexcept

Construct a view_or_value from a moved-in view_or_value.

TODO CXX-800: Create a noexcept expression to check the conditions that must be met.

Member Function Documentation

◆ is_owning()

template<typename View , typename Value >
bool bsoncxx::view_or_value< View, Value >::is_owning ( ) const
inlinenoexcept

Return whether or not this view_or_value owns an underlying Value.

Returns
bool Whether we are owning.

◆ operator View()

template<typename View , typename Value >
bsoncxx::view_or_value< View, Value >::operator View ( ) const
inline

This type may be used as a View.

Returns
a View into this view_or_value.

◆ operator=()

template<typename View , typename Value >
view_or_value& bsoncxx::view_or_value< View, Value >::operator= ( view_or_value< View, Value > &&  other)
inlinenoexcept

Assign to this view_or_value from a moved-in view_or_value.

TODO CXX-800: Create a noexcept expression to check the conditions that must be met.

◆ view()

template<typename View , typename Value >
const View& bsoncxx::view_or_value< View, Value >::view ( ) const
inline

Get a View for the type.

Returns
a View into this view_or_value.

The documentation for this class was generated from the following file: