Topic: propasal: template block to simplify out of class definition of
Author: musiphil@bawi.org (KIM Seungbeom)
Date: Wed, 29 Jan 2003 14:05:10 +0000 (UTC) Raw View
Jacques Lolieux wrote:
>
> Why not simply reopen the class as a namespace since a class is already a
> kind of namespace:
>
> template<class T> class A {
> void f();
> };
> template<class T> namespace A {
> void f() { ... }
> }
>
> class B {
> void g();
> };
> namespace B {
> void g() { }
> }
Currently it means a different thing, doesn't it?
--
KIM Seungbeom <musiphil@bawi.org>
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: nesotto@cs.auc.dk (THORSTEN OTTOSEN)
Date: Mon, 27 Jan 2003 20:24:06 +0000 (UTC) Raw View
"Allan W" <allan_w@my-dejanews.com> wrote in message
news:7f2735a5.0301241241.10a89440@posting.google.com...
> nesotto@cs.auc.dk ("THORSTEN OTTOSEN") wrote
> > ok...as the other threads advocate; shorter code *might* not be more
> > maintainable, but it often is. However, what we're
> > discussing here has to do with automation of trivial tasks, and that's
what
> > RAII does. If you don't have RAII, you do
> > copy and paste and try-catch-finally stuff as seen in Java; clearly not
a
> > good thing. Returning to Stroustrup's comments,
> > I believe he said something like "the number of errors (in a program)
> > increase at least linear with the size of the program".
> > So my point is that even trivial boiler-plate code can introduce errors.
>
[snip]
> Would you say that removing comments from a program is likely to
> reduce the error count?
[snip]
> But how about vertical compression?
[snip]
> Maybe what we really need to recognize is the number of statements
> that the program *ought* to use.
it is really besides the point to discuss how to measure the size of the
program. It should be understood from a
maintenance point-of-view. No matter how your source is indented and
commented and formatted and compressed and obfuscated,
if you've got more of it, it will be harder to maintain.
> Remember how the subject used to be about re-opening class scope
> to add private, non-virtual functions? I don't think this simplifies
> the complexity of a program at all. I think it adds to the complexity.
> That's true even if the total number of source code lines /
> statements / whatevers remains constant.
neither do I. And I didn't suggest it either. :-)
regards
Thorsten
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: usenet@phatbasset.com ("Hillel Y. Sims")
Date: Fri, 17 Jan 2003 17:03:43 +0000 (UTC) Raw View
"James Kanze" <kanze@gabi-soft.de> wrote in message
news:d6651fb6.0301160145.721ffec7@posting.google.com...
>
> implement class Foo
> {
> int f() const
> {
> // ...
> }
>
> void g( int i )
> {
> // ...
> }
> }
>
Now we're talking! But you have committed the cardinal sin of inventing a
new keyword :-(
(Hmm, how about "export"...)
hys
--
(c) 2003 Hillel Y. Sims
hsims AT factset.com
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: petebecker@acm.org (Pete Becker)
Date: Thu, 16 Jan 2003 19:03:28 +0000 (UTC) Raw View
Carl Daniel wrote:
>
> This
> would save quite a bit of typing in template classes with out-of-line
> function definitions.
>
Nope. It would save a little bit of cut and paste.
--
Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]