Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!cornell!uw-beaver!ssc-vax!bcsaic!mgates From: mgates@entiat.boeing.com (Michael Gates) Newsgroups: comp.lang.c++ Subject: Re: Constant data tables and classes Message-ID: Date: 8 Apr 91 17:41:09 GMT References: <41062@genrad.UUCP> <20146@alice.att.com> Sender: nntp@bcsaic.UUCP Organization: Boeing Computer Services, Bellevue, WA Lines: 28 In-reply-to: roger@zuken.co.jp's message of 8 Apr 91 02:54:34 GMT In article roger@zuken.co.jp (Roger Meunier) writes: >In article <20146@alice.att.com> bs@alice.att.com (Bjarne Stroustrup) writes: >Kyle Wilson (jkw@genrad.com) wrote: > > > It appears that C++ intentionally prohibits static > > > const tables within classes. It would seem to me that allowing these > > > would provide a convenient way of hiding constant data tables used by > > > a class from outside use rather than using file scoped statics. Does > > > anyoune know why this is disallowed? > > > > Is this what you want?: > > > > class X { > > static const Table t; > > // ... > > }; > > > > const Table X::t = { /* lots of stuff */ }; > > > > If so, it works. > >How would you initialize the Table t for all instances in an array >of class X, as in the following? Static class members are independent of instances, so there is only one Table t for the class X, not one for each instance. -- et tu mgates?