BDE 4.39.x 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-canonical-header"> Canonical Header </a>
27/// * <a href="#bslstl_badweakptr-description"> Description </a>
28/// * <a href="#bslstl_badweakptr-usage"> Usage </a>
29/// * <a href="#bslstl_badweakptr-example-1-tbd"> Example 1: TBD </a>
30///
31/// # Purpose {#bslstl_badweakptr-purpose}
32/// Provide an exception class to indicate a weak_ptr has expired.
33///
34/// # Classes {#bslstl_badweakptr-classes}
35///
36/// - bslstl::BadWeakPtr: exception class derived from `std` classes
37/// - bsl::bad_weak_ptr: alias to an exception type thrown by the `bsl` library
38///
39/// # Canonical Header {#bslstl_badweakptr-canonical-header}
40/// bsl_memory.h
41///
42/// @see bslstl_sharedptr, bslstl_stdexceptionutil
43///
44/// # Description {#bslstl_badweakptr-description}
45/// This component provides ...
46///
47/// ## Usage {#bslstl_badweakptr-usage}
48///
49///
50/// This section illustrates intended use of this component.
51///
52/// ### Example 1: TBD {#bslstl_badweakptr-example-1-tbd}
53///
54///
55/// @}
56/** @} */
57/** @} */
58
59/** @addtogroup bsl
60 * @{
61 */
62/** @addtogroup bslstl
63 * @{
64 */
65/** @addtogroup bslstl_badweakptr
66 * @{
67 */
68
69#include <bslscm_version.h>
70
71#include <bsls_exceptionutil.h>
72#include <bsls_keyword.h>
73
74#include <exception>
75
76#include <memory> // 'std::bad_weak_ptr' if defined
77
78#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
79#include <bsls_nativestd.h>
80#endif // BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
81
82
83namespace bslstl { class BadWeakPtr; }
84
85
86namespace bsl {
87#if 0
88typedef std::bad_weak_ptr bad_weak_ptr;
89#else
90typedef ::BloombergLP::bslstl::BadWeakPtr bad_weak_ptr;
91#endif
92
93} // close namespace bsl
94
95
96
97namespace bslstl {
98
99 // ================
100 // class BadWeakPtr
101 // ================
102
103class BadWeakPtr : public std::exception {
104 public:
105 /// Create a `BadWeakPtr` object.
106 /// \note Note that this function is explicitly
107 /// user-declared, to make it simple to declare `const` objects of this
108 /// type.
110
111 /// Destroy this object.
113
114 // ACCESSORS
115
116 /// Return a pointer to the string literal "bad_weak_ptr", with a storage duration of the lifetime of the program.
117 ///
118 /// \note Note that the
119 /// caller should *not* attempt to free this memory.
120 /// \note Note that the
121 /// @ref bsls_exceptionutil macro `BSLS_NOTHROW_SPEC` is deliberately not
122 /// used here, as a number of standard libraries declare `what` in the
123 /// base `exception` class explicitly with the no-throw specification,
124 /// even in a build that may not recognize exceptions.
127};
128
129// ============================================================================
130// INLINE DEFINITIONS
131// ============================================================================
132
133 // ----------------
134 // class BadWeakPtr
135 // ----------------
136
137// CREATORS
138inline
140: std::exception()
141{
142}
143
144} // close package namespace
145
146
147#endif
148
149// ----------------------------------------------------------------------------
150// Copyright 2013 Bloomberg Finance L.P.
151//
152// Licensed under the Apache License, Version 2.0 (the "License");
153// you may not use this file except in compliance with the License.
154// You may obtain a copy of the License at
155//
156// http://www.apache.org/licenses/LICENSE-2.0
157//
158// Unless required by applicable law or agreed to in writing, software
159// distributed under the License is distributed on an "AS IS" BASIS,
160// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
161// See the License for the specific language governing permissions and
162// limitations under the License.
163// ----------------------------- END-OF-FILE ----------------------------------
164
165/** @} */
166/** @} */
167/** @} */
Definition bslstl_badweakptr.h:103
BadWeakPtr() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_badweakptr.h:139
~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)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_KEYWORD_OVERRIDE
Definition bsls_keyword.h:695
Definition bdlat_valuetypefunctions.h:939
::BloombergLP::bslstl::BadWeakPtr bad_weak_ptr
Definition bslstl_badweakptr.h:90
Definition bslstl_algorithm.h:84
Definition bdldfp_decimal.h:5549