HP aC++/HP C A.06.28 Programmer's Guide Integrity servers (769150-001, March 2014)

wchar_t Keyword
Wide (or multi-byte) characters can be declared with the data type wchar_t. It is an integral type
that can represent all the codes of the largest character set among the supported locales defined
in the localization library. This keyword was a typedef of the ANSI C standard.
Usage
This type was added to maintain ANSI C compatibility and to accomodate foreign (principally
Oriental) character sets.
Example
In the following example, literals of type wchar_t consist of the character L followed by a character
constant in single quotes.
int main()
{
wchar_t ch = La;
}
wchar_t must be implemented the same as another integral type. In other words, it must have
the same size, signedness and alignment requirements. It promotes to the smallest integral type
when used in an expression and cannot have a signed or unsigned modifier.
The standard library includes a string of wide characters known as wstring. The IOStream library
supports I/O of wide characters.
In ANSI C, wchar_t is a synonym for another type, declared using a typedef in a standard
header file.
template Keyword
Use the template keyword when calling a member template to specify that a name is a member
template.
Usage
This construct is used for function calls to indicate that the name is a member template.
Example
struct S {
template <class T> void foo() {}
};
template <class T>
void sam(T x, S y) { y.template foo<T>(); }
typename Keyword
Use the typename keyword in template declarations to specify that a qualified name is a type,
not a class member.
Usage
This construct is used to access a nested class in the template parameter class as a type in a
declaration within the template.
Example
template<class T>
class C1 {
// class details omitted
// T::C2 *p; // Problem: flagged as compile-time
// error. T is a type, but T::C2 is not.
HP aC++ Keywords 149