BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslmf_haspointersemantics.h
Go to the documentation of this file.
1/// @file bslmf_haspointersemantics.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslmf_haspointersemantics.h -*-C++-*-
8#ifndef INCLUDED_BSLMF_HASPOINTERSEMANTICS
9#define INCLUDED_BSLMF_HASPOINTERSEMANTICS
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bslmf_haspointersemantics bslmf_haspointersemantics
15/// @brief Provide a type trait for pointer semantics.
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslmf
19/// @{
20/// @addtogroup bslmf_haspointersemantics
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslmf_haspointersemantics-purpose"> Purpose</a>
25/// * <a href="#bslmf_haspointersemantics-classes"> Classes </a>
26/// * <a href="#bslmf_haspointersemantics-description"> Description </a>
27///
28/// # Purpose {#bslmf_haspointersemantics-purpose}
29/// Provide a type trait for pointer semantics.
30///
31/// # Classes {#bslmf_haspointersemantics-classes}
32///
33/// - bslmf::HasPointerSemantics: meta-function indicating pointer-like types
34///
35/// @see
36/// bslmf_nestedtraitdeclaration
37///
38/// # Description {#bslmf_haspointersemantics-description}
39/// This component defines a tag type `HasPointerSemantics` derived
40/// from `bsl::true_type` to indicate that a type has pointer semantics, and
41/// from `bsl::false_type` otherwise. A type has pointer-like semantics must
42/// define (at a minimum) `operator*` and `operator->`. All pointer types have
43/// pointer semantics; other types must explicitly add this trait, either
44/// with the macro `BSLMF_NESTED_TRAIT_DECLARATION`, or by explicit template
45/// specialization.
46/// @}
47/** @} */
48/** @} */
49
50/** @addtogroup bsl
51 * @{
52 */
53/** @addtogroup bslmf
54 * @{
55 */
56/** @addtogroup bslmf_haspointersemantics
57 * @{
58 */
59
60#include <bslscm_version.h>
61
64#include <bslmf_ispointer.h>
65
67#include <bsls_platform.h>
68
69#include <memory>
70
71#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
72#include <bslmf_ispointer.h>
73#endif // BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
74
75
76namespace bslmf {
77
78template <class t_TYPE>
81 bool,
82 bsl::is_pointer<t_TYPE>::value ||
83 DetectNestedTrait<t_TYPE, HasPointerSemantics>::value> {
84};
85
86#ifdef BSLS_LIBRARYFEATURES_HAS_CPP98_AUTO_PTR
87# ifdef BSLS_PLATFORM_HAS_PRAGMA_GCC_DIAGNOSTIC
88# pragma GCC diagnostic push
89# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
90# endif
91template <class t_POINTED_TO_TYPE>
92struct HasPointerSemantics<std::auto_ptr<t_POINTED_TO_TYPE> > :
93 public bsl::true_type
94{};
95# ifdef BSLS_PLATFORM_HAS_PRAGMA_GCC_DIAGNOSTIC
96# pragma GCC diagnostic pop
97# endif
98#endif
99#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
100template <class t_POINTED_TO_TYPE>
101struct HasPointerSemantics<std::shared_ptr<t_POINTED_TO_TYPE> > :
102 public bsl::true_type
103{};
104#endif
105#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_UNIQUE_PTR
106template <class t_POINTED_TO_TYPE>
107struct HasPointerSemantics<std::unique_ptr<t_POINTED_TO_TYPE> > :
108 public bsl::true_type
109{};
110#endif
111
112} // close package namespace
113
114
115#endif
116
117// ----------------------------------------------------------------------------
118// Copyright 2013 Bloomberg Finance L.P.
119//
120// Licensed under the Apache License, Version 2.0 (the "License");
121// you may not use this file except in compliance with the License.
122// You may obtain a copy of the License at
123//
124// http://www.apache.org/licenses/LICENSE-2.0
125//
126// Unless required by applicable law or agreed to in writing, software
127// distributed under the License is distributed on an "AS IS" BASIS,
128// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129// See the License for the specific language governing permissions and
130// limitations under the License.
131// ----------------------------- END-OF-FILE ----------------------------------
132
133/** @} */
134/** @} */
135/** @} */
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bdlbb_blob.h:579
Definition bdldfp_decimal.h:5549
Definition bslmf_integralconstant.h:261
Definition bslmf_haspointersemantics.h:83