BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstp_alloc.h
Go to the documentation of this file.
1/// @file bslstp_alloc.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslstp_alloc.h -*-C++-*-
8#ifndef INCLUDED_BSLSTP_ALLOC
9#define INCLUDED_BSLSTP_ALLOC
10
11/// @defgroup bslstp_alloc bslstp_alloc
12/// @brief Provide facilities for STLPort implementation.
13/// @addtogroup bsl
14/// @{
15/// @addtogroup bslstp
16/// @{
17/// @addtogroup bslstp_alloc
18/// @{
19///
20/// <h1> Outline </h1>
21/// * <a href="#bslstp_alloc-purpose"> Purpose</a>
22/// * <a href="#bslstp_alloc-classes"> Classes </a>
23/// * <a href="#bslstp_alloc-description"> Description </a>
24///
25/// # Purpose {#bslstp_alloc-purpose}
26/// Provide facilities for STLPort implementation.
27///
28/// @deprecated Do not use directly.
29///
30/// # Classes {#bslstp_alloc-classes}
31///
32///
33/// @see bslstp_hashmap, bslstp_hashtable, bslstp_slist
34///
35/// # Description {#bslstp_alloc-description}
36/// This component is for internal use only.
37///
38/// Note that the functions in this component are based on STLPort's
39/// implementation, with copyright notice as follows:
40/// @code
41//*
42/ *
43/ * Copyright (c) 1996,1997
44/ * Silicon Graphics Computer Systems, Inc.
45/ *
46/ * Copyright (c) 1997
47/ * Moscow Center for SPARC Technology
48/ *
49/ * Copyright (c) 1999
50/ * Boris Fomitchev
51/ *
52/ * This material is provided "as is", with absolutely no warranty expressed
53/ * or implied. Any use is at your own risk.
54/ *
55/ * Permission to use or copy this software for any purpose is hereby granted
56/ * without fee, provided the above notices are retained on all copies.
57/ * Permission to modify the code and to distribute modified code is granted,
58/ * provided the above notices are retained, and a notice that the code was
59/ * modified is included with the above copyright notice.
60/ *
61/ */
62/// @endcode
63///
64/// /Usage
65/// /-----
66/// This component is for internal use only.
67/// @}
68/** @} */
69/** @} */
70
71/** @addtogroup bsl
72 * @{
73 */
74/** @addtogroup bslstp
75 * @{
76 */
77/** @addtogroup bslstp_alloc
78 * @{
79 */
80
81#ifdef BDE_OPENSOURCE_PUBLICATION // STP
82#error "bslstp_alloc is not for publication"
83#endif
85
86namespace bsl {
87
88typedef void (* __oom_handler_type)();
89
90enum {_ALIGN = 8, _ALIGN_SHIFT=3, _MAX_BYTES = 128};
91
92// The fully general version.
93template <class _Tp, class _Allocator>
95{
96 typedef _Allocator _Orig;
97 typedef typename _Allocator::template rebind<_Tp> _Rebind_type;
98 typedef typename _Rebind_type::other allocator_type;
99 static allocator_type create_allocator(const _Orig& __a) { return allocator_type(__a); }
100};
101
102// inheritance is being used for EBO optimization
103template <class _Value, class _Tp, class _MaybeReboundAlloc>
105 : public BloombergLP::bslalg::ContainerBase<_MaybeReboundAlloc> {
106private:
107 typedef BloombergLP::bslalg::ContainerBase<_MaybeReboundAlloc> _Base;
108
110
111public:
112 _Value _M_data;
113 inline _STLP_alloc_proxy(const _MaybeReboundAlloc& __a, _Value __p) : _Base(__a), _M_data(__p) {}
114
115 _MaybeReboundAlloc get_allocator() const { return this->allocatorRef(); }
116};
117
118} // close namespace bsl
119
120#endif // INCLUDED_BSLSTP_ALLOC
121
122/** @} */
123/** @} */
124/** @} */
Definition bslstp_alloc.h:105
_STLP_alloc_proxy(const _MaybeReboundAlloc &__a, _Value __p)
Definition bslstp_alloc.h:113
_Value _M_data
Definition bslstp_alloc.h:112
_MaybeReboundAlloc get_allocator() const
Definition bslstp_alloc.h:115
Definition bdlb_printmethods.h:283
@ _MAX_BYTES
Definition bslstp_alloc.h:90
@ _ALIGN_SHIFT
Definition bslstp_alloc.h:90
@ _ALIGN
Definition bslstp_alloc.h:90
void(* __oom_handler_type)()
Definition bslstp_alloc.h:88
Definition bslstp_alloc.h:95
_Rebind_type::other allocator_type
Definition bslstp_alloc.h:98
_Allocator _Orig
Definition bslstp_alloc.h:96
static allocator_type create_allocator(const _Orig &__a)
Definition bslstp_alloc.h:99
_Allocator::template rebind< _Tp > _Rebind_type
Definition bslstp_alloc.h:97