|
New C++ Features |
|
---|---|---|
|
||
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.
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.
There are two ways to resolve the problem:struct Foo { void member(); } Foo f; typedef void (*PV)(); // Pointer to function returning void PV = &f.member; // ILLEGAL
member
a static member function.
Then it has the type of an ordinary function.
typedef void (Foo::*PM); PM = &Foo::member;