MongoDB C++ Driver  mongocxx-3.9.0
All Classes Namespaces Functions Typedefs Enumerations Enumerator Friends Pages
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 
23 namespace bsoncxx {
24 inline namespace v_noabi {
25 namespace stdx {
26 
27 using ::core::basic_string_view;
28 using ::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 
42 namespace bsoncxx {
43 inline namespace v_noabi {
44 namespace stdx {
45 
46 using ::boost::basic_string_view;
47 using ::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 
57 namespace bsoncxx {
58 inline namespace v_noabi {
59 namespace stdx {
60 
61 template <typename charT, typename traits = std::char_traits<charT>>
62 using basic_string_view = ::boost::basic_string_ref<charT, traits>;
63 using 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 
75 namespace bsoncxx {
76 inline namespace v_noabi {
77 namespace stdx {
78 
79 using ::std::experimental::basic_string_view;
80 using ::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 
90 namespace bsoncxx {
91 inline namespace v_noabi {
92 namespace stdx {
93 
94 using ::std::basic_string_view;
95 using ::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