8#ifndef INCLUDED_BSLMF_ISNOTHROWSWAPPABLE
9#define INCLUDED_BSLMF_ISNOTHROWSWAPPABLE
115#include <bslscm_version.h>
131#ifdef BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER
132# include <type_traits>
135#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
141#if !defined(BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY) && \
142 !defined(BSLS_PLATFORM_CMP_MSVC) && \
143 defined(BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR) && \
144 defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT) && \
145 defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
148namespace bslmf_is_nothrow_swappable_impl_ns {
153template <
class TYPE,
class =
void>
154struct IsNoThrowSwappable_Impl;
169#if defined(BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY)
171using std::is_nothrow_swappable;
172using std::is_nothrow_swappable_v;
175#elif defined(BSLS_PLATFORM_CMP_MSVC)
182#define BSLMF_ISNOTHROWSWAPPABLE_ALWAYS_FALSE 1
189constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<TYPE>::value;
194#elif defined(BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR) \
195 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT) \
196 && defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
201struct is_nothrow_swappable
202: BloombergLP::bslmf::If<
203 BloombergLP::bslmf::bslmf_is_nothrow_swappable_impl_ns::
204 IsNoThrowSwappable_Impl<TYPE>::isNoexcept(),
206 bsl::false_type>::Type {
217#ifdef BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES
220constexpr bool is_nothrow_swappable_v =
221 is_nothrow_swappable<TYPE>::value;
235#if !defined(BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY) && \
236 !defined(BSLS_PLATFORM_CMP_MSVC) && \
237 defined(BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR) && \
238 defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT) && \
239 defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
242namespace bslmf_is_nothrow_swappable_impl_ns {
249template <
class TYPE,
class BDE_OTHER_TYPE>
250struct IsNoThrowSwappable_Impl {
259 static constexpr bool isNoexcept();
265struct IsNoThrowSwappable_Impl<
267 typename
bsl::enable_if<bsl::is_swappable<TYPE>::value, void>::type> {
274 static constexpr bool isNoexcept();
280template <
class TYPE,
class BDE_OTHER_TYPE>
282IsNoThrowSwappable_Impl<TYPE, BDE_OTHER_TYPE>
290IsNoThrowSwappable_Impl<
295 return noexcept(
swap(BloombergLP::bslmf::Util::declval<TYPE&>(),
296 BloombergLP::bslmf::Util::declval<TYPE&>()));
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_INLINE_VARIABLE
Definition bsls_keyword.h:623
void swap(OptionValue &a, OptionValue &b)
Definition bdlb_printmethods.h:283
Definition bdlbb_blob.h:576
void swap(TYPE &a, TYPE &b)
Definition bslmf_enableif.h:525
Definition bslmf_integralconstant.h:244