473,379 Members | 1,386 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,379 software developers and data experts.

STL and Managed C++.NET

As I try to create a list of pointers to a garbage collected class I've
created, I'm learning it's not without problems to create an instance of
such list. In fact, so far it won't let me. Apparently STL containers like
'list' are not garbage collected, hence all the managed/unmanaged
incompatibilities come to play (the two, managed and unmanaged code, can't
really be 'mixed freely' as advertised...hehe).

Any place I can look to help with this? I'm trying to do something like
this:

__gc class elementClass {} ;

typedef std::list<__gc class elementClass*> elementClass_Ptr_List ;

__gc class myClass
{
public:
void myMethod()
{
m_List = new elementClass_Ptr_List() ; // ** error here **
}

private:
elementClass_Ptr_List* m_List ;
}

The above compiles UNLESS I try to create an instance of the elementClass
list (the error line). I'd love to just have a 'full' instance of such a
list in myClass's definition (in contrast to a pointer I have to create a
'new' one for), but that fails to compile too.

So, any tutorials on-line on how to use STL with Managed C++.NET (2003)?

[==P==]


Nov 17 '05 #1
8 1507
Peter Oliphant wrote:
As I try to create a list of pointers to a garbage collected class
I've created, I'm learning it's not without problems to create an
instance of such list. In fact, so far it won't let me. Apparently
STL containers like 'list' are not garbage collected, hence all the
managed/unmanaged incompatibilities come to play (the two, managed
and unmanaged code, can't really be 'mixed freely' as
advertised...hehe).


STL.NET will be available with Visual Studio 2005, and allow what you want.

For now, you've got to resort to "more manual" methods : Either use a .NET
container (an ArrayList for example), either build a std::list from gcroot
(but this would of course make searching, sorting, etc, a bit more
complicated, since you need to resort to predicate based versions of these
operations).

See
http://www.codeproject.com/managedcp...select=1184146
for a disussion on the incoming VC2005, and STL.NET among other things.

Arnaud
MVP - VC
Nov 17 '05 #2
Unfortunately, STL.NET will not ship with .VS 2005 immedeately. It will be
shipped some time after.

At least if the decision has not been changed in the last weeks.

Marcus Heege

"Arnaud Debaene" <ad******@club-internet.fr> wrote in message
news:ei*************@TK2MSFTNGP10.phx.gbl...
Peter Oliphant wrote:
As I try to create a list of pointers to a garbage collected class
I've created, I'm learning it's not without problems to create an
instance of such list. In fact, so far it won't let me. Apparently
STL containers like 'list' are not garbage collected, hence all the
managed/unmanaged incompatibilities come to play (the two, managed
and unmanaged code, can't really be 'mixed freely' as
advertised...hehe).


STL.NET will be available with Visual Studio 2005, and allow what you
want.

For now, you've got to resort to "more manual" methods : Either use a .NET
container (an ArrayList for example), either build a std::list from gcroot
(but this would of course make searching, sorting, etc, a bit more
complicated, since you need to resort to predicate based versions of these
operations).

See
http://www.codeproject.com/managedcp...select=1184146
for a disussion on the incoming VC2005, and STL.NET among other things.

Arnaud
MVP - VC

Nov 17 '05 #3
Marcus Heege wrote:
Unfortunately, STL.NET will not ship with .VS 2005 immedeately. It
will be shipped some time after.

At least if the decision has not been changed in the last weeks.


Damn'it! Where has this been announced ?

Arnaud
MVP - VC
Nov 17 '05 #4
Marcus Heege wrote:
Unfortunately, STL.NET will not ship with .VS 2005 immedeately. It will be
shipped some time after.

At least if the decision has not been changed in the last weeks.

Marcus Heege


Probably, but the STL.NET Beta will ship. There is already have STL.NET
in VS 2005 Beta 2.

Tom
Nov 17 '05 #5
Arnaud Debaene wrote:
Marcus Heege wrote:
Unfortunately, STL.NET will not ship with .VS 2005 immedeately. It
will be shipped some time after.

At least if the decision has not been changed in the last weeks.


Damn'it! Where has this been announced ?


It was announced some time ago - several months IIRC.

-cd
Nov 17 '05 #6
Tamas Demjen wrote:
Marcus Heege wrote:
Unfortunately, STL.NET will not ship with .VS 2005 immedeately. It
will be shipped some time after.

At least if the decision has not been changed in the last weeks.

Marcus Heege


Probably, but the STL.NET Beta will ship. There is already have
STL.NET in VS 2005 Beta 2.


Those files actually weren't supposed to be included in Beta 2 even, they
just weren't removed from the install image until after beta 2 shipped.
Don't expect to see STL.NET in the release image for VS2005 - it'll be
released sometime after (hopefully not too long!)

-cd
Nov 17 '05 #7

"Tamas Demjen" <td*****@yahoo.com> wrote in message
news:uD*************@TK2MSFTNGP09.phx.gbl...
Marcus Heege wrote:
Unfortunately, STL.NET will not ship with .VS 2005 immedeately. It will
be shipped some time after.

At least if the decision has not been changed in the last weeks.

Marcus Heege
Probably, but the STL.NET Beta will ship. There is already have STL.NET in
VS 2005 Beta 2.

Tom


Yes, but they were included by mistake, later builds have the bits removed.

Here is what's been posted to the VC++ forum some time ago:
<
STL/CLR (STL .NET) is not supported in Beta 2. We are planning to release
the beta version of STL/CLR at the time of VS 2005 final release, and the
final release of STL/CLR via the web in 2006.

Anson Tsao
Lead Program Manager
Microsoft Visual C++


Willy.
Nov 17 '05 #8
Peter Oliphant wrote:
So, any tutorials on-line on how to use STL with Managed C++.NET (2003)?


I found this article pretty helpful:

http://www.codeproject.com/managedcpp/gcstl.asp
Nov 17 '05 #9

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

Similar topics

1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
1
by: lolomgwtf | last post by:
I have a managed C++ method that wraps unmanaged code and creates a managed object holding data retrieved form an unmanged one. I want create an instance of this managed class in C#, pass it to...
16
by: Ekim | last post by:
hello, I'm allocating a byte-Array in C# with byte byteArray = new byte; Now I want to pass this byte-Array to a managed C++-function by reference, so that I'm able to change the content of the...
2
by: lolomgwtf | last post by:
I have a managed C++ method that wraps unmanaged code and creates a managed object holding data retrieved form an unmanged one. I want create an instance of this managed class in C#, pass it to...
2
by: asanford | last post by:
We use StackWalk(StackWalk64) from dbghelp.dll to walk our callstacksas needed, using the various Sym* methods (SymGetSymFromAddr, SymGetLineFromAddr) to resolve source file, function name, and...
4
by: William F. Kinsley | last post by:
My understanding is that when I re-compile a existing MFC application with the /clr switch, that the code generated is managed(with some exceptions) but that the data isn't, i.e. not garbage...
9
by: Amit Dedhia | last post by:
Hi All I have a VC++ 2005 MFC application with all classes defined as unmanaged classes. I want to write my application data in xml format. Since ADO.NET has buit in functions available for...
12
by: DaTurk | last post by:
Hi, I have a rather interesting problem. I have a unmanged c++ class which needs to communicate information to managed c++ via callbacks, with a layer of c# on top of the managed c++ ultimatley...
3
by: Klaus | last post by:
Hi, I have an existing VC 6 MFC application which communicates asynchronly with a VC 2005 managed code dll. I use an unmanaged base class with virtual functions to access methods in the MFC...
8
by: Varangian | last post by:
Hello, was wondering of how to dispose of managed resources? or referencing every member of a class to null will release resources...? http://www.marcclifton.com/tabid/79/Default.aspx...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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...

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.