MongoDB C++ Driver current
Loading...
Searching...
No Matches
string_view.hpp
1// Copyright 2015 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 <bsoncxx/config/prelude.hpp>
18
19#if defined(BSONCXX_POLY_USE_MNMLSTC)
20
21#include <core/string.hpp>
22
23namespace bsoncxx {
24inline namespace v_noabi {
25namespace stdx {
26
27using ::core::basic_string_view;
28using ::core::string_view;
29
30} // namespace stdx
31} // namespace v_noabi
32} // namespace bsoncxx
33
34#elif defined(BSONCXX_POLY_USE_BOOST)
35
36#include <boost/version.hpp>
37
38#if BOOST_VERSION >= 106100
39
40#include <boost/utility/string_view.hpp>
41
42namespace bsoncxx {
43inline namespace v_noabi {
44namespace stdx {
45
46using ::boost::basic_string_view;
47using ::boost::string_view;
48
49} // namespace stdx
50} // namespace v_noabi
51} // namespace bsoncxx
52
53#else
54
55#include <boost/utility/string_ref.hpp>
56
57namespace bsoncxx {
58inline namespace v_noabi {
59namespace stdx {
60
61template <typename charT, typename traits = std::char_traits<charT>>
62using basic_string_view = ::boost::basic_string_ref<charT, traits>;
63using string_view = ::boost::string_ref;
64
65} // namespace stdx
66} // namespace v_noabi
67} // namespace bsoncxx
68
69#endif
70
71#elif defined(BSONCXX_POLY_USE_STD_EXPERIMENTAL)
72
73#include <experimental/string_view>
74
75namespace bsoncxx {
76inline namespace v_noabi {
77namespace stdx {
78
79using ::std::experimental::basic_string_view;
80using ::std::experimental::string_view;
81
82} // namespace stdx
83} // namespace v_noabi
84} // namespace bsoncxx
85
86#elif defined(BSONCXX_POLY_USE_STD)
87
88#include <string_view>
89
90namespace bsoncxx {
91inline namespace v_noabi {
92namespace stdx {
93
94using ::std::basic_string_view;
95using ::std::string_view;
96
97} // namespace stdx
98} // namespace v_noabi
99} // namespace bsoncxx
100
101#else
102#error "Cannot find a valid polyfill for string_view"
103#endif
104
105#include <bsoncxx/config/postlude.hpp>
The top-level namespace for bsoncxx library entities.
Definition element.hpp:24