Quick Links:

bal | bbl | bdl | bsl

Namespaces

Component bslmf_isconvertibletoany
[Package bslmf]

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

Namespaces

namespace  bslmf

Detailed Description

Outline
Purpose:
Provide a compile-time check for types convertible to any type.
Classes:
bslmf::IsConvertibleToAny meta-function for detecting conversion
See also:
Component bslmf_isconvertible, Component 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: