BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstl_badweakptr.h
Go to the documentation of this file.
1/// @file bslstl_badweakptr.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslstl_badweakptr.h -*-C++-*-
8#ifndef INCLUDED_BSLSTL_BADWEAKPTR
9#define INCLUDED_BSLSTL_BADWEAKPTR
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bslstl_badweakptr bslstl_badweakptr
15/// @brief Provide an exception class to indicate a weak_ptr has expired.
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslstl
19/// @{
20/// @addtogroup bslstl_badweakptr
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslstl_badweakptr-purpose"> Purpose</a>
25/// * <a href="#bslstl_badweakptr-classes"> Classes </a>
26/// * <a href="#bslstl_badweakptr-description"> Description </a>
27/// * <a href="#bslstl_badweakptr-usage"> Usage </a>
28/// * <a href="#bslstl_badweakptr-example-1-tbd"> Example 1: TBD </a>
29///
30/// # Purpose {#bslstl_badweakptr-purpose}
31/// Provide an exception class to indicate a weak_ptr has expired.
32///
33/// # Classes {#bslstl_badweakptr-classes}
34///
35/// - bslstl::BadWeakPtr: exception class derived from `std` classes
36/// - bsl::bad_weak_ptr: alias to an exception type thrown by the `bsl` library
37///
38/// **Canonical header:** bsl_memory.h
39///
40/// @see bslstl_sharedptr, bslstl_stdexceptionutil
41///
42/// # Description {#bslstl_badweakptr-description}
43/// This component provides ...
44///
45/// ## Usage {#bslstl_badweakptr-usage}
46///
47///
48/// This section illustrates intended use of this component.
49///
50/// ### Example 1: TBD {#bslstl_badweakptr-example-1-tbd}
51///
52///
53/// @}
54/** @} */
55/** @} */
56
57/** @addtogroup bsl
58 * @{
59 */
60/** @addtogroup bslstl
61 * @{
62 */
63/** @addtogroup bslstl_badweakptr
64 * @{
65 */
66
67#include <bslscm_version.h>
68
69#include <bsls_exceptionutil.h>
70#include <bsls_keyword.h>
71
72#include <exception>
73
74#include <memory> // 'std::bad_weak_ptr' if defined
75
76#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
77#include <bsls_nativestd.h>
78#endif // BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
79
80
81namespace bslstl { class BadWeakPtr; }
82
83
84namespace bsl {
85#if 0
86typedef std::bad_weak_ptr bad_weak_ptr;
87#else
88typedef ::BloombergLP::bslstl::BadWeakPtr bad_weak_ptr;
89#endif
90
91} // close namespace bsl
92
93
94
95namespace bslstl {
96
97 // ================
98 // class BadWeakPtr
99 // ================
100
101class BadWeakPtr : public std::exception {
102 public:
103 /// Create a `BadWeakPtr` object. Note that this function is explicitly
104 /// user-declared, to make it simple to declare `const` objects of this
105 /// type.
107
108 /// Destroy this object.
110
111 // ACCESSORS
112
113 /// Return a pointer to the string literal "bad_weak_ptr", with a
114 /// storage duration of the lifetime of the program. Note that the
115 /// caller should *not* attempt to free this memory. Note that the
116 /// @ref bsls_exceptionutil macro `BSLS_NOTHROW_SPEC` is deliberately not
117 /// used here, as a number of standard libraries declare `what` in the
118 /// base `exception` class explicitly with the no-throw specification,
119 /// even in a build that may not recognize exceptions.
122};
123
124// ============================================================================
125// INLINE DEFINITIONS
126// ============================================================================
127
128 // ----------------
129 // class BadWeakPtr
130 // ----------------
131
132// CREATORS
133inline
135: std::exception()
136{
137}
138
139} // close package namespace
140
141
142#endif
143
144// ----------------------------------------------------------------------------
145// Copyright 2013 Bloomberg Finance L.P.
146//
147// Licensed under the Apache License, Version 2.0 (the "License");
148// you may not use this file except in compliance with the License.
149// You may obtain a copy of the License at
150//
151// http://www.apache.org/licenses/LICENSE-2.0
152//
153// Unless required by applicable law or agreed to in writing, software
154// distributed under the License is distributed on an "AS IS" BASIS,
155// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
156// See the License for the specific language governing permissions and
157// limitations under the License.
158// ----------------------------- END-OF-FILE ----------------------------------
159
160/** @} */
161/** @} */
162/** @} */
Definition bslstl_badweakptr.h:101
BadWeakPtr() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_badweakptr.h:134
~BadWeakPtr() BSLS_EXCEPTION_VIRTUAL_NOTHROW BSLS_KEYWORD_OVERRIDE
Destroy this object.
const char * what() const BSLS_EXCEPTION_VIRTUAL_NOTHROW BSLS_KEYWORD_OVERRIDE
#define BSLS_EXCEPTION_VIRTUAL_NOTHROW
Definition bsls_exceptionutil.h:402
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:632
#define BSLS_KEYWORD_OVERRIDE
Definition bsls_keyword.h:653
Definition bdlb_printmethods.h:283
::BloombergLP::bslstl::BadWeakPtr bad_weak_ptr
Definition bslstl_badweakptr.h:88
Definition bslstl_algorithm.h:82
Definition bdldfp_decimal.h:5188