View Template Library

downcast<BaseType,DerivedType>

Category: functors

Component type: type

Description

downcast<BaseType,DerivedType> is a function object. Specifically, it is an Adaptable Unary Function, which means it is a function object that promotes a pointer to a reference. If f is a pointer to an object of class downcast<BaseType> and x is a pointer to an object of class BaseType, then f(x) returns dynamic_cast<DerivedType*>(x).

Example



Definition

Defined in functors.hpp.

Template parameters

Parameter

Description

Default

BaseType

The type of downcast's arguments.


DerivedType

The type of the result


Model of

Adaptable Unary Function, DefaultConstructible

Type requirements

T has an operator*().

Public base classes

Unary_function<BaseType, DerivedType>.

Members

Member

Where defined

Description

argument_type

Adaptable Unary Function

The type of the first argument: T

result_type

Adaptable Unary Function

The type of the result: bool

downcast()

DefaultConstructible

The default constructor.

DerivedType operator()(const BaseType& x)

Unary Function

Function call operator. The return value is dynamic_cast<Derived Type>(x).

New members

All of downcast's members are defined in the Adaptable Unary Function and DefaultConstructible requirements. downcast does not introduce any new members.

Notes

See also

The function object overview, Adaptable Unary Function



VTL Home
Copyright © 1999 Konrad-Zuse-Zentrum für Informationstechnik Berlin & Gary Powell All Rights Reserved.