MongoDB C++ Driver mongocxx-4.0.0
Loading...
Searching...
No Matches
to_string.hpp
Go to the documentation of this file.
1// Copyright 2009-present MongoDB, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <string>
18#include <utility>
19
21
23
24namespace bsoncxx {
25namespace v_noabi {
26namespace string {
27
45template <class CharT,
46 class Traits = std::char_traits<CharT>,
47 class Allocator = std::allocator<CharT>>
48std::basic_string<CharT, Traits, Allocator> to_string(
49 v_noabi::stdx::basic_string_view<CharT, Traits> value, const Allocator& alloc = Allocator()) {
50 return std::basic_string<CharT, Traits, Allocator>{value.data(), value.length(), alloc};
51}
52
53} // namespace string
54} // namespace v_noabi
55} // namespace bsoncxx
56
57namespace bsoncxx {
58namespace string {
59
60using ::bsoncxx::v_noabi::string::to_string;
61
62} // namespace string
63} // namespace bsoncxx
64
66
71
72#if defined(BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR)
73
74namespace bsoncxx {
75namespace string {
76
78template <class CharT, class Traits, class Allocator>
79std::basic_string<CharT, Traits, Allocator> to_string(
80 v_noabi::stdx::basic_string_view<CharT, Traits> value, const Allocator& alloc);
81
82} // namespace string
83} // namespace bsoncxx
84
85#endif // defined(BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR)
The bsoncxx macro guard postlude header.
The bsoncxx macro guard prelude header.
std::basic_string< CharT, Traits, Allocator > to_string(v_noabi::stdx::basic_string_view< CharT, Traits > value, const Allocator &alloc)
bsoncxx::v_noabi::string::to_string
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
The top-level namespace within which all bsoncxx library entities are declared.
Provides std::string_view-related polyfills for library API usage.