Quick Links:

bal | bbl | bdl | bsl

Classes

Component bslmf_iscopyconstructible
[Package bslmf]

Provide a meta-function to report if a type is copy constructible. More...

Classes

struct  bslmf::IsCopyConstructible_Imp< void >
struct  bslmf::IsCopyConstructible_Imp< volatile void >
struct  bslmf::IsCopyConstructible_Imp< t_TYPE *volatile >
struct  bsl::is_copy_constructible< const t_TYPE >
struct  bsl::is_copy_constructible< t_TYPE[t_LEN]>
struct  bsl::is_copy_constructible< const t_TYPE[t_LEN]>
struct  bsl::is_copy_constructible< volatile t_TYPE[t_LEN]>
struct  bsl::is_copy_constructible< const volatile t_TYPE[t_LEN]>
struct  bsl::is_copy_constructible< t_TYPE[]>
struct  bsl::is_copy_constructible< const t_TYPE[]>
struct  bsl::is_copy_constructible< volatile t_TYPE[]>
struct  bsl::is_copy_constructible< const volatile t_TYPE[]>

Detailed Description

Outline
Purpose:
Provide a meta-function to report if a type is copy constructible.
Classes:
bsl::is_copy_constructible type-traits meta-function
bsl::is_copy_constructible_v the result value of the meta-function
See also:
Component bslmf_integralconstant, Component bslmf_nestedtraitdeclaration
Description:
This component defines a meta-function, bsl::is_copy_constructible and a template variable bsl::is_copy_constructible_v, that represents the result value of the bsl::is_copy_constructible meta-function, that may be used to query whether a type is copy constructible.
bsl::is_copy_constructible has the same syntax as the is_copy_constructible template from the C++11 standard [meta.unary.prop]. Indeed, in C++11 compilation environments, bsl::is_copy_constructible simply forwards to the native implementation, which can determine the correct value for all types without requiring specialization; in C++03 environments, bsl::is_copy_construcible provides welcome backward compatibility but returns true for all user-defined types and requires explicit specialization for types that are not copy constructible (e.g., move-only types).
Note that the bsl::is_copy_constructible trait cannot be declared as a nested trait because the default value of the trait is true and nested traits work properly only for traits that have default value false. In order to indicate that a certain type T is not copy constructible, the following idiom should be used:
   namespace bsl {
       template <>
       struct is_copy_constructible<T> : false_type { };
   }
Also note that the template variable is_copy_constructible_v is defined in the C++17 standard as an inline variable. If the current compiler supports the inline variable C++17 compiler feature, bsl::is_copy_constructible_v is defined as an inline constexpr bool variable. Otherwise, if the compiler supports the variable templates C++14 compiler feature, bsl::is_copy_constructible_v is defined as a non-inline constexpr bool variable. See BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES and BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES macros in bsls_compilerfeatures component for details.