BDE 4.14.0 Production release
|
Provide functionality of the corresponding C++ Standard header.
Canonical header: bsl_complex.h
This component is for internal use only. Please include <bsl_complex.h>
directly. This component imports symbols declared in the <complex> header file implemented in the standard library provided by the compiler vendor.
This component provides a set of user-defined literals (UDL) to form bsl::complex
objects with various ranges of values. The ud-suffixes are preceded with the _
symbol to distinguish between the bsl
-complex's UDLs and the std
-complex's UDLs introduced in the C++14 standard and implemented in the standard library. Note that bsl
-complex's UDLs, unlike the std
-complex's UDLs, can be used in a client's code if the current compiler supports the C++11 standard.
Also note that bsl
-complex's UDL operators are declared in the bsl::literals::complex_literals
namespace, where literals
and complex_literals are inline namespaces. Access to these operators can be gained with either using namespace bsl::literals
, using namespace bsl::complex_literals
or using namespace bsl::literals::complex_literals
. But we recommend using namespace bsl::complex_literals
to minimize the scope of the using declaration.
In this section we show intended use of this component.
This example demonstrates basic use of the complex user-defined literal operators.
First, we provide an access to bsl
-complex's UDLs.
Then, we construct a bsl::complex
object z
.
Finally, stream the magnitude of the complex number z
to stdout
:
The streaming operator produces output in the following format on stdout
: