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

Detailed Description

Outline

Purpose

Provide a compile-time check for types convertible to any type.

Classes

See also
bslmf_isconvertible, bslmf_integralconstant

Description

This component provides a meta-function, bslmf::IsConvertibleToAny, that may be used to query (at compile-time) whether a type has a templatized conversion operator allowing it to be converted to any other type.

Usage

In this section we show the intended use of this component.

Example 1: Determine If a Class Has a Template Conversion Operator

Suppose that we want to assert whether a particular type has a template conversion operator.

First, we define a type with the template conversion operator:

struct TypeWithTemplateConversion {
template <class t_TYPE>
operator t_TYPE() {
return t_TYPE();
}
};

Now, we instantiate the bslmf::IsConvertibleToAny template for TypeWithTemplateConversion and assert the value of the instantiation: