comp.lang.ada
 help / color / mirror / Atom feed
From: Hyman Rosen <hyrosen@mail.com>
Subject: Re: Anybody in US using ADA ? One silly idea..
Date: Fri, 17 Jan 2003 15:02:01 -0500
Date: 2003-01-17T15:02:01-05:00	[thread overview]
Message-ID: <1042833721.656780@master.nyc.kbcfp.com> (raw)
In-Reply-To: <3E28534F.DD4016C3@adaworks.com>

Richard Riehle wrote:
> Here is a generic in Ada, which while not identical to the C++ model,
> does permit combining specialization with genericity and which has
> turned out to be quite useful for certain kinds of problems.

This looks like something we would write in C++ like this:

template <class Item>
struct Starting_Type : public Item
{
	void Make();
};

I agree - there are plenty or circumstances where this is useful
and powerful.

C++ template specialization is different though; it doesn't
(necessarily) involve tagged types at all. Here's a simple
example:

// General case
template<int N>
struct Factorial { enum { Value = N * Factorial<N - 1>::Value } };

// Specialization for 0
template<>
struct Factorial<0> { enum { Value = 1 } };

// Use it, as a compile-time constant expression
int array[Factorial<5>::Value];

When you ask for Factorial<0>, the compiler uses the special case
you provided, otherwise it uses the general case. Notice that the
bodies of the specialization is completely different from the one
in the general case. (They both define a Value enumerator, but in
general, they could have been completely unrelated.)

The same thing works for type parameters:

// General case
template <typename T>
struct RemovePointers { typedef T type; };

// Specialize for pointers
template <typename T>
struct RemovePointers <T *> { typedef RemovePointers<T>::type type; };

RemovePointers<double *****>::type its_a_double = 17.29;

When you ask for RemovePointers<SomeType>, the compiler matches
SomeType against the specializatons. If it finds that one of them
is a better match than the generic type (using rules defined by
the language), it uses that one.




  reply	other threads:[~2003-01-17 20:02 UTC|newest]

Thread overview: 341+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-31 18:37 Anybody in US using ADA ? Mr Bill
2002-12-31 18:55 ` John R. Strohm
2003-01-01  3:20   ` Marin David Condic
2003-01-01  7:11     ` tmoran
2003-01-01 14:31       ` Marin David Condic
2003-01-01 22:49         ` tmoran
2003-01-02 12:45           ` Marin David Condic
2003-01-02 18:08             ` Anybody in US using ADA ? New language competition? Warren W. Gay VE3WWG
2003-01-03  2:47               ` Marin David Condic
2003-01-03  6:01                 ` Robert C. Leif
2003-01-03 17:58                 ` Anybody in US using ADA ? New language competition? (long) Warren W. Gay VE3WWG
2003-01-04 14:57                   ` Marin David Condic
2003-01-06 15:53                     ` Wes Groleau
2003-01-06 16:36                       ` Larry Kilgallen
2003-01-06 20:47                       ` Randy Brukardt
2003-01-07 13:15                         ` Wes Groleau
2003-01-07 19:05                           ` Randy Brukardt
2003-01-07 19:37                             ` Larry Kilgallen
2003-01-07 20:52                             ` Wes Groleau
2003-01-08 20:05                               ` Randy Brukardt
2003-01-07 21:23                             ` Georg Bauhaus
2003-01-08  0:30                             ` Richard Riehle
2003-01-08 20:12                               ` Randy Brukardt
2003-01-07 13:11                       ` Marin David Condic
2003-01-06 18:22                     ` Warren W. Gay VE3WWG
2003-01-06 20:52                       ` Randy Brukardt
2003-01-07 13:56                         ` Marin David Condic
2003-01-07 19:15                           ` Randy Brukardt
2003-01-08 13:14                             ` Marin David Condic
2003-01-08 18:04                               ` tmoran
2003-01-08 18:05                               ` Warren W. Gay VE3WWG
2003-01-08 20:20                                 ` Larry Kilgallen
2003-01-09 13:21                                 ` Marin David Condic
2003-01-08 20:24                               ` Randy Brukardt
2003-01-09 13:34                                 ` Marin David Condic
2003-01-07 13:50                       ` Marin David Condic
2003-01-07 17:48                         ` Warren W. Gay VE3WWG
2003-01-08 13:34                           ` Marin David Condic
2003-01-08 18:04                             ` tmoran
2003-01-08 18:16                             ` Warren W. Gay VE3WWG
2003-01-09 13:22                         ` chris.danx
2003-01-09 13:53                           ` Marin David Condic
2003-01-09 15:09                           ` Raster graphics [was Anybody in US using ADA ? New language competition? (long)] Chad R. Meiners
2003-01-11 19:23                             ` chris.danx
2003-01-03  9:57             ` Anybody in US using ADA ? Kevin Cline
2003-01-03 12:37               ` Marin David Condic
2003-01-03 15:32                 ` Anybody in US using ADA ? | for interrest Mark
2003-01-09  0:59                 ` Anybody in US using ADA ? faust
2003-01-08 12:53                   ` Marin David Condic
2003-01-05 17:04           ` Adrian Hoe
2003-01-06 20:06             ` Randy Brukardt
2003-01-07  2:07             ` Jeffrey Creem
2003-01-07  3:22               ` Jeffrey Creem
2003-01-05 17:06         ` Adrian Hoe
2003-01-02  3:05       ` faust
2003-01-02  3:07       ` faust
2003-01-02 22:09       ` Robert C. Leif
2003-01-02 17:57     ` Anybody in US using ADA ? One silly idea Warren W. Gay VE3WWG
2003-01-02 18:29       ` Vinzent Hoefler
2003-01-02 22:02         ` Warren W. Gay VE3WWG
2003-01-02 20:36       ` Bill Findlay
     [not found]         ` <ujn2va.go3.ln@beastie.ix.netcom.com>
2003-01-03  1:44           ` Bill Findlay
2003-01-09  2:21           ` faust
2003-01-03  2:56         ` Marin David Condic
2003-01-03  4:11           ` sk
2003-01-03  4:43           ` Bill Findlay
2003-01-03  6:01             ` Robert C. Leif
2003-01-07 17:47               ` Kevin Cline
2003-01-07 19:49                 ` tmoran
2003-01-09  5:15                   ` Kevin Cline
2003-01-03 13:16             ` Marin David Condic
2003-01-03 18:28               ` Bill Findlay
2003-01-04 15:17                 ` Marin David Condic
2003-01-09 16:36                 ` faust
     [not found]                   ` <roliva.8b4.ln@beastie.ix.netcom.com>
2003-01-09  4:32                     ` Hyman Rosen
2003-01-03 20:07               ` tmoran
2003-01-03 23:06                 ` Martin Dowie
2003-01-09 16:22                   ` faust
2003-01-04  7:07                 ` Robert C. Leif
2003-01-04 17:49                   ` Steve
2003-01-05  3:07                     ` Robert C. Leif
2003-01-07 12:38               ` Richard Riehle
2003-01-09 16:36                 ` faust
2003-01-09 16:37                 ` Harness your own creativity to Ada (Re: Anybody in US using ADA ? One silly idea..) faust
2003-01-03  9:24         ` Anybody in US using ADA ? One silly idea Kevin Cline
2003-01-03 10:11           ` John R. Strohm
2003-01-03 13:23             ` Marin David Condic
2003-01-03 18:40               ` John R. Strohm
2003-01-04  9:05                 ` Kevin Cline
2003-01-04 16:34                   ` John R. Strohm
2003-01-03 19:40             ` Kevin Cline
2003-01-03 22:34           ` Ted Dennison
2003-01-04  8:53             ` Kevin Cline
2003-01-04 11:48               ` Dmitry A. Kazakov
2003-01-04 18:15                 ` Robert A Duff
2003-01-04 20:18                 ` Hillel Y. Sims
2003-01-05 14:13                   ` Dmitry A. Kazakov
2003-01-05 15:45                     ` James S. Rogers
2003-01-06 14:13                       ` Dmitry A. Kazakov
2003-01-06  1:20                     ` Hillel Y. Sims
2003-01-06 14:14                       ` Dmitry A. Kazakov
2003-01-06 19:07                         ` Randy Brukardt
2003-01-07 12:33                           ` Dmitry A. Kazakov
2003-01-08  4:24                             ` Hyman Rosen
2003-01-08 13:55                               ` Dmitry A. Kazakov
2003-01-08 18:43                                 ` Wes Groleau
2003-01-08 21:54                                 ` Ted Dennison
2003-01-09  5:05                                 ` Hyman Rosen
2003-01-06  1:37                     ` Robert C. Leif
2003-01-06 14:13                       ` Dmitry A. Kazakov
2003-01-06 19:13                         ` Pascal Obry
2003-01-07 12:02                           ` Dmitry A. Kazakov
2003-01-07  3:00                         ` Hyman Rosen
2003-01-07 12:10                           ` Dmitry A. Kazakov
2003-01-08  3:41                             ` Hyman Rosen
2003-01-08 13:19                               ` Dmitry A. Kazakov
2003-01-09  4:23                                 ` Hyman Rosen
2003-01-10 13:51                                   ` Dmitry A. Kazakov
2003-01-13 17:05                                     ` Hyman Rosen
2003-01-15 17:04                                       ` Dmitry A. Kazakov
2003-01-15 17:23                                         ` Hyman Rosen
2003-01-15 18:19                                           ` Bill Findlay
2003-01-15 19:02                                             ` Hyman Rosen
2003-01-15 19:11                                               ` Bill Findlay
2003-01-15 22:51                                                 ` chris.danx
2003-01-15 23:39                                                   ` Bill Findlay
2003-01-15 23:57                                                     ` chris.danx
2003-01-16  0:32                                                       ` Bill Findlay
2003-01-16  5:23                                                         ` Richard Riehle
2003-01-16 16:33                                                           ` One sillier idea Wes Groleau
2003-01-16 17:17                                                             ` sk
2003-01-16 17:11                                                           ` Anybody in US using ADA ? One silly idea Hyman Rosen
2003-01-16 17:50                                                             ` Richard Riehle
2003-01-16 17:57                                                             ` Frank J. Lhota
2003-01-16 18:26                                                               ` Wes Groleau
2003-01-17  8:27                                                                 ` Anders Wirzenius
     [not found]                                                                 ` <h0770b.5e3.ln@beastie.ix.netcom.com>
2003-01-17 17:32                                                                   ` Warren W. Gay VE3WWG
2003-01-17 17:31                                                               ` Warren W. Gay VE3WWG
2003-01-16  0:19                                             ` Richard Riehle
2003-01-16  0:16                                               ` chris.danx
2003-01-16  0:46                                                 ` Bill Findlay
2003-01-16  1:19                                                 ` Jeffrey Carter
2003-01-16  2:44                                                 ` Richard Riehle
2003-01-16  0:24                                               ` Bill Findlay
2003-01-16 10:34                                                 ` Jean-Pierre Rosen
2003-01-16 18:20                                           ` Dmitry A. Kazakov
2003-01-16 18:59                                             ` Hyman Rosen
2003-01-17  4:09                                               ` Richard Riehle
2003-01-17 14:36                                                 ` Hyman Rosen
2003-01-17 16:28                                               ` Dmitry A. Kazakov
2003-01-17 17:23                                                 ` Hyman Rosen
2003-01-17 19:02                                                   ` Richard Riehle
2003-01-17 20:02                                                     ` Hyman Rosen [this message]
2003-01-25  1:40                                                       ` Richard Riehle
2003-01-26  4:57                                                         ` Hyman Rosen
2003-01-18 12:31                                                   ` Dmitry A. Kazakov
2003-01-18 22:53                                                     ` Hillel Y. Sims
2003-01-19  6:18                                                       ` Kevin Cline
2003-01-19 12:34                                                       ` Dmitry A. Kazakov
2003-01-21  2:10                                                         ` Hillel Y. Sims
2003-01-21  9:25                                                           ` Dmitry A. Kazakov
2003-01-21 18:55                                                             ` Kevin Cline
2003-01-23 11:00                                                               ` Dmitry A. Kazakov
2003-01-23 16:27                                                                 ` Hyman Rosen
2003-01-25 11:53                                                                   ` Dmitry A. Kazakov
2003-01-26  6:32                                                                     ` Hyman Rosen
2003-01-27 10:11                                                                       ` Dmitry A. Kazakov
2003-01-27 15:08                                                                         ` Hyman Rosen
2003-01-28  8:27                                                                           ` Dmitry A. Kazakov
2003-01-28 15:48                                                                             ` Kevin Cline
2003-01-28 16:29                                                                               ` Dmitry A. Kazakov
2003-01-28 17:14                                                                                 ` Hyman Rosen
2003-01-29  8:28                                                                                   ` Dmitry A. Kazakov
2003-01-28 17:11                                                                             ` Hyman Rosen
2003-01-29  8:37                                                                               ` Dmitry A. Kazakov
2003-01-29 15:44                                                                                 ` Hyman Rosen
2003-01-29 21:34                                                                                   ` Mark Biggar
2003-01-29 22:54                                                                                     ` Hyman Rosen
2003-01-30  9:03                                                                                       ` Dmitry A. Kazakov
2003-01-30 14:59                                                                                         ` Hyman Rosen
2003-01-30 16:32                                                                                           ` Dmitry A. Kazakov
2003-01-30 17:58                                                                                             ` Hyman Rosen
2003-01-31  8:31                                                                                               ` Dmitry A. Kazakov
2003-01-31 15:02                                                                                                 ` Hyman Rosen
2003-01-31 16:12                                                                                                   ` Dmitry A. Kazakov
2003-01-31 17:11                                                                                                     ` Hyman Rosen
2003-02-03  9:59                                                                                                       ` Dmitry A. Kazakov
2003-02-03 13:26                                                                                                         ` Hyman Rosen
2003-02-03 16:12                                                                                                           ` Dmitry A. Kazakov
2003-02-03 17:00                                                                                                             ` Hyman Rosen
2003-02-04  9:54                                                                                                               ` Dmitry A. Kazakov
2003-02-04 14:50                                                                                                                 ` Colin Paul Gloster
2003-02-04 15:56                                                                                                                 ` Hyman Rosen
2003-02-05 12:53                                                                                                                   ` Dmitry A. Kazakov
2003-02-05 15:22                                                                                                                     ` Hyman Rosen
2003-02-05  7:02                                                                                                                 ` Amir Yantimirov
     [not found]                                                                                                             ` <en04h-1k4.ln1@beastie.ix.netcom.com>
2003-02-04  9:48                                                                                                               ` Dmitry A. Kazakov
2003-02-04 10:10                                                                                                             ` Colin Paul Gloster
2003-02-04 13:12                                                                                                               ` Dmitry A. Kazakov
2003-02-04 14:33                                                                                                                 ` Colin Paul Gloster
2003-02-04 15:22                                                                                                                   ` Dmitry A. Kazakov
2003-02-04 16:47                                                                                                                     ` Hyman Rosen
2003-02-04 15:10                                                                                                                 ` Hyman Rosen
2003-02-05 12:53                                                                                                                   ` Dmitry A. Kazakov
2003-02-05 15:35                                                                                                                     ` Hyman Rosen
2003-02-04  7:04                                                                                                     ` AG
2003-02-03 12:34                                                                                                       ` Dmitry A. Kazakov
2003-02-05  4:38                                                                                                         ` AG
2003-02-04 10:08                                                                                                           ` Dmitry A. Kazakov
2003-01-30  8:09                                                                                   ` Dmitry A. Kazakov
2003-01-30 15:01                                                                                     ` Hyman Rosen
2003-01-30 16:33                                                                                       ` Dmitry A. Kazakov
2003-01-30 17:12                                                                                         ` Stephen Leake
2003-01-31  8:51                                                                                           ` Dmitry A. Kazakov
2003-01-31 15:04                                                                                             ` Hyman Rosen
2003-01-30 18:01                                                                                         ` Hyman Rosen
2003-01-31  8:38                                                                                           ` Dmitry A. Kazakov
2003-01-31 15:11                                                                                             ` Hyman Rosen
2003-01-31 16:27                                                                                               ` Dmitry A. Kazakov
2003-01-31 17:25                                                                                                 ` Hyman Rosen
2003-02-03  9:59                                                                                                   ` Dmitry A. Kazakov
2003-02-03 13:11                                                                                                     ` Hyman Rosen
2003-02-03 14:40                                                                                                       ` Hyman Rosen
2003-02-04 10:11                                                                                                         ` Dmitry A. Kazakov
2003-02-04  6:34                                                                                                 ` AG
2003-02-03 12:58                                                                                                   ` Dmitry A. Kazakov
2003-01-27 16:04                                                                 ` Kevin Cline
2003-01-19  3:42                                                     ` Hyman Rosen
2003-01-19 12:34                                                       ` Dmitry A. Kazakov
2003-01-19 14:13                                                         ` Hyman Rosen
2003-01-20  8:43                                                           ` Dmitry A. Kazakov
2003-01-23 13:15                                                     ` please, please, please, Wes Groleau
2003-01-16 19:08                                             ` Anybody in US using ADA ? One silly idea Hyman Rosen
2003-01-17 16:28                                               ` Dmitry A. Kazakov
2003-01-17  4:03                                             ` Richard Riehle
2003-01-17 16:28                                               ` Dmitry A. Kazakov
2003-01-21  5:53                                                 ` Richard Riehle
2003-01-21  6:24                                                   ` tmoran
2003-01-16 19:09                                           ` Larry Kilgallen
2003-01-15 22:48                                         ` Robert A Duff
2003-01-16 18:20                                           ` Dmitry A. Kazakov
2003-01-25 16:05                                         ` Robert I. Eachus
2003-01-25 20:33                                           ` Richard Riehle
2003-01-27 13:29                                           ` Wes Groleau
2003-01-27 16:29                                           ` Hyman Rosen
2003-01-28 13:24                                             ` Robert A Duff
2003-01-28 17:16                                               ` Hyman Rosen
2003-01-28 18:44                                             ` Robert A Duff
2003-01-28 20:04                                               ` Hyman Rosen
2003-01-07 13:51                         ` Richard Riehle
2003-01-08  3:51                           ` Hyman Rosen
2003-01-06 16:33                       ` Georg Bauhaus
2003-01-06 16:23                     ` Wes Groleau
2003-01-06  4:20                 ` Kevin Cline
2003-01-06 14:16                   ` Dmitry A. Kazakov
2003-01-06 16:08                   ` Wes Groleau
2003-01-06 17:26                     ` James S. Rogers
2003-01-07 13:36                       ` Wes Groleau
2003-01-07 18:40                       ` David C. Hoos
2003-01-07 21:29                         ` James S. Rogers
2003-01-07  3:14                     ` Hyman Rosen
2003-01-07 13:40                       ` Wes Groleau
2003-01-08  4:30                         ` Hyman Rosen
2003-01-04 18:04               ` Ted Dennison
2003-01-04 20:20                 ` Hillel Y. Sims
2003-01-05  2:47                   ` Ted Dennison
2003-01-05 23:58                     ` [OT] Mozilla filtering " chris.danx
2003-01-06  4:12                       ` Ted Dennison
2003-01-06 16:54                         ` chris.danx
2003-01-06 16:31                     ` [off-topic] spam-filters Wes Groleau
2003-01-06 19:23                       ` Randy Brukardt
2003-01-07  2:59                         ` Ted Dennison
2003-01-07 18:49                           ` Randy Brukardt
2003-01-07 20:38                             ` tmoran
2003-01-07 21:01                             ` Wes Groleau
2003-01-07  1:19                       ` Ted Dennison
2003-01-07 13:46                         ` Wes Groleau
2003-01-09 16:24                     ` Anybody in US using ADA ? One silly idea faust
2003-01-09 15:04                       ` Ted Dennison
2003-01-10 14:23                         ` faust
2003-01-11  5:44                           ` Ted Dennison
2003-01-11  5:48                             ` Ted Dennison
2003-01-06  4:39                 ` Kevin Cline
2003-01-06  9:49                   ` Ted Dennison
2003-01-03  0:07       ` Robert C. Leif
2003-01-03  2:51       ` Marin David Condic
2003-01-03 18:13         ` Warren W. Gay VE3WWG
2003-01-04 15:30           ` Marin David Condic
2003-01-07 12:58         ` Richard Riehle
2003-01-08 19:46       ` Remarketing the language ( was Re: ....ADA ? One silly idea..) faust
2003-01-08 18:24         ` Warren W. Gay VE3WWG
2003-01-08 18:42           ` Edi Weitz
2003-01-09 16:30           ` faust
2003-01-10  7:00             ` Fraser Wilson
2003-01-10  8:06               ` Geoffrey Summerhayes
2003-01-10 10:17                 ` Fraser Wilson
2003-01-02 18:29     ` Anybody in US using ADA ? Mike Silva
2003-01-03  0:41       ` David Emery
2003-01-03  6:44         ` Mike Silva
2003-01-03 10:16           ` John R. Strohm
2003-01-03 20:02             ` Mike Silva
2003-01-03 22:16               ` John R. Strohm
2003-01-04  8:31                 ` Mike Silva
2003-01-06 22:24   ` Richard Riehle
2003-01-06 23:45     ` Jerry van Dijk
2003-01-07 18:35     ` Mike Silva
2003-01-07 20:34       ` Jerry Petrey
2003-01-07 21:07         ` Dead Fred the Head Red
2003-01-09  2:14     ` faust
2003-01-09  2:15     ` C++ , ADA and the Joint Strike Fighter ( was Re: Anybody in US using ADA ?) faust
2003-01-08 13:21       ` Ted Dennison
2003-01-08 13:51         ` C++ , ADA and the Joint Strike Fighter ( was Re: Anybody in USusing " Marin David Condic
2003-01-08 21:42           ` Ted Dennison
2003-01-09 16:27           ` faust
2003-01-08 21:44             ` C++ , ADA and the Joint Strike Fighter Vinzent Hoefler
2003-01-10  7:58               ` faust
2003-01-09 14:34                 ` Vinzent Hoefler
2003-01-09 14:57                   ` C++ , ADA and the Joint Strike Fighter (Off-topic) Larry Kilgallen
2003-01-09 17:10                   ` C++ , ADA and the Joint Strike Fighter Pascal Obry
2003-01-10 14:18                   ` faust
2003-01-09 19:29                     ` C++ , ADA and the Joint Strike Fighter (Off-topic) Larry Kilgallen
2003-01-11 19:31                       ` chris.danx
2003-01-12 22:22                         ` u.r. faust
2003-01-12  9:07                           ` tmoran
2003-01-13  4:20                             ` u.r. faust
2003-01-13 13:25                           ` Marin David Condic
2003-01-11 22:10                     ` Larry Kilgallen
     [not found]                     ` <H01kDjtzy1$7@eisneOrganization: LJK Software <oK$dhQDJBSHL@eisner.encompasserve.org>
2003-01-12 22:23                       ` u.r. faust
2003-01-09 12:34             ` C++ , ADA and the Joint Strike Fighter ( was Re: Anybody in USusing ADA ?) Marin David Condic
2002-12-31 22:38 ` Anybody in US using ADA ? Britt Snodgrass
  -- strict thread matches above, loose matches on Subject: below --
2003-01-03  1:18 Anybody in US using ADA ? One silly idea Alexandre E. Kopilovitch
2003-01-16 11:10 Grein, Christoph
2003-01-16 16:13 ` Stephen Leake
2003-01-16 16:53 ` Victor Porton
2003-01-17  6:08 Grein, Christoph
2003-02-03 10:13 Grein, Christoph
2003-02-05  5:44 ` AG
2003-02-04 16:05   ` Chad R. Meiners
2003-02-04  9:13 Grein, Christoph
2003-02-05  6:50 ` AG
2003-02-04 13:26   ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox