Original Symbian headers
Selected EUSER, Window Server, networking, graphics and device declarations
Loading...
Searching...
No Matches
TSwap Class Reference

Defines the basic behaviour for swapping two elements of an array. More...

#include <e32std.h>

Public Member Functions

IMPORT_C TSwap ()
 Default constructor.
 
virtual IMPORT_C void Swap (TInt aLeft, TInt aRight) const
 Swaps two elements of an array.
 

Detailed Description

Defines the basic behaviour for swapping two elements of an array.

The class is abstract. A derived class must be defined and implemented to use the functionality.

A derived class can define how to swap two elements of an array. In practice, this means providing an implementation for the virtual function Swap().

To support this, the derived class is also likely to need a pointer to the array itself and suitable constructors and/or other member functions to set such a pointer.

API status
Published to all clients. Released API.

Definition at line 950 of file e32std.h.

Constructor & Destructor Documentation

◆ TSwap()

IMPORT_C TSwap::TSwap ( )

Default constructor.

The constructor has an empty implementation.

(generated from Symbian Developer Library)

Member Function Documentation

◆ Swap()

IMPORT_C void TSwap::Swap ( TInt  aLeft,
TInt  aRight 
) const
virtual

Swaps two elements of an array.

This function is called by User::QuickSort().

The default implementation raises a USER 36 panic.

In general, the class must provide a way of translating the indexes representing the two elements into pointers to the elements themselves. The Mem::Swap() utility function can then be used to swap the two elements. This implies that the derived class must contain a pointer to the array itself and have access to other information about the array, such as the length of elements.

By convention, the index value is relative to zero; i.e. a zero value refers to the first element in the array.

Parameters
aLeftThe index of an array element participating in the swap
aRightThe index of an array element participating in the swap

Panic condition: USER 36, if no replacement function has been provided by a derived class.

(generated from Symbian Developer Library)


The documentation for this class was generated from the following files: