<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Mastering C++ - C++ - tribe.net</title>
  <link rel="alternate" href="http://cpp.tribe.net/thread/5eab0d7d-b93e-4a72-badd-5c1ecda6b390?format=atom" />
  <subtitle>Tribe.net. Local Connections</subtitle>
  <entry>
    <title>Mastering C++</title>
    <link rel="alternate" href="http://CPP.tribe.net/thread/5eab0d7d-b93e-4a72-badd-5c1ecda6b390#6114bc2d-d678-4673-9237-8a2ca7b09448" />
    <author>
      <name>John</name>
    </author>
    <id>http://CPP.tribe.net/thread/5eab0d7d-b93e-4a72-badd-5c1ecda6b390#6114bc2d-d678-4673-9237-8a2ca7b09448</id>
    <published>2003-11-07T09:34:35Z</published>
    <summary type="html">I don't know if I ever will master C++.  I've been working in it for going on 7 years, and I'm still frightening myself with new constructs.&#xD;
&#xD;
Take templates for example.  First I just used them, and they worked.  (cool)  Then I created abstract templates and inherited from them and that worked (frightening).  Then today, I was staring at two simple templates in one of my utility include files.  One was for singly linked lists, and the other for doubly linked lists; and I said to myself, these share a lot of common traits, I wonder if I could have a template that is built from another templatized class.  So I tried something like this:&#xD;
&#xD;
template &amp;amp;lt;class T&gt; class listbase { ... } ;&#xD;
template &amp;amp;lt;class T&gt; class singlelist : public listbase&amp;amp;lt;T&gt; { ... } ;&#xD;
template &amp;amp;lt;class T&gt; class doublelist : public listbase&amp;amp;lt;T&gt; { ... } ;&#xD;
&#xD;
and it worked.&#xD;
and then I put in an internal class for iteration, but made a second version that returned a different type:&#xD;
&#xD;
template &amp;amp;lt;class T&gt; class listbase {&#xD;
  template &amp;amp;lt;class Tpar&gt; class Titerator {&#xD;
    iterator(T *) ;&#xD;
&#xD;
    Tpar *  getcurrent(void) const ;&#xD;
    ...&#xD;
  } ;&#xD;
  ...&#xD;
} ;&#xD;
&#xD;
And of course I used it from the child class:&#xD;
&#xD;
class myclass : public somebase {&#xD;
  singlelist&amp;amp;lt;myclass&gt;::Titerator&amp;amp;lt;somebase&gt; ...&#xD;
} ;&#xD;
&#xD;
And this all works.&#xD;
&#xD;
Worse, is I know I'm not even scratching the surface.  I've looked at the source code for the cross platform libraries from ObjectSpace (written by the guys that wrote the STL), and my mind bends just trying to follow what they're doing (generic algorithms, etc.)&#xD;
&#xD;
Anyways, if anyone wants to look at my list templates, let me know and I'll email you a copy (about 200 lines); and if anyone has other good references for mind expanding C++ stuff, please post it here or let me know.&#xD;
&#xD;
Derek</summary>
    <dc:creator>John</dc:creator>
    <dc:date>2003-11-07T09:34:35Z</dc:date>
  </entry>
  <entry>
    <title>Re: Mastering C++</title>
    <link rel="alternate" href="http://CPP.tribe.net/thread/5eab0d7d-b93e-4a72-badd-5c1ecda6b390#d29e71f8-979e-415c-847d-bd82bb0f0b6e" />
    <author>
      <name>Adeh</name>
    </author>
    <id>http://CPP.tribe.net/thread/5eab0d7d-b93e-4a72-badd-5c1ecda6b390#d29e71f8-979e-415c-847d-bd82bb0f0b6e</id>
    <published>2004-03-10T17:13:04Z</published>
    <summary type="html">THanks for offering your ode on the tribe. I think that is a great idea, I would take you up on it, just to see what other people are doing with the language. I wrote C++ code on my own for about a year, and came up with some pretty crazy things myself. But many times I wondered... does this make any sense?&#xD;
&#xD;
Anyway, C++ is a wonderfully flexible language, and the power it gives you is awesome. These days I am stuck with Java, which makes me feel like I ma back in Kindergarden. The whole reflection thing is pretty neat though.</summary>
    <dc:creator>Adeh</dc:creator>
    <dc:date>2004-03-10T17:13:04Z</dc:date>
  </entry>
  <entry>
    <title>Re: Mastering C++</title>
    <link rel="alternate" href="http://CPP.tribe.net/thread/5eab0d7d-b93e-4a72-badd-5c1ecda6b390#df5d715a-c1fd-4173-be7c-a66f21cd2473" />
    <author>
      <name>Bartosz</name>
    </author>
    <id>http://CPP.tribe.net/thread/5eab0d7d-b93e-4a72-badd-5c1ecda6b390#df5d715a-c1fd-4173-be7c-a66f21cd2473</id>
    <published>2004-03-15T22:36:20Z</published>
    <summary type="html">You ain't seen nothing yet! If you want to graduate to higher levels of template programming, I recommend Andrei Alexandrescu's book "Modern C++ Design". It will blow your brain.</summary>
    <dc:creator>Bartosz</dc:creator>
    <dc:date>2004-03-15T22:36:20Z</dc:date>
  </entry>
  <entry>
    <title>Re: Mastering C++</title>
    <link rel="alternate" href="http://CPP.tribe.net/thread/5eab0d7d-b93e-4a72-badd-5c1ecda6b390#77ce491d-0043-441b-98c5-3aeca5c82c51" />
    <author>
      <name>Gilton</name>
    </author>
    <id>http://CPP.tribe.net/thread/5eab0d7d-b93e-4a72-badd-5c1ecda6b390#77ce491d-0043-441b-98c5-3aeca5c82c51</id>
    <published>2004-03-17T14:44:58Z</published>
    <summary type="html">Bartosz,&#xD;
  I looked at that book about a year ago and could not make heads or tails of it. But I agree. C++ is the kind of language that one never seems to exhaust for concepts.&#xD;
&#xD;
My two cents,&#xD;
 Gilton</summary>
    <dc:creator>Gilton</dc:creator>
    <dc:date>2004-03-17T14:44:58Z</dc:date>
  </entry>
</feed>



