BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslalg_hastrait

Macros

#define bslalg_HasTrait   bslalg::HasTrait
 This alias is defined for backward compatibility.
 

Detailed Description

Outline

Purpose

Provide a meta-function to detect if a type has a given trait.

Deprecated:
Do not use.

Classes

See also
bslalg_typetraits, bslmf_integralconstant

Description

This component provides a meta-function, bslalg::HasTrait, that is a legacy mechanism for detecting traits. bslalg::HasTrait takes two template parameters, TYPE and TRAIT. bslalg::HasTrait<TYPE, TRAIT> inherits from bsl::true_type if the (template parameter) TYPE has the (template parameter) TRAIT, and inherits from bsl::false_type otherwise.

bslalg::HasTrait is not a general-purpose trait detection facility. It is intended to be used in conjunction with the legacy (deprecated) bslalg traits only. In particular, the type supplied to bslalg::HasTrait as the TRAIT template parameter must be a bslalg trait, for example, bslalg::TypeTraitUsesBslmaAllocator. Supplying anything else for TRAIT will (more than likely) fail to compile. For example, the following errant use of bslalg::HasTrait will definitely fail to compile:

See bslalg_typetraits for a complete list of the bslalg traits that are supported by bslalg::HasTrait.

In lieu of the deprecated bslalg traits, the newer traits intended to replace them should be used instead. These successor traits are typically defined in bslmf (two exceptions are bslma::UsesBslmaAllocator and bslalg::HasStlIterators). bslalg::HasTrait and the bslalg traits that it supports are written in such a way that bslalg::HasTrait will correctly detect whether a type has a given trait regardless of whether the trait is ascribed to the type using the deprecated BSLALG_DECLARE_NESTED_TRAITS* or BSLMF_NESTED_TRAIT_DECLARATION macros (see bslalg_typetraits and bslmf_nestedtraitdeclaration , respectively), or whether the (preferred) C++11 idiom for defining traits is used (see bslmf_detectnestedtrait ). In this way, bslalg::HasTrait provides a "bridge" between legacy bslalg type traits and their replacements that facilitates the migration to the newer traits.

Usage

No Usage example is provided since this component is deprecated.

Macro Definition Documentation

◆ bslalg_HasTrait

#define bslalg_HasTrait   bslalg::HasTrait