On Aug 28, 2006, at 1:00 PM, Edward K. Chew wrote:
Oh, I forgot to mention, I have run into trouble with template
specialization. For example, I have a function along the lines:
template <typename T> UInt32 myHashFunction(T value, int
hashBitLength);
I specialized this for C strings:
template <> UInt32 myHashFunction(const char *str, int hashBitLength);
In most cases, I use a string and get the specialized version, but
in a few situations, I get the general implementation instead. I
experimented with partial specialization (i.e. ...myHashFunction
(const T *pointer... ), but it still goes with the general case.
The debugger says that the class from which I call myHashFunction
is of type myClass<char const *>, but I believe "const char *" and
"char const *" are equivalent in C++. Anyway, I tried every
permutation I could think of to no avail.
As you can see, the general version will be called for char*.
Personally, I can never remember the matching rules so I always have
to test this stuff out.
--
Steve Checkoway
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden