Berkeley CSUA MOTD:2001:April:29 Sunday <Saturday, Monday>
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2001/4/29-30 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java] UID:21134 Activity:very high
4/28    I haven't really use C++ in the last 3 years.  Can someone remind me
        how to initialize a dynamic array of template class pointers?

            class Bar;
            template<class T> class Foo;

            //
            // Is this the right way to initialize this:
            //       ---
            //    -> | | -> Bar
            //       ---
            //       | | -> Bar
            //       ---
            //       | | -> Bar
            //       ---
            //        .
            //        .
            //        .
            //
            Foo<Bar> **barArrayOfFooPtr;

            int size = 5;

            //
            // Forgot how to initialize the following line correctly.
            //
            // barArrayOfFooPtr = new Foo<string>* [size];
            //                    \_ Since you just want an array of pointers,
            //                       try Foo<string>*
            barArrayOfFooPtr = ???

            for (int i = 0; i < size; i++)
            {
              barArrayOfFooPtr[i] = new Foo<string>;
            }                                 \_ Try "new Foo<Bar>"
                                                 \_ Typo.  I do have Foo<Bar>.

        does not seem to be the correct way of doing it.
        \_ the right way to do what you're trying to do is:
           vector<Foo<Bar>*> arrayOfFoos(number_of_elements);
           most other ways are flawed in many ways. -ali
           \_ Correct answer moved to the top.
        \_ Compiler Error message please.
           \_ The problem is I forgot how to initialize a dynamic array of
               class pointers.  I remember that a static array of class
        \_ the right way to do what you're trying to do is:
           vector<Foo<Bar>*> arrayOfFoos(number_of_elements);
           most other ways are flawed in many ways. -ali
               template pointers can be initialzed as
                 Foo<Bar> *barArrayOfFooPtr = new Foo<Bar>[10];
               but I forgot how to initialize a dynamic one.
        \_ Try Foo<string> **barArrayOfFooPtr; .
2001/4/29-30 [Uncategorized] UID:21135 Activity:nil
4/28    Need to satisfy your craving for computer equipment
        and women's clothing? There are now two one stop shops:
        http://www.pcdiag.com.au
        http://www.symmic.com
2001/4/29-30 [Recreation/Dating] UID:21136 Activity:moderate
4/28    Damn, i didn't know Jet Li's wife was SOOOOOOO stacked!
        \_ pix?
           \_ dood, she's not even good looking.
           \_ Look for Nina Li Chi.  Not *that* staced.
           \_ supposedly 37 chest
           \_ http://www.google.com/search?q=nina+li+chi&btnG=Google+Search
              Just Another Asian Chick.  And no, that's not 37.
2001/4/29 [Politics/Foreign/Asia/China, Politics/Domestic] UID:21137 Activity:moderate
4/28    http://www.mcicenter.com/index.html
Powered by
Honker Union of China
c001====== H.U.C =====1i0n
The manifesto of Chinese Hackers:
Beat down Imperialism of American!
China will kill all the American!
No American!No U.S.A!
Hoho~~~~~:)
        \_ Shouldn't that be "hooker,"  not "honker"?
        \_ So some weenies hacked an IIS box and posted some drivel.  Why
           should anyone care?  Let me know when they've managed to take over
           the electrical grid or shutdown a nuclear power plant or made muni
           run on time.  "Chinese hax0rz take over American infrastructure!!"
           is *not* a headline you'll ever see.
        \_ beware of the Communist Hackers In North America!
2001/4/29 [Uncategorized] UID:21138 Activity:nil
4/29    I've been looking for a warez site all day and haven't found one yet.
        All of them are click spams.  What does it take to get some warez
        these days???  Suggestions?
2001/4/29-5/1 [Consumer/Camera] UID:21139 Activity:high
4/29    Any APS film scanners in/around berkeley that I can borrow/pay-to-use?
        -- sagarwal
        \_ Yes.
            \_ Oh, thats helpful. Where?
            \_ If you'd sign you post maybe I could be even more helpful.
                \_ ok.
        \_ No.
2001/4/29-30 [Computer/SW/Languages/Python] UID:21140 Activity:high
4/29    does anybody know which text wilensky uses in 188?
        does everyone just use the norvig book?  thanks.
        \_ everyone uses russell&norvig
           \_ Russell and Norvig is the standard.  AI textbook.
Berkeley CSUA MOTD:2001:April:29 Sunday <Saturday, Monday>