MongoDB C++ Driver 4.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bsoncxx::string Namespace Reference

Description

Declares entities related to handling string types.

Classes

class  view_or_value
 A view-or-value variant type for strings. More...
 

Functions

bool operator== (view_or_value const &lhs, char const *rhs)
 Comparison operators for comparing string::view_or_value directly with char const*.
 
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, Allocator const &alloc=Allocator())
 Convert a bsoncxx::v_noabi::stdx::string_view to a std::string.
 

Function Documentation

◆ operator==()

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

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

◆ 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,
Allocator const & 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:411
std::basic_string< CharT, Traits, Allocator > to_string(v_noabi::stdx::basic_string_view< CharT, Traits > value, Allocator const &alloc=Allocator())
Convert a bsoncxx::v_noabi::stdx::string_view to a std::string.
Definition to_string.hpp:46