RE: The C++ wizardy of the Perl gods
[email protected] ("A. C. Yardley") Fri, 17 Mar 2000 09:28:39 -0600
| Newsgroups | perl.perl6.porters |
|---|---|
| Message-ID | <[email protected]> |
Hello:
I sincerely hope no-one takes offense to my questions, but I've
looked at the below bit of code for quite a while now, and I just
don't get it. Why? Why the below bit of wizardry? And just as
importantly, to me at least, what's _really_ going on here?
In the topaz.hh header of topaz-0.10, Chip writes:
struct null_type {
null_type() {}
template <class T>
operator T * () const { return 0; }
template <class T>
T * of() const { return 0; }
};
I mean, I _get_ that he's building a null type here and that
C<null_type> is later typedef'd to null. I get that. But I
haven't a clue about these templates.
I'm not a C++ guru or anything (just an ordinary mortal, struggling
to figure out the symbols of the gods :-)
Again, I apologize if my question offends the members of the list,
but I'm just unable to parse and to grok this one. (Really, I just
don't get it.)
Thanks.
/acy
I have sworn upon the altar of God eternal hostility against
every form of tyranny over the mind of man.
-- Thomas Jefferson, letter to Benjamin Rush, 1800 A.D.