473,395 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

templates and managed code

Is there any plan to support templates with managed code in the (near)
future? For instance, VS.NET 2005... : )
Nov 17 '05 #1
11 1798
Peter Oliphant wrote:
Is there any plan to support templates with managed code in the (near)
future? For instance, VS.NET 2005... : )


Templates have always (i.e. from the VS 2002 / 7.0 version) been
supported in managed code.

Templates on CLR types are supported starting with the VS 2005 / 8.0
versions.

Ronald Laeremans
Visual C++ team
Nov 17 '05 #2
Hey Peter

See http://www.codeproject.com/managedcpp/whycppcli.asp

See the section titled "Managed templates"

--
Regards,
Nish [VC++ MVP]
"Peter Oliphant" <po*******@RoundTripInc.com> wrote in message
news:OU**************@TK2MSFTNGP10.phx.gbl...
Is there any plan to support templates with managed code in the (near)
future? For instance, VS.NET 2005... : )

Nov 17 '05 #3
template< int x >
class X {} ; // just fine

template< int y >
__gc classY{} ; //error C3151 '__gc' can't be applied to a template

What do you mean by 'templates have always been supported' if the simple
code above generates an error specifically saying you can't use '__gc' with
a template? [ I'm using the 2003 pro version of VC++.NET]

I guess I don't know what a CLR type is... : )
"Ronald Laeremans [MSFT]" <ro*****@online.microsoft.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Peter Oliphant wrote:
Is there any plan to support templates with managed code in the (near)
future? For instance, VS.NET 2005... : )


Templates have always (i.e. from the VS 2002 / 7.0 version) been supported
in managed code.

Templates on CLR types are supported starting with the VS 2005 / 8.0
versions.

Ronald Laeremans
Visual C++ team

Nov 17 '05 #4
Peter Oliphant wrote:
template< int x >
class X {} ; // just fine

template< int y >
__gc classY{} ; //error C3151 '__gc' can't be applied to a template

What do you mean by 'templates have always been supported' if the
simple code above generates an error specifically saying you can't
use '__gc' with a template? [ I'm using the 2003 pro version of
VC++.NET]
I guess I don't know what a CLR type is... : )


You can' declare managed template types, but you can use templates inside
Managed C++ code (in non-gc types).

Starting with VC2005 and CLI, you can use generics on managed types
(although not really as powerful as templates, generics are a first step in
the right direction).

Arnaud
MVP - VC
Nov 17 '05 #5
Managed templates are supported starting VC++ 2005 (and I believe it's only
for the new syntax).

VC++ 2003 did not support managed templates. But, what Ronald meant is that
your native templates would compile with /clr turned on - doesn't mean you
can have __gc template classes.

--
Regards,
Nish [VC++ MVP]
"Peter Oliphant" <po*******@RoundTripInc.com> wrote in message
news:u7**************@TK2MSFTNGP12.phx.gbl...
template< int x >
class X {} ; // just fine

template< int y >
__gc classY{} ; //error C3151 '__gc' can't be applied to a template

What do you mean by 'templates have always been supported' if the simple
code above generates an error specifically saying you can't use '__gc'
with a template? [ I'm using the 2003 pro version of VC++.NET]

I guess I don't know what a CLR type is... : )
"Ronald Laeremans [MSFT]" <ro*****@online.microsoft.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Peter Oliphant wrote:
Is there any plan to support templates with managed code in the (near)
future? For instance, VS.NET 2005... : )


Templates have always (i.e. from the VS 2002 / 7.0 version) been
supported in managed code.

Templates on CLR types are supported starting with the VS 2005 / 8.0
versions.

Ronald Laeremans
Visual C++ team


Nov 17 '05 #6
Cool that it will be supported in 2005 (which will be released when? It's
close to needing a name change to 2006...lol)...

Will multiple-inheritance for managed (__gc) classes also be supported
perchance? In this case I would assume, if it's allowed at all, that when
creating a new managed multiple-inheritance class it would allow the use of
only *managed* base classes as parents...

Or is there a way to do managed multiple-inheritance now?

"Nishant Sivakumar" <ni**@nospam.asianetindia.com> wrote in message
news:u1****************@TK2MSFTNGP12.phx.gbl...
Managed templates are supported starting VC++ 2005 (and I believe it's
only for the new syntax).

VC++ 2003 did not support managed templates. But, what Ronald meant is
that your native templates would compile with /clr turned on - doesn't
mean you can have __gc template classes.

--
Regards,
Nish [VC++ MVP]
"Peter Oliphant" <po*******@RoundTripInc.com> wrote in message
news:u7**************@TK2MSFTNGP12.phx.gbl...
template< int x >
class X {} ; // just fine

template< int y >
__gc classY{} ; //error C3151 '__gc' can't be applied to a template

What do you mean by 'templates have always been supported' if the simple
code above generates an error specifically saying you can't use '__gc'
with a template? [ I'm using the 2003 pro version of VC++.NET]

I guess I don't know what a CLR type is... : )
"Ronald Laeremans [MSFT]" <ro*****@online.microsoft.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Peter Oliphant wrote:
Is there any plan to support templates with managed code in the (near)
future? For instance, VS.NET 2005... : )

Templates have always (i.e. from the VS 2002 / 7.0 version) been
supported in managed code.

Templates on CLR types are supported starting with the VS 2005 / 8.0
versions.

Ronald Laeremans
Visual C++ team



Nov 17 '05 #7
On Tue, 11 Oct 2005 15:31:43 -0700, "Peter Oliphant"
<po*******@RoundTripInc.com> wrote:
Cool that it will be supported in 2005 (which will be released when? It's
close to needing a name change to 2006...lol)...
See:

http://lab.msdn.microsoft.com/vs2005/

The "Launch Tour" begins Nov 7, so I guess it'll all be available then.
Will multiple-inheritance for managed (__gc) classes also be supported
perchance? In this case I would assume, if it's allowed at all, that when
creating a new managed multiple-inheritance class it would allow the use of
only *managed* base classes as parents...

Or is there a way to do managed multiple-inheritance now?


The CLR allows a class to implement multiple interfaces, but it doesn't
support multiple inheritance of classes. The new C++/CLI language follows
the CLR WRT managed types.

--
Doug Harrison
Visual C++ MVP
Nov 17 '05 #8

Peter Oliphant wrote:
Cool that it will be supported in 2005
Beware that managed generics are *NOT* templates, although the
(unfortunately IMHO) share most of their syntax. Mainly, generics do
not support specialization (partial or total), nor dependent types
definition/inference. On the other side, generics use a mechanism to
restrict what instanciations are authorized for a given "template".


Will multiple-inheritance for managed (__gc) classes also be supported
perchance? Managed C++ allows only interface multiple-inheritance and class single
inheritance. Otherwise, it would be incompatible with other .NET
langages and the .NET CLR.

Or is there a way to do managed multiple-inheritance now?

You can multiple-inherits from interfaces. Implementation
multiple-inheritance, although sometimes invaluable, should bu used
only on rare occasions anyway (most of the time, using MI means that
you are using inheritance for something else than the Liskov
Substitution principle).

Arnaud
MVP - VC

Nov 17 '05 #9
>Beware that managed generics are *NOT* templates, although the
(unfortunately IMHO) share most of their syntax. Mainly, generics do
not support specialization (partial or total), nor dependent types
definition/inference. On the other side, generics use a mechanism to
restrict what instanciations are authorized for a given "template".
I wasn't talking about generics - I was talking about managed templates
which support specialization, derivation from the template parameter type
etc.

--
Regards,
Nish [VC++ MVP]
http://www.voidnish.com
http://blog.voidnish.com
<ad******@club-internet.fr> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
Peter Oliphant wrote:
Cool that it will be supported in 2005


Beware that managed generics are *NOT* templates, although the
(unfortunately IMHO) share most of their syntax. Mainly, generics do
not support specialization (partial or total), nor dependent types
definition/inference. On the other side, generics use a mechanism to
restrict what instanciations are authorized for a given "template".


Will multiple-inheritance for managed (__gc) classes also be supported
perchance?

Managed C++ allows only interface multiple-inheritance and class single
inheritance. Otherwise, it would be incompatible with other .NET
langages and the .NET CLR.

Or is there a way to do managed multiple-inheritance now?

You can multiple-inherits from interfaces. Implementation
multiple-inheritance, although sometimes invaluable, should bu used
only on rare occasions anyway (most of the time, using MI means that
you are using inheritance for something else than the Liskov
Substitution principle).

Arnaud
MVP - VC

Nov 17 '05 #10
Nishant Sivakumar wrote:
Beware that managed generics are *NOT* templates, although the
(unfortunately IMHO) share most of their syntax. Mainly, generics do
not support specialization (partial or total), nor dependent types
definition/inference. On the other side, generics use a mechanism to
restrict what instanciations are authorized for a given "template".


I wasn't talking about generics - I was talking about managed
templates which support specialization, derivation from the template
parameter type etc.


I know, but I was not sure that Peter Oliphant was aware of the difference.

Arnaud
MVP - VC
Nov 17 '05 #11
Hi Arnad,
I know, but I was not sure that Peter Oliphant was aware of the
difference.
I wasn't till now, so thanx for info! In fact, thanks to all who have
participated in this thread... : )

[==P==]

"Arnaud Debaene" <ad******@club-internet.fr> wrote in message
news:ul**************@TK2MSFTNGP09.phx.gbl... Nishant Sivakumar wrote:
Beware that managed generics are *NOT* templates, although the
(unfortunately IMHO) share most of their syntax. Mainly, generics do
not support specialization (partial or total), nor dependent types
definition/inference. On the other side, generics use a mechanism to
restrict what instanciations are authorized for a given "template".


I wasn't talking about generics - I was talking about managed
templates which support specialization, derivation from the template
parameter type etc.


I know, but I was not sure that Peter Oliphant was aware of the
difference.

Arnaud
MVP - VC

Nov 17 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Steven C. | last post by:
When you compile a cpp program that includes a template class in a .h file where does the compiled code go for that templated class? If it went in the obj for the cpp program seems to me you could...
7
by: Bob Weiner | last post by:
Hi, Forgive me if this has already been discussed but does C# have a construct like C++ templates? bob
2
by: Mr.Tickle | last post by:
So whats the deal here regarding Generics in the 2004 release and templates currently in C++?
4
by: Ana Farcas via .NET 247 | last post by:
hello, i have an old library i need to port to .net. the old library is written in visual c++ 6.0 and uses templated classes. if i compile the library (after having gone through the conversion...
0
by: WithPit | last post by:
I am creating a wrapper around an existing C++ library. A lot of classes and methods are wrapped but there are still some little problems. One of the problem is the use of templates in C++ which...
7
by: Bern McCarty | last post by:
We have some large mixed .dlls. The percentage of code that is managed is small relative to the percentage of native code. We generally want to favor native callers. But I am struggling with the...
1
by: Greg | last post by:
Referring to Managed: why do templates require an explicit copy constructor to be defined in order to use gcnew whereas simply declaring an object as a local (still uses managed heap of course)...
25
by: Ted | last post by:
I'm putting the posts that follow here (hopefully they will follow here!) because they were rejected in comp.lang.c++.moderated. It behooves anyone reading them to first read the the thread of the...
3
by: Steven T. Hatton | last post by:
Has anybody here used explicit instantiation of templates? Has it worked well? Are there any issues to be aware of? -- NOUN:1. Money or property bequeathed to another by will. 2. Something...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.