Mythical C++ Features



Table of Contents      

Introduction

Getting Up and Running

 

Debugging

New C++ Features

 

External Interface   

Tutorials

Man Page

FAQ   


Since KAI C++ has been on the ``bleeding edge'' of ISO C++, users sometimes expect KAI C++ to support alleged ISO C++ features that in fact are not in the standard. Most of these features are logical extrapolations of real features. This chapter lists some of the popular ones.

Partial Specialization of Template Functions

Repeat this matra:
Class templates can be partially specialize, function templates can be partially ordered, and never the twain shal meet.
There simply is no feature of ``partially specialized function templates'' That means member functions too. The confusion arises because there is a feature of explicitly specialized functions.

To get the effect of a partially specialized function template, make the function delagate its work to a helper class, and partially specialize the latter. For an example, see class _Helper in our header <vector>. It used to get the effect of partially specializing certain template methods of vector that take iterators as arguments, so that they do the right thing for containers of integral types as required by paragraphs 10-11 of Section 23.1.1 of the Standard.

Address of Bound Member Function

The address of a member is not assignable to a pointer-to function. E.g.:
struct Foo {
    void member();
}

Foo f;

typedef void (*PV)();	// Pointer to function returning void
PV = &f.member;		// ILLEGAL
There are two ways to resolve the problem:
  1. Make member a static member function. Then it has the type of an ordinary function.
  2. Change PV from pointer-to-function to pointer-to-member function. The changed lines then read as:
    typedef void (Foo::*PM);
    PM = &Foo::member;		
         


Next Section         Copyright © 1996-1999. All rights reserved.

E-Mail KAI Technical Support   E-Mail KAI   Contact KAI   

This file last updated on 25 March 1999.