October 2004
Intermediate to advanced
624 pages
16h 2m
English
An obvious disadvantage of bolt-ins, veneers, and other templates that derive from their parameterizing type(s), is that they hide that type's constructors. Consider the hypothetical classes in Listing 23.1.
Example 23.1.
class Double
{
public:
typedef double value_type;
public:
Double();
explicit Double(double d);
public:
double GetValue() const;
. . .
};
template <typename T>
class Wrapper
: public T
{
. . .
};
typedef Wrapper<Double> Double_t;
Double_t d1;
Double_t d2(12.34); // Error!
Wrapper has effectively hidden the second constructor of Double, so the attempt to nondefault construct it is an error.
The method of solving this problem for Microsoft's Active Template Library (ATL) is to avoid it. CComObject ...
Read now
Unlock full access