develooper Front page | perl.perl6.porters | Postings from March 2000

RE: The C++ wizardy of the Perl gods

A. C. Yardley
March 17, 2000 07:29
RE: The C++ wizardy of the Perl gods
Message ID:

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.)



     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. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About