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

Detailed Description

Outline

Purpose

Provide a class that overloads the non-typical operators.

Classes

Description

This component provides a single, unconstrained (value-semantic) attribute class, NonTypicalOverloadsTestType, that defines overloads to some non-typically-overloaded operators ('operator new', operator delete, and operator&) to ensure that they do not get invoked.

Attributes

Name Type Default
------------------ ----------- -------
data int 0

Usage

This section illustrates intended use of this component.

Example 1: Demonstrating Calling Operator NewDelete Induce Assertions

Suppose that we wanted to show that calling operator new and operator delete onNonTypicalOverloadsTestType' causes an assertion.

First, we verify that calling operator new will result in an assertion:

BSLS_ASSERTTEST_ASSERT_OPT_FAIL(new NonTypicalOverloadsTestType());
Definition bsls_asserttest.h:955
#define BSLS_ASSERTTEST_ASSERT_OPT_FAIL(EXPRESSION_UNDER_TEST)
Definition bsls_asserttest.h:654

Finally, we verify that calling operator delete will result in an assertion:

NonTypicalOverloadsTestType obj;