/src/brpc/src/butil/containers/optional.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #ifndef BUTIL_OPTIONAL_H |
19 | | #define BUTIL_OPTIONAL_H |
20 | | |
21 | | #include "butil/type_traits.h" |
22 | | #include "butil/memory/manual_constructor.h" |
23 | | |
24 | | // The `optional` for managing an optional contained value, |
25 | | // i.e. a value that may or may not be present, is a C++11 |
26 | | // compatible version of the C++17 `std::optional` abstraction. |
27 | | // After C++17, `optional` is an alias for `std::optional`. |
28 | | |
29 | | #if __cplusplus >= 201703L |
30 | | |
31 | | #include <optional> |
32 | | |
33 | | namespace butil { |
34 | | using std::in_place_t; |
35 | | using std::in_place; |
36 | | using std::nullopt_t; |
37 | | using std::nullopt; |
38 | | using std::bad_optional_access; |
39 | | using std::optional; |
40 | | using std::make_optional; |
41 | | } // namespace butil |
42 | | #else |
43 | | namespace butil { |
44 | | |
45 | | // Tag type used to specify in-place construction of `optional'. |
46 | | struct in_place_t {}; |
47 | | |
48 | | // Instance used for in-place construction of `optional', |
49 | | const in_place_t in_place; |
50 | | |
51 | | namespace internal { |
52 | | // Tag type used as a constructor parameter type for `nullopt_t'. |
53 | | struct optional_forbidden_t {}; |
54 | | } |
55 | | |
56 | | // Used to indicate an optional object that does not contain a value. |
57 | | struct nullopt_t { |
58 | | // It must not be default-constructible to avoid ambiguity for `opt = {}'. |
59 | 206 | explicit nullopt_t(internal::optional_forbidden_t) noexcept {} |
60 | | }; |
61 | | |
62 | | // Instance to use for the construction of `optional`. |
63 | | const nullopt_t nullopt(internal::optional_forbidden_t{}); |
64 | | |
65 | | // Thrown by `optional::value()' when accessing an optional object |
66 | | // that does not contain a value. |
67 | | class bad_optional_access : public std::exception { |
68 | | public: |
69 | | bad_optional_access() = default; |
70 | | ~bad_optional_access() override = default; |
71 | 0 | const char* what() const noexcept override { |
72 | 0 | return "optional has no value"; |
73 | 0 | } |
74 | | }; |
75 | | |
76 | | template <typename T> |
77 | | class optional; |
78 | | |
79 | | namespace internal { |
80 | | |
81 | | // Whether `T' is constructible or convertible from `optional<U>'. |
82 | | template <typename T, typename U> |
83 | | struct is_constructible_from_optional : integral_constant< |
84 | | bool, std::is_constructible<T, optional<U>&>::value || |
85 | | std::is_constructible<T, optional<U>&&>::value || |
86 | | std::is_constructible<T, const optional<U>&>::value || |
87 | | std::is_constructible<T, const optional<U>&&>::value> {}; |
88 | | |
89 | | // Whether `T' is constructible or convertible from `butil::optional<U>'. |
90 | | template <typename T, typename U> |
91 | | struct is_convertible_from_optional |
92 | | : integral_constant<bool, |
93 | | std::is_convertible<optional<U>&, T>::value || |
94 | | std::is_convertible<optional<U>&&, T>::value || |
95 | | std::is_convertible<const optional<U>&, T>::value || |
96 | | std::is_convertible<const optional<U>&&, T>::value> {}; |
97 | | |
98 | | // Whether `T' is constructible or convertible or assignable from `optional<U>'. |
99 | | template <typename T, typename U> |
100 | | struct is_assignable_from_optional |
101 | | : integral_constant<bool, |
102 | | std::is_assignable<T&, optional<U>&>::value || |
103 | | std::is_assignable<T&, optional<U>&&>::value || |
104 | | std::is_assignable<T&, const optional<U>&>::value || |
105 | | std::is_assignable<T&, const optional<U>&&>::value> {}; |
106 | | |
107 | | // Whether `T' is constructible or convertible from `optional<U>'. |
108 | | template <typename T, typename U> |
109 | | struct is_constructible_convertible_from_optional |
110 | | : integral_constant<bool, |
111 | | is_constructible_from_optional<T, U>::value || |
112 | | is_convertible_from_optional<T, U>::value> {}; |
113 | | |
114 | | // Whether `T' is constructible or convertible or assignable from `optional<U>'. |
115 | | template <typename T, typename U> |
116 | | struct is_constructible_convertible_assignable_from_optional |
117 | | : integral_constant<bool, |
118 | | is_constructible_from_optional<T, U>::value || |
119 | | is_convertible_from_optional<T, U>::value || |
120 | | is_assignable_from_optional<T, U>::value> {}; |
121 | | |
122 | | } // namespace internal |
123 | | |
124 | | template<typename T> |
125 | | class optional { |
126 | | public: |
127 | | typedef T value_type; |
128 | | |
129 | | static_assert(!is_same<typename remove_cvref<value_type>::type, in_place_t>::value, |
130 | | "Instantiation of optional with in_place_t is ill-formed"); |
131 | | static_assert(!is_same<typename remove_cvref<value_type>::type, nullopt_t>::value, |
132 | | "Instantiation of optional with nullopt_t is ill-formed"); |
133 | | static_assert(!is_reference<value_type>::value, |
134 | | "Instantiation of optional with a reference type is ill-formed"); |
135 | | static_assert(std::is_destructible<value_type>::value, |
136 | | "Instantiation of optional with a non-destructible type is ill-formed"); |
137 | | static_assert(!is_array<value_type>::value, |
138 | | "Instantiation of optional with an array type is ill-formed"); |
139 | | |
140 | 0 | optional() : _engaged(false) {} Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBufSample*, std::shared_ptr<butil::IOBufSample>, butil::detail::IOBufSampleHash<butil::IOBufSample*>, butil::detail::IOBufSampleEqual<butil::IOBufSample*>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBuf::Block*, butil::IOBufProfiler::BlockInfo, butil::DefaultHasher<butil::IOBuf::Block*>, butil::DefaultEqualTo<butil::IOBuf::Block*>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::shared_ptr<butil::IOBufSample>, long, butil::detail::IOBufSampleHash<std::shared_ptr<butil::IOBufSample> >, butil::detail::IOBufSampleEqual<std::shared_ptr<butil::IOBufSample> >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<bthread::SampledContention*, bthread::SampledContention*, bthread::ContentionHash, bthread::ContentionEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::MethodProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::ServiceProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::SSLContext, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<brpc::SocketSSLContext>, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::VarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<int, bthread::TaskGroup*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, brpc::ConnectStatistics, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::DisplayType, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::NSKey, brpc::NamingServiceThread*, brpc::NSKeyHasher, butil::DefaultEqualTo<brpc::NSKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::NamingService const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::LoadBalancer const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::ConcurrencyLimiter const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, true>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::ServerId, butil::FlatMapVoid, butil::DefaultHasher<brpc::ServerId>, butil::DefaultEqualTo<brpc::ServerId>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<int, brpc::policy::H2StreamContext*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, unsigned long, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool (brpc::policy::RtmpChunkStream::*)(brpc::policy::RtmpMessageHeader const&, brpc::AMFInputStream*, brpc::Socket*), butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpContext::MessageStreamInfo, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpTransactionHandler*, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, butil::FlatMapVoid, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, int, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::SocketMapKey, brpc::SocketMap::SingleConnection, brpc::SocketMapKeyHasher, butil::DefaultEqualTo<brpc::SocketMapKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::MVarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, mcpack2pb::MessageHandler, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::HPacker::Header, unsigned long, brpc::HeaderHasher, brpc::HeaderEqualTo, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned long, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional() |
141 | | |
142 | 0 | optional(nullopt_t) : optional() {} Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBufSample*, std::shared_ptr<butil::IOBufSample>, butil::detail::IOBufSampleHash<butil::IOBufSample*>, butil::detail::IOBufSampleEqual<butil::IOBufSample*>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBuf::Block*, butil::IOBufProfiler::BlockInfo, butil::DefaultHasher<butil::IOBuf::Block*>, butil::DefaultEqualTo<butil::IOBuf::Block*>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::shared_ptr<butil::IOBufSample>, long, butil::detail::IOBufSampleHash<std::shared_ptr<butil::IOBufSample> >, butil::detail::IOBufSampleEqual<std::shared_ptr<butil::IOBufSample> >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<bthread::SampledContention*, bthread::SampledContention*, bthread::ContentionHash, bthread::ContentionEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::MethodProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::ServiceProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::SSLContext, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<brpc::SocketSSLContext>, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::VarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<int, bthread::TaskGroup*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, brpc::ConnectStatistics, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::DisplayType, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::NSKey, brpc::NamingServiceThread*, brpc::NSKeyHasher, butil::DefaultEqualTo<brpc::NSKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::NamingService const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::LoadBalancer const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::ConcurrencyLimiter const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, true>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::ServerId, butil::FlatMapVoid, butil::DefaultHasher<brpc::ServerId>, butil::DefaultEqualTo<brpc::ServerId>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<int, brpc::policy::H2StreamContext*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, unsigned long, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool (brpc::policy::RtmpChunkStream::*)(brpc::policy::RtmpMessageHeader const&, brpc::AMFInputStream*, brpc::Socket*), butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpContext::MessageStreamInfo, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpTransactionHandler*, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, butil::FlatMapVoid, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, int, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::SocketMapKey, brpc::SocketMap::SingleConnection, brpc::SocketMapKeyHasher, butil::DefaultEqualTo<brpc::SocketMapKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::MVarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, mcpack2pb::MessageHandler, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::HPacker::Header, unsigned long, brpc::HeaderHasher, brpc::HeaderEqualTo, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned long, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::nullopt_t) |
143 | | |
144 | | optional(const optional& rhs) = default; |
145 | | |
146 | | optional(optional&& rhs) noexcept = default; |
147 | | |
148 | | template <typename U, typename std::enable_if< |
149 | | !std::is_same<T, U>::value && |
150 | | std::is_constructible<T, const U&>::value && |
151 | | !internal::is_constructible_convertible_from_optional<T, U>::value && |
152 | | std::is_convertible<const U&, T>::value, bool>::type = false> |
153 | | optional(const optional<U>& rhs) : _engaged(rhs.has_value()) { |
154 | | if (_engaged) { |
155 | | _storage.Init(*rhs); |
156 | | } |
157 | | } |
158 | | |
159 | | template <typename U, typename std::enable_if< |
160 | | !std::is_same<T, U>::value && |
161 | | std::is_constructible<T, const U&>::value && |
162 | | !internal::is_constructible_convertible_from_optional<T, U>::value && |
163 | | !std::is_convertible<const U&, T>::value, bool>::type = false> |
164 | | explicit optional(const optional<U>& rhs) : _engaged(rhs.has_value()) { |
165 | | if (_engaged) { |
166 | | _storage.Init(*rhs); |
167 | | } |
168 | | } |
169 | | |
170 | | template <typename U, typename std::enable_if< |
171 | | !std::is_same<T, U>::value && |
172 | | std::is_constructible<T, U&&>::value && |
173 | | !internal::is_constructible_convertible_from_optional<T, U>::value && |
174 | | std::is_convertible<U&&, T>::value, bool>::type = false> |
175 | | optional(optional<U>&& rhs) : _engaged(rhs.has_value()) { |
176 | | if (_engaged) { |
177 | | _storage.Init(std::move(*rhs)); |
178 | | rhs.reset(); |
179 | | } |
180 | | } |
181 | | |
182 | | template <typename U, typename std::enable_if< |
183 | | !std::is_same<T, U>::value && |
184 | | std::is_constructible<T, U&&>::value && |
185 | | !internal::is_constructible_convertible_from_optional<T, U>::value && |
186 | | !std::is_convertible<U&&, T>::value, bool>::type = false> |
187 | | explicit optional(optional<U>&& rhs) : _engaged(rhs.has_value()) { |
188 | | if (_engaged) { |
189 | | _storage.Init(std::move(*rhs)); |
190 | | rhs.reset(); |
191 | | } |
192 | | } |
193 | | |
194 | | optional(const T& value) : _engaged(true) { |
195 | | _storage.Init(value); |
196 | | } |
197 | | |
198 | 64 | optional(T&& value) : _engaged(true) { |
199 | 64 | _storage.Init(std::move(value)); |
200 | 64 | } Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBufSample*, std::shared_ptr<butil::IOBufSample>, butil::detail::IOBufSampleHash<butil::IOBufSample*>, butil::detail::IOBufSampleEqual<butil::IOBufSample*>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<butil::IOBufSample*, std::shared_ptr<butil::IOBufSample>, butil::detail::IOBufSampleHash<butil::IOBufSample*>, butil::detail::IOBufSampleEqual<butil::IOBufSample*>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBuf::Block*, butil::IOBufProfiler::BlockInfo, butil::DefaultHasher<butil::IOBuf::Block*>, butil::DefaultEqualTo<butil::IOBuf::Block*>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<butil::IOBuf::Block*, butil::IOBufProfiler::BlockInfo, butil::DefaultHasher<butil::IOBuf::Block*>, butil::DefaultEqualTo<butil::IOBuf::Block*>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::shared_ptr<butil::IOBufSample>, long, butil::detail::IOBufSampleHash<std::shared_ptr<butil::IOBufSample> >, butil::detail::IOBufSampleEqual<std::shared_ptr<butil::IOBufSample> >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::shared_ptr<butil::IOBufSample>, long, butil::detail::IOBufSampleHash<std::shared_ptr<butil::IOBufSample> >, butil::detail::IOBufSampleEqual<std::shared_ptr<butil::IOBufSample> >, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<bthread::SampledContention*, bthread::SampledContention*, bthread::ContentionHash, bthread::ContentionEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<bthread::SampledContention*, bthread::SampledContention*, bthread::ContentionHash, bthread::ContentionEqual, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::MethodProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::MethodProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::ServiceProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::ServiceProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::SSLContext, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::SSLContext, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<brpc::SocketSSLContext>, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<brpc::SocketSSLContext>, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo&&) butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::VarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::VarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo&&) Line | Count | Source | 198 | 64 | optional(T&& value) : _engaged(true) { | 199 | 64 | _storage.Init(std::move(value)); | 200 | 64 | } |
Unexecuted instantiation: butil::optional<butil::FlatMap<int, bthread::TaskGroup*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<int, bthread::TaskGroup*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, brpc::ConnectStatistics, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<unsigned long, brpc::ConnectStatistics, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::DisplayType, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::DisplayType, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::NSKey, brpc::NamingServiceThread*, brpc::NSKeyHasher, butil::DefaultEqualTo<brpc::NSKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<brpc::NSKey, brpc::NamingServiceThread*, brpc::NSKeyHasher, butil::DefaultEqualTo<brpc::NSKey>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::NamingService const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::NamingService const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::LoadBalancer const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::LoadBalancer const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::ConcurrencyLimiter const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::ConcurrencyLimiter const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, true>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, true>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::ServerId, butil::FlatMapVoid, butil::DefaultHasher<brpc::ServerId>, butil::DefaultEqualTo<brpc::ServerId>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<brpc::ServerId, butil::FlatMapVoid, butil::DefaultHasher<brpc::ServerId>, butil::DefaultEqualTo<brpc::ServerId>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<int, brpc::policy::H2StreamContext*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<int, brpc::policy::H2StreamContext*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, unsigned long, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<unsigned long, unsigned long, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool (brpc::policy::RtmpChunkStream::*)(brpc::policy::RtmpMessageHeader const&, brpc::AMFInputStream*, brpc::Socket*), butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool (brpc::policy::RtmpChunkStream::*)(brpc::policy::RtmpMessageHeader const&, brpc::AMFInputStream*, brpc::Socket*), butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpContext::MessageStreamInfo, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<unsigned int, brpc::policy::RtmpContext::MessageStreamInfo, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpTransactionHandler*, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<unsigned int, brpc::policy::RtmpTransactionHandler*, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, butil::FlatMapVoid, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<unsigned long, butil::FlatMapVoid, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, int, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<unsigned long, int, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::SocketMapKey, brpc::SocketMap::SingleConnection, brpc::SocketMapKeyHasher, butil::DefaultEqualTo<brpc::SocketMapKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<brpc::SocketMapKey, brpc::SocketMap::SingleConnection, brpc::SocketMapKeyHasher, butil::DefaultEqualTo<brpc::SocketMapKey>, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::MVarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::MVarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, mcpack2pb::MessageHandler, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, mcpack2pb::MessageHandler, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::HPacker::Header, unsigned long, brpc::HeaderHasher, brpc::HeaderEqualTo, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<brpc::HPacker::Header, unsigned long, brpc::HeaderHasher, brpc::HeaderEqualTo, false, butil::PtAllocator, false>::NewBucketsInfo&&) Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned long, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::optional(butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned long, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo&&) |
201 | | |
202 | | template <typename... Args, |
203 | | std::enable_if<std::is_constructible<T, Args&&...>::value>* = nullptr> |
204 | | explicit optional(const in_place_t, Args&&... args) : _engaged(true) { |
205 | | _storage.Init(std::forward<Args>(args)...); |
206 | | } |
207 | | |
208 | | template <typename U, typename... Args, typename std::enable_if< |
209 | | std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value>::type> |
210 | | optional(in_place_t, std::initializer_list<U> il, Args&&... args) |
211 | | : _engaged(true) { |
212 | | _storage.Init(il, std::forward<Args>(args)...); |
213 | | } |
214 | | |
215 | | template <typename U = T, typename std::enable_if< |
216 | | !std::is_same<in_place_t, typename std::decay<U>::type>::value && |
217 | | !std::is_same<optional<T>, typename std::decay<U>::type>::value && |
218 | | std::is_constructible<T, U&&>::value && |
219 | | std::is_convertible<U&&, T>::value, bool>::type = false> |
220 | | optional(U&& v) : _engaged(true) { |
221 | | _storage.Init(std::forward<U>(v)); |
222 | | } |
223 | | |
224 | | template <typename U = T, typename std::enable_if< |
225 | | !std::is_same<in_place_t, typename std::decay<U>::type>::value && |
226 | | !std::is_same<optional<T>, typename std::decay<U>::type>::value && |
227 | | std::is_constructible<T, U&&>::value && |
228 | | !std::is_convertible<U&&, T>::value, bool>::type = false> |
229 | | explicit optional(U&& v) : _engaged(true) { |
230 | | _storage.Init(std::forward<U>(v)); |
231 | | } |
232 | | |
233 | 64 | ~optional() { |
234 | 64 | reset(); |
235 | 64 | } Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBufSample*, std::shared_ptr<butil::IOBufSample>, butil::detail::IOBufSampleHash<butil::IOBufSample*>, butil::detail::IOBufSampleEqual<butil::IOBufSample*>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::shared_ptr<butil::IOBufSample>, long, butil::detail::IOBufSampleHash<std::shared_ptr<butil::IOBufSample> >, butil::detail::IOBufSampleEqual<std::shared_ptr<butil::IOBufSample> >, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBuf::Block*, butil::IOBufProfiler::BlockInfo, butil::DefaultHasher<butil::IOBuf::Block*>, butil::DefaultEqualTo<butil::IOBuf::Block*>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<bthread::SampledContention*, bthread::SampledContention*, bthread::ContentionHash, bthread::ContentionEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::MethodProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::ServiceProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::SSLContext, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<brpc::SocketSSLContext>, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::VarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Line | Count | Source | 233 | 64 | ~optional() { | 234 | 64 | reset(); | 235 | 64 | } |
Unexecuted instantiation: butil::optional<butil::FlatMap<int, bthread::TaskGroup*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, brpc::ConnectStatistics, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::DisplayType, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::NSKey, brpc::NamingServiceThread*, brpc::NSKeyHasher, butil::DefaultEqualTo<brpc::NSKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::NamingService const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::LoadBalancer const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::ConcurrencyLimiter const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, true>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::ServerId, butil::FlatMapVoid, butil::DefaultHasher<brpc::ServerId>, butil::DefaultEqualTo<brpc::ServerId>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<int, brpc::policy::H2StreamContext*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, unsigned long, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool (brpc::policy::RtmpChunkStream::*)(brpc::policy::RtmpMessageHeader const&, brpc::AMFInputStream*, brpc::Socket*), butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpContext::MessageStreamInfo, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpTransactionHandler*, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, butil::FlatMapVoid, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, int, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::SocketMapKey, brpc::SocketMap::SingleConnection, brpc::SocketMapKeyHasher, butil::DefaultEqualTo<brpc::SocketMapKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::MVarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, mcpack2pb::MessageHandler, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::HPacker::Header, unsigned long, brpc::HeaderHasher, brpc::HeaderEqualTo, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned long, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::~optional() |
236 | | |
237 | | optional& operator=(nullopt_t) noexcept { |
238 | | reset(); |
239 | | return *this; |
240 | | } |
241 | | |
242 | | optional& operator=(const optional& rhs) = default; |
243 | | |
244 | | optional& operator=(optional&& rhs) = default; |
245 | | |
246 | | // Value assignment operators |
247 | | template <typename U = T, typename = typename std::enable_if< |
248 | | !std::is_same<optional<T>, typename std::decay<U>::type>::value && |
249 | | !std::is_same<optional<T>, typename remove_cvref<U>::type>::value && |
250 | | std::is_constructible<T, U>::value && std::is_assignable<T&, U>::value && |
251 | | (!std::is_scalar<T>::value || !std::is_same<T, typename std::decay<U>::type>::value)>::type> |
252 | | optional& operator=(U&& v) { |
253 | | reset(); |
254 | | _storage.Init(std::forward<U>(v)); |
255 | | _engaged = true; |
256 | | return *this; |
257 | | } |
258 | | |
259 | | template <typename U, typename = typename std::enable_if< |
260 | | !std::is_same<T, U>::value && |
261 | | !internal::is_constructible_convertible_assignable_from_optional<T, U>::value && |
262 | | std::is_constructible<T, const U&>::value && |
263 | | std::is_assignable<T&, const U&>::value>::type> |
264 | | optional& operator=(const optional<U>& rhs) { |
265 | | if (rhs) { |
266 | | operator=(*rhs); |
267 | | } else { |
268 | | reset(); |
269 | | } |
270 | | return *this; |
271 | | } |
272 | | |
273 | | template <typename U, typename = typename std::enable_if< |
274 | | !std::is_same<T, U>::value && |
275 | | !internal::is_constructible_convertible_assignable_from_optional<T, U>::value && |
276 | | std::is_constructible<T, U>::value && |
277 | | std::is_assignable<T&, U>::value>::type> |
278 | | optional& operator=(optional<U>&& rhs) { |
279 | | if (rhs) { |
280 | | operator=(std::move(*rhs)); |
281 | | } else { |
282 | | reset(); |
283 | | } |
284 | | return *this; |
285 | | } |
286 | | |
287 | | // Accesses the contained value. |
288 | | T& operator*() { |
289 | | if (!_engaged) { |
290 | | throw bad_optional_access(); |
291 | | } |
292 | | return *_storage; |
293 | | } |
294 | | const T& operator*() const { |
295 | | if (!_engaged) { |
296 | | throw bad_optional_access(); |
297 | | } |
298 | | return *_storage; |
299 | | } |
300 | 192 | T* operator->() { |
301 | 192 | return _storage.get(); |
302 | 192 | } Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBufSample*, std::shared_ptr<butil::IOBufSample>, butil::detail::IOBufSampleHash<butil::IOBufSample*>, butil::detail::IOBufSampleEqual<butil::IOBufSample*>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBuf::Block*, butil::IOBufProfiler::BlockInfo, butil::DefaultHasher<butil::IOBuf::Block*>, butil::DefaultEqualTo<butil::IOBuf::Block*>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::shared_ptr<butil::IOBufSample>, long, butil::detail::IOBufSampleHash<std::shared_ptr<butil::IOBufSample> >, butil::detail::IOBufSampleEqual<std::shared_ptr<butil::IOBufSample> >, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<bthread::SampledContention*, bthread::SampledContention*, bthread::ContentionHash, bthread::ContentionEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::MethodProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::ServiceProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::SSLContext, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<brpc::SocketSSLContext>, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::VarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Line | Count | Source | 300 | 192 | T* operator->() { | 301 | 192 | return _storage.get(); | 302 | 192 | } |
Unexecuted instantiation: butil::optional<butil::FlatMap<int, bthread::TaskGroup*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, brpc::ConnectStatistics, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::DisplayType, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::NSKey, brpc::NamingServiceThread*, brpc::NSKeyHasher, butil::DefaultEqualTo<brpc::NSKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::NamingService const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::LoadBalancer const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::ConcurrencyLimiter const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, unsigned long, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, true>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::ServerId, butil::FlatMapVoid, butil::DefaultHasher<brpc::ServerId>, butil::DefaultEqualTo<brpc::ServerId>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<int, brpc::policy::H2StreamContext*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool (brpc::policy::RtmpChunkStream::*)(brpc::policy::RtmpMessageHeader const&, brpc::AMFInputStream*, brpc::Socket*), butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpContext::MessageStreamInfo, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpTransactionHandler*, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, butil::FlatMapVoid, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, int, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::SocketMapKey, brpc::SocketMap::SingleConnection, brpc::SocketMapKeyHasher, butil::DefaultEqualTo<brpc::SocketMapKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::MVarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, mcpack2pb::MessageHandler, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::HPacker::Header, unsigned long, brpc::HeaderHasher, brpc::HeaderEqualTo, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned long, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::operator->() |
303 | | const T* operator->() const { |
304 | | return _storage.get(); |
305 | | } |
306 | | |
307 | | explicit operator bool() const { return _engaged; } |
308 | | |
309 | 64 | bool has_value() const { return _engaged; } Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBufSample*, std::shared_ptr<butil::IOBufSample>, butil::detail::IOBufSampleHash<butil::IOBufSample*>, butil::detail::IOBufSampleEqual<butil::IOBufSample*>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBuf::Block*, butil::IOBufProfiler::BlockInfo, butil::DefaultHasher<butil::IOBuf::Block*>, butil::DefaultEqualTo<butil::IOBuf::Block*>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::shared_ptr<butil::IOBufSample>, long, butil::detail::IOBufSampleHash<std::shared_ptr<butil::IOBufSample> >, butil::detail::IOBufSampleEqual<std::shared_ptr<butil::IOBufSample> >, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<bthread::SampledContention*, bthread::SampledContention*, bthread::ContentionHash, bthread::ContentionEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::MethodProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::ServiceProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::SSLContext, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<brpc::SocketSSLContext>, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::VarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Line | Count | Source | 309 | 64 | bool has_value() const { return _engaged; } |
Unexecuted instantiation: butil::optional<butil::FlatMap<int, bthread::TaskGroup*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, brpc::ConnectStatistics, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::DisplayType, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::NSKey, brpc::NamingServiceThread*, brpc::NSKeyHasher, butil::DefaultEqualTo<brpc::NSKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::NamingService const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::LoadBalancer const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::ConcurrencyLimiter const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, unsigned long, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, true>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::ServerId, butil::FlatMapVoid, butil::DefaultHasher<brpc::ServerId>, butil::DefaultEqualTo<brpc::ServerId>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<int, brpc::policy::H2StreamContext*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool (brpc::policy::RtmpChunkStream::*)(brpc::policy::RtmpMessageHeader const&, brpc::AMFInputStream*, brpc::Socket*), butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpContext::MessageStreamInfo, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpTransactionHandler*, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, butil::FlatMapVoid, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, int, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::SocketMapKey, brpc::SocketMap::SingleConnection, brpc::SocketMapKeyHasher, butil::DefaultEqualTo<brpc::SocketMapKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::MVarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, mcpack2pb::MessageHandler, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::HPacker::Header, unsigned long, brpc::HeaderHasher, brpc::HeaderEqualTo, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned long, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::has_value() const |
310 | | |
311 | | // Returns the contained value if the `optional` is not empty, |
312 | | // otherwise throws `bad_optional_access`. |
313 | | const T& value() const & { |
314 | | if (!_engaged) { |
315 | | throw bad_optional_access(); |
316 | | } |
317 | | |
318 | | return *_storage; |
319 | | } |
320 | | T& value() & { |
321 | | if (!_engaged) { |
322 | | throw bad_optional_access(); |
323 | | } |
324 | | |
325 | | return *_storage; |
326 | | } |
327 | | T&& value() && { |
328 | | if (!_engaged) { |
329 | | throw bad_optional_access(); |
330 | | } |
331 | | |
332 | | return std::move(*_storage); |
333 | | } |
334 | | const T&& value() const && { |
335 | | if (!_engaged) { |
336 | | throw bad_optional_access(); |
337 | | } |
338 | | |
339 | | return std::move(*_storage); |
340 | | } |
341 | | |
342 | | // Returns the contained value if the `optional` is not empty, |
343 | | // otherwise returns default `v'. |
344 | | template <typename U> |
345 | | constexpr T value_or(U&& v) const& { |
346 | | static_assert(std::is_copy_constructible<value_type>::value, |
347 | | "T can not be copy constructible"); |
348 | | static_assert(std::is_convertible<U&&, value_type>::value, |
349 | | "U can not be convertible to T"); |
350 | | |
351 | | return static_cast<bool>(*this) ? **this : static_cast<T>(std::forward<U>(v)); |
352 | | } |
353 | | template <typename U> |
354 | | T value_or(U&& v) && { |
355 | | static_assert(std::is_move_constructible<value_type>::value, |
356 | | "T can not be move constructible"); |
357 | | static_assert(std::is_convertible<U&&, value_type>::value, |
358 | | "U can not be convertible to T"); |
359 | | |
360 | | return static_cast<bool>(*this) ? |
361 | | std::move(**this) : static_cast<T>(std::forward<U>(v)); |
362 | | } |
363 | | |
364 | | void swap(optional& rhs) noexcept { |
365 | | if (_engaged && rhs._engaged) { |
366 | | std::swap(**this, *rhs); |
367 | | } else if (_engaged) { |
368 | | rhs = std::move(*this); |
369 | | reset(); |
370 | | } else if (rhs._engaged) { |
371 | | *this = std::move(rhs); |
372 | | rhs.reset(); |
373 | | } |
374 | | } |
375 | | |
376 | | // Destroys any contained value if the `optional` is not empty. |
377 | 64 | void reset() { |
378 | 64 | if (_engaged) { |
379 | 64 | _storage.Destroy(); |
380 | 64 | _engaged = false; |
381 | 64 | } |
382 | 64 | } Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBufSample*, std::shared_ptr<butil::IOBufSample>, butil::detail::IOBufSampleHash<butil::IOBufSample*>, butil::detail::IOBufSampleEqual<butil::IOBufSample*>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::shared_ptr<butil::IOBufSample>, long, butil::detail::IOBufSampleHash<std::shared_ptr<butil::IOBufSample> >, butil::detail::IOBufSampleEqual<std::shared_ptr<butil::IOBufSample> >, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<butil::IOBuf::Block*, butil::IOBufProfiler::BlockInfo, butil::DefaultHasher<butil::IOBuf::Block*>, butil::DefaultEqualTo<butil::IOBuf::Block*>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<bthread::SampledContention*, bthread::SampledContention*, bthread::ContentionHash, bthread::ContentionEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::MethodProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::ServiceProperty, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::Server::SSLContext, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<brpc::SocketSSLContext>, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::VarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Line | Count | Source | 377 | 64 | void reset() { | 378 | 64 | if (_engaged) { | 379 | 64 | _storage.Destroy(); | 380 | 64 | _engaged = false; | 381 | 64 | } | 382 | 64 | } |
Unexecuted instantiation: butil::optional<butil::FlatMap<int, bthread::TaskGroup*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, brpc::ConnectStatistics, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::DisplayType, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::NSKey, brpc::NamingServiceThread*, brpc::NSKeyHasher, butil::DefaultEqualTo<brpc::NSKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::NamingService const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::LoadBalancer const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, brpc::ConcurrencyLimiter const*, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, unsigned long, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, true>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::ServerId, butil::FlatMapVoid, butil::DefaultHasher<brpc::ServerId>, butil::DefaultEqualTo<brpc::ServerId>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<int, brpc::policy::H2StreamContext*, butil::DefaultHasher<int>, butil::DefaultEqualTo<int>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool (brpc::policy::RtmpChunkStream::*)(brpc::policy::RtmpMessageHeader const&, brpc::AMFInputStream*, brpc::Socket*), butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpContext::MessageStreamInfo, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned int, brpc::policy::RtmpTransactionHandler*, butil::DefaultHasher<unsigned int>, butil::DefaultEqualTo<unsigned int>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, butil::FlatMapVoid, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<unsigned long, int, butil::DefaultHasher<unsigned long>, butil::DefaultEqualTo<unsigned long>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::SocketMapKey, brpc::SocketMap::SingleConnection, brpc::SocketMapKeyHasher, butil::DefaultEqualTo<brpc::SocketMapKey>, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bvar::MVarEntry, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, mcpack2pb::MessageHandler, butil::DefaultHasher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, butil::DefaultEqualTo<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<brpc::HPacker::Header, unsigned long, brpc::HeaderHasher, brpc::HeaderEqualTo, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() Unexecuted instantiation: butil::optional<butil::FlatMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned long, butil::CaseIgnoredHasher, butil::CaseIgnoredEqual, false, butil::PtAllocator, false>::NewBucketsInfo>::reset() |
383 | | |
384 | | // Constructs the contained value in-place. |
385 | | // Return a reference to the new contained value. |
386 | | template <typename... Args> |
387 | | T& emplace(Args&&... args) { |
388 | | static_assert(std::is_constructible<T, Args&&...>::value, |
389 | | "T can not be constructible with these arguments"); |
390 | | reset(); |
391 | | _storage.Init(std::forward<Args>(args)...); |
392 | | _engaged = true; |
393 | | return *_storage; |
394 | | } |
395 | | template <typename U, typename... Args> |
396 | | T& emplace(std::initializer_list<U> il, Args&&... args) { |
397 | | static_assert(std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value, |
398 | | "T can not be constructible with these arguments"); |
399 | | |
400 | | return emplace(il, std::forward<Args>(args)...); |
401 | | } |
402 | | |
403 | | private: |
404 | | bool _engaged; |
405 | | ManualConstructor<T> _storage; |
406 | | }; |
407 | | |
408 | | template <typename T> |
409 | | void swap(optional<T>& a, optional<T>& b) noexcept { a.swap(b); } |
410 | | |
411 | | // Creates a non-empty 'optional<T>`. |
412 | | template <typename T> |
413 | | optional<typename std::decay<T>::type> make_optional(T&& v) { |
414 | | return optional<typename std::decay<T>::type>(std::forward<T>(v)); |
415 | | } |
416 | | |
417 | | template <typename T, typename... Args> |
418 | | optional<T> make_optional(Args&&... args) { |
419 | | return optional<T>(in_place, std::forward<Args>(args)...); |
420 | | } |
421 | | |
422 | | template <typename T, typename U, typename... Args> |
423 | | optional<T> make_optional(std::initializer_list<U> il, Args&&... args) { |
424 | | return optional<T>(in_place, il, std::forward<Args>(args)...); |
425 | | } |
426 | | |
427 | | // Compares optional objects. |
428 | | // Supports comparisons between 'optional<T>` and 'optional<U>`, |
429 | | // between 'optional<T>` and `U', and between 'optional<T>` and `nullopt'. |
430 | | // Empty optionals are considered equal to each other and less than non-empty optionals. |
431 | | template <typename T, typename U> |
432 | | bool operator==(const optional<T>& x, const optional<U>& y) { |
433 | | return static_cast<bool>(x) != static_cast<bool>(y) |
434 | | ? false : static_cast<bool>(x) == false ? true : *x == *y; |
435 | | } |
436 | | |
437 | | template <typename T, typename U> |
438 | | bool operator!=(const optional<T>& x, const optional<U>& y) { |
439 | | return !(x == y); |
440 | | } |
441 | | |
442 | | template <typename T, typename U> |
443 | | bool operator<=(const optional<T>& x, const optional<U>& y) { |
444 | | return !x ? true : !y ? false : *x <= *y; |
445 | | } |
446 | | |
447 | | template <typename T, typename U> |
448 | | bool operator>=(const optional<T>& x, const optional<U>& y) { |
449 | | return !y ? true : !x ? false : *x >= *y; |
450 | | } |
451 | | |
452 | | template <typename T, typename U> |
453 | | bool operator<(const optional<T>& x, const optional<U>& y) { |
454 | | return !(x >= y); |
455 | | } |
456 | | |
457 | | template <typename T, typename U> |
458 | | bool operator>(const optional<T>& x, const optional<U>& y) { |
459 | | return !(x <= y); |
460 | | } |
461 | | |
462 | | template <typename T> |
463 | | bool operator==(const optional<T>& x, nullopt_t) { return !x; } |
464 | | |
465 | | template <typename T> |
466 | | bool operator==(nullopt_t, const optional<T>& x) { return !x; } |
467 | | |
468 | | template <typename T> |
469 | | bool operator!=(const optional<T>& x, nullopt_t) { return static_cast<bool>(x); } |
470 | | |
471 | | template <typename T> |
472 | | bool operator!=(nullopt_t, const optional<T>& x) { return static_cast<bool>(x);} |
473 | | |
474 | | template <typename T> |
475 | | bool operator<(const optional<T>&, nullopt_t) { return false; } |
476 | | |
477 | | template <typename T> |
478 | | bool operator<(nullopt_t, const optional<T>& x) { return static_cast<bool>(x); } |
479 | | |
480 | | template <typename T> |
481 | | bool operator<=(const optional<T>& x, nullopt_t) { return !x; } |
482 | | |
483 | | template <typename T> |
484 | | bool operator<=(nullopt_t, const optional<T>&) { return true; } |
485 | | |
486 | | template <typename T> |
487 | | bool operator>(const optional<T>& x, nullopt_t) { return static_cast<bool>(x); } |
488 | | |
489 | | template <typename T> |
490 | | bool operator>(nullopt_t, const optional<T>&) { return false; } |
491 | | |
492 | | template <typename T> |
493 | | bool operator>=(const optional<T>&, nullopt_t) { return true; } |
494 | | template <typename T> |
495 | | bool operator>=(nullopt_t, const optional<T>& x) { return !x; } |
496 | | |
497 | | template <typename T, typename U> |
498 | | bool operator==(const optional<T>& x, const U& v) { |
499 | | return x ? *x == v : false; |
500 | | } |
501 | | template <typename T, typename U> |
502 | | bool operator==(const U& v, const optional<T>& x) { |
503 | | return x == v; |
504 | | } |
505 | | template <typename T, typename U> |
506 | | bool operator!=(const optional<T>& x, const U& v) { |
507 | | return x ? *x != v : true; |
508 | | } |
509 | | template <typename T, typename U> |
510 | | bool operator!=(const U& v, const optional<T>& x) { |
511 | | return x != v; |
512 | | } |
513 | | |
514 | | template <typename T, typename U> |
515 | | bool operator<=(const optional<T>& x, const U& v) { |
516 | | return x ? *x <= v : true; |
517 | | } |
518 | | template <typename T, typename U> |
519 | | bool operator<=(const U& v, const optional<T>& x) { |
520 | | return x ? v <= *x : false; |
521 | | } |
522 | | template <typename T, typename U> |
523 | | bool operator<(const optional<T>& x, const U& v) { |
524 | | return !(x >= v); |
525 | | } |
526 | | template <typename T, typename U> |
527 | | bool operator<(const U& v, const optional<T>& x) { |
528 | | return !(v >= x); |
529 | | } |
530 | | |
531 | | template <typename T, typename U> |
532 | | bool operator>=(const optional<T>& x, const U& v) { |
533 | | return x ? *x >= v : false; |
534 | | } |
535 | | template <typename T, typename U> |
536 | | bool operator>=(const U& v, const optional<T>& x) { |
537 | | return x ? v >= *x : true; |
538 | | } |
539 | | |
540 | | template <typename T, typename U> |
541 | | bool operator>(const optional<T>& x, const U& v) { |
542 | | return !(x <= v); |
543 | | } |
544 | | template <typename T, typename U> |
545 | | bool operator>(const U& v, const optional<T>& x) { |
546 | | return !(v <= x); |
547 | | } |
548 | | |
549 | | } // namespace butil |
550 | | |
551 | | namespace std { |
552 | | template <typename T> |
553 | | struct hash<butil::optional<T>> { |
554 | | std::size_t operator()(const butil::optional<T>& opt) const { |
555 | | return hash<T>()(opt.value_or(T())); |
556 | | } |
557 | | }; |
558 | | |
559 | | } // namespace std |
560 | | |
561 | | #endif // __cplusplus >= 201703L |
562 | | |
563 | | #endif // BUTIL_OPTIONAL_H |