MongoDB C++ Driver mongocxx-3.11.0
Loading...
Searching...
No Matches
bsoncxx::v_noabi::string Namespace Reference

Description

Declares entities related to handling string types.

Classes

class  view_or_value
 Class representing a view-or-value variant type for strings. More...
 

Functions

template<class CharT , class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT>>
std::basic_string< CharT, Traits, Allocator > to_string (v_noabi::stdx::basic_string_view< CharT, Traits > value, const Allocator &alloc=Allocator())
 Convert a bsoncxx::v_noabi::stdx::string_view to a std::string.
 
bool operator== (const view_or_value &lhs, const char *rhs)
 Comparison operators for comparing string::view_or_value directly with const char*.
 
bool operator!= (const view_or_value &lhs, const char *rhs)
 Comparison operators for comparing string::view_or_value directly with const char*.
 
bool operator== (const char *lhs, const view_or_value &rhs)
 Comparison operators for comparing string::view_or_value directly with const char*.
 
bool operator!= (const char *lhs, const view_or_value &rhs)
 Comparison operators for comparing string::view_or_value directly with const char*.
 
bool operator== (const view_or_value &lhs, const char *rhs)
 Comparison operators for comparing string::view_or_value directly with const char*.
 
bool operator!= (const view_or_value &lhs, const char *rhs)
 Comparison operators for comparing string::view_or_value directly with const char*.
 
bool operator== (const char *lhs, const view_or_value &rhs)
 Comparison operators for comparing string::view_or_value directly with const char*.
 
bool operator!= (const char *lhs, const view_or_value &rhs)
 Comparison operators for comparing string::view_or_value directly with const char*.
 

Function Documentation

◆ operator!=() [1/4]

bool operator!= ( const char * lhs,
const view_or_value & rhs )
inline

Comparison operators for comparing string::view_or_value directly with const char*.

◆ operator!=() [2/4]

bool operator!= ( const view_or_value & lhs,
const char * rhs )
inline

Comparison operators for comparing string::view_or_value directly with const char*.

◆ operator==() [1/4]

bool operator== ( const char * lhs,
const view_or_value & rhs )
inline

Comparison operators for comparing string::view_or_value directly with const char*.

◆ operator==() [2/4]

bool operator== ( const view_or_value & lhs,
const char * rhs )
inline

Comparison operators for comparing string::view_or_value directly with const char*.

◆ to_string()

template<class CharT , class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT>>
std::basic_string< CharT, Traits, Allocator > bsoncxx::v_noabi::string::to_string ( v_noabi::stdx::basic_string_view< CharT, Traits > value,
const Allocator & alloc = Allocator() )

Convert a bsoncxx::v_noabi::stdx::string_view to a std::string.

This function may be used in place of explicit conversion to std::string, which may not be supported across all polyfill build configurations.

Example
std::string example(bsoncxx::v_noabi::stdx::string_view sv) {
// This may not be supported depending on the polyfill library.
// return std::string(sv);
// This is supported regardless of the polyfill library.
}
A polyfill for std::string_view.
Definition string_view.hpp:503
std::basic_string< CharT, Traits, Allocator > to_string(v_noabi::stdx::basic_string_view< CharT, Traits > value, const Allocator &alloc=Allocator())
Convert a bsoncxx::v_noabi::stdx::string_view to a std::string.
Definition to_string.hpp:48