www.digitalmars.com         C & C++   DMDScript  

c++ - Typedef templates ...

reply "Matthew Wilson" <matthew stlsoft.org> writes:
Walter

Do you fancy being the first (unless Comeau have beat you to it) to support
typedef templates (http://www.cuj.com/documents/s=7976/cujcexp2012sutter/)?
This would be a noteworthy achievement!

 template< typename T1
              ,  typename T2
             >
struct typedef_template_class
{
};

template <typename T1>
typedef typedef_template_class<T1, long>  typedef_template_typedef;

void typedef_template_fn()
{
  typedef_template_class<int, long>    a;
   typedef_template_typedef<int>       b;

  a == b; // Same type, so can assign
}

VC++ 7.1 recognises the construct but informs the command line that "a
typedef template is illegal", which suggests it'll be in the next release
(whenever that is), so you'll _have_ to do it eventually. Why not do it now
and be first?


Matthew
Jun 20 2003
next sibling parent "Walter" <walter digitalmars.com> writes:
It's a good idea. -Walter

"Matthew Wilson" <matthew stlsoft.org> wrote in message
news:bd04tn$a18$1 digitaldaemon.com...
 Walter

 Do you fancy being the first (unless Comeau have beat you to it) to

 typedef templates

 This would be a noteworthy achievement!

  template< typename T1
               ,  typename T2
              >
 struct typedef_template_class
 {
 };

 template <typename T1>
 typedef typedef_template_class<T1, long>  typedef_template_typedef;

 void typedef_template_fn()
 {
   typedef_template_class<int, long>    a;
    typedef_template_typedef<int>       b;

   a == b; // Same type, so can assign
 }

 VC++ 7.1 recognises the construct but informs the command line that "a
 typedef template is illegal", which suggests it'll be in the next release
 (whenever that is), so you'll _have_ to do it eventually. Why not do it

 and be first?


 Matthew

Jun 20 2003
prev sibling next sibling parent "Wichetael" <wichetael gmx.net> writes:
I would very dearly like to see that supported, it should prove very useful
in some particular projects.

Regards,

Remko van der Vossen

"Matthew Wilson" <matthew stlsoft.org> wrote in message
news:bd04tn$a18$1 digitaldaemon.com...
 Walter

 Do you fancy being the first (unless Comeau have beat you to it) to

 typedef templates

 This would be a noteworthy achievement!

  template< typename T1
               ,  typename T2
              >
 struct typedef_template_class
 {
 };

 template <typename T1>
 typedef typedef_template_class<T1, long>  typedef_template_typedef;

 void typedef_template_fn()
 {
   typedef_template_class<int, long>    a;
    typedef_template_typedef<int>       b;

   a == b; // Same type, so can assign
 }

 VC++ 7.1 recognises the construct but informs the command line that "a
 typedef template is illegal", which suggests it'll be in the next release
 (whenever that is), so you'll _have_ to do it eventually. Why not do it

 and be first?


 Matthew

Jun 21 2003
prev sibling parent reply "Greg Peet" <admin gregpeet.com> writes:
I just read article. That would be rather nifty indeed: The ability to
generalize the generalized!

"Matthew Wilson" <matthew stlsoft.org> wrote in message
news:bd04tn$a18$1 digitaldaemon.com...
 Walter

 Do you fancy being the first (unless Comeau have beat you to it) to

 typedef templates

 This would be a noteworthy achievement!

  template< typename T1
               ,  typename T2
              >
 struct typedef_template_class
 {
 };

 template <typename T1>
 typedef typedef_template_class<T1, long>  typedef_template_typedef;

 void typedef_template_fn()
 {
   typedef_template_class<int, long>    a;
    typedef_template_typedef<int>       b;

   a == b; // Same type, so can assign
 }

 VC++ 7.1 recognises the construct but informs the command line that "a
 typedef template is illegal", which suggests it'll be in the next release
 (whenever that is), so you'll _have_ to do it eventually. Why not do it

 and be first?


 Matthew

Jul 01 2003
parent "Matthew Wilson" <matthew stlsoft.org> writes:
The weird thing is, the first template I ever tried to write (way back in
who know's when) was a typedef template. When I finally worked out why it
didn't compile, I was stunned to learn that typedef templates were not in
the language.

eight or so years later and we're still waiting ...

It'd be cool if DMC++ could be the first compiler to support it.


"Greg Peet" <admin gregpeet.com> wrote in message
news:bdt3go$unp$1 digitaldaemon.com...
 I just read article. That would be rather nifty indeed: The ability to
 generalize the generalized!

 "Matthew Wilson" <matthew stlsoft.org> wrote in message
 news:bd04tn$a18$1 digitaldaemon.com...
 Walter

 Do you fancy being the first (unless Comeau have beat you to it) to

 typedef templates

 This would be a noteworthy achievement!

  template< typename T1
               ,  typename T2
              >
 struct typedef_template_class
 {
 };

 template <typename T1>
 typedef typedef_template_class<T1, long>  typedef_template_typedef;

 void typedef_template_fn()
 {
   typedef_template_class<int, long>    a;
    typedef_template_typedef<int>       b;

   a == b; // Same type, so can assign
 }

 VC++ 7.1 recognises the construct but informs the command line that "a
 typedef template is illegal", which suggests it'll be in the next


 (whenever that is), so you'll _have_ to do it eventually. Why not do it

 and be first?


 Matthew


Jul 01 2003