8#ifndef INCLUDED_BSLSTL_UTILITY
9#define INCLUDED_BSLSTL_UTILITY
67#include <bslscm_version.h>
78#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
84#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
92# ifdef BSLS_COMPILERFEATURES_FULL_CPP11
98#ifdef BSLS_LIBRARYFEATURES_HAS_CPP14_BASELINE_LIBRARY
101# ifdef BSLS_COMPILERFEATURES_FULL_CPP11
105template <
class t_TYPE,
class t_OTHER_TYPE = t_TYPE>
106t_TYPE
exchange(t_TYPE& obj, t_OTHER_TYPE&& newValue);
115template <
class t_TYPE,
class t_OTHER_TYPE>
116t_TYPE
exchange(t_TYPE& obj,
const t_OTHER_TYPE& newValue);
117template <
class t_TYPE,
class t_OTHER_TYPE>
118t_TYPE
exchange(t_TYPE& obj, t_OTHER_TYPE& newValue);
126#ifndef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
135#ifndef BSLS_LIBRARYFEATURES_HAS_CPP14_BASELINE_LIBRARY
136# ifdef BSLS_COMPILERFEATURES_FULL_CPP11
137template <
class t_TYPE,
class t_OTHER_TYPE>
138t_TYPE
exchange(t_TYPE& obj, t_OTHER_TYPE&& newValue)
140 t_TYPE oldValue =
static_cast<t_TYPE&&
>(obj);
141 obj =
static_cast<t_OTHER_TYPE&&
>(newValue);
153template <
class t_TYPE,
class t_OTHER_TYPE>
178template <
class t_TYPE,
class t_OTHER_TYPE>
179t_TYPE
exchange(t_TYPE& obj,
const t_OTHER_TYPE& newValue)
181 BloombergLP::bslstl::
182 Utility_ExchangeAssignOnDestruction<t_TYPE, const t_OTHER_TYPE>
184 return t_TYPE(BloombergLP::bslmf::MovableRefUtil::move(obj));
187template <
class t_TYPE,
class t_OTHER_TYPE>
188t_TYPE
exchange(t_TYPE& obj, t_OTHER_TYPE& newValue)
190 BloombergLP::bslstl::Utility_ExchangeAssignOnDestruction<t_TYPE,
193 return t_TYPE(BloombergLP::bslmf::MovableRefUtil::move(obj));
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_KEYWORD_CONSTEXPR
Definition bsls_keyword.h:624
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:676
Definition bdlat_valuetypefunctions.h:939
t_TYPE exchange(t_TYPE &obj, const t_OTHER_TYPE &newValue)
Definition bslstl_utility.h:179
BSLS_KEYWORD_CONSTEXPR bsl::add_const< TYPE >::type & as_const(TYPE &t) BSLS_KEYWORD_NOEXCEPT
Return a reference offering non-modifiable access to the specified t.
Definition bslstl_utility.h:129
Definition bslstl_algorithm.h:84
BloombergLP::bslmf::AddConst_Imp< t_TYPE,!is_reference< t_TYPE >::value &&!is_function< t_TYPE >::value &&!is_const< t_TYPE >::value >::Type type
Definition bslmf_addconst.h:176
Definition bslstl_utility.h:154
~Utility_ExchangeAssignOnDestruction() BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(false)
Destroy this object, performing the promised assignment.
Definition bslstl_utility.h:169
Utility_ExchangeAssignOnDestruction(t_TYPE &obj, t_OTHER_TYPE &newValue)
Definition bslstl_utility.h:165
t_OTHER_TYPE & d_newValue
Definition bslstl_utility.h:158
t_TYPE & d_obj
Definition bslstl_utility.h:157