Use Explicit Conversion Functions to Avert Reckless Implicit Conversions

Download Now Free registration required

Executive Summary

The compiler invokes user-defined conversion functions (which are also called conversion operators) implicitly. In most cases, this process is well-behaved and intended. However, there are cases when one certainly doesn't want the compiler to invoke the conversion operator implicitly - but one can't prevent it. Several workarounds have been devised to mitigate this problem, including the indirect conversion idiom. And yet, these workarounds are neither intuitive nor perfect. C++0x finally brings a radical solution in the form of explicit conversion functions.

  • Format: HTML
  • Size: 0 KB