B
bor_kev
Hi,
First of all, i want to use the new managed class syntax and STL.NET
under Microsoft Visual (C++) Studio 2005 Beta.
I read in a Microsoft
article(http://msdn.microsoft.com/VISUALC/default.aspx?pull=/library/en-us/dnvs05/html/stl-netprimer.asp)
that i am suposed to include :
#include <cli/vector>
#include <algorithm>
in order to use properly STL.NET. However, everytime i include
#include <cli/vector> the compilator says : fatal error C1083
cannot open include file 'cli/vector' no such file or directory.So, i
can't use vectors, what i don't understand.
Secondly, i don't really get the purpose of the new managed class
syntax purpose. Before it was _gc class Myclass and now it's ref
class Myclass . Before we could write String * ptr and now it's
String ^ ptr.
Recently,i read an article from microsoft in their web site concerning
the new managed class syntax :
this is what i read :
"C++/CLI introduces a new category of type, the handle, which is used
to signify the use of automatic garbage collection. Handles borrow
the syntax of pointers, but use the carat (^) in place of the
asterisk (*). The keyword gcnew is used to create these garbage
collected objects, and returns a handle:
MyRefClass ^ c = gcnew MyRefClass();
"
they talk about handle.
in another article from Microsoft on the same topic. here is what i
read:
(it was an example about how to use the STL.NET new syntax)
"vector<String^> ^svec = gcnew vector<String^>;
svec->push_back("Pooh"); svec->push_back("Piglet");
svec->push_back("Eeyore"); svec->push_back("Rabbit");
// generic algorithm: sort
sort( svec->begin(), svec->end() );
Console::WriteLine( "Collection holds {0} elements: ",
svec->size() );"
My question is : if svec is a handle why don't we write:
svec.push_back("Pooh") instead of : svec->push_back("Pooh").
Actually, if they write it like that (svec->push_back("Pooh")) svec
is a pointer and not a handle. So, another question would be what's
the use for them to introduce the ^ sign if it works exactly the same
as the * sign?
Actually, i a m confused :
In my program, i cannot declare String label but String ^label(it's
mandatory). I have another String ^StringXML;
when i want to append them should i write stringXml->Concat(label)
?
or StringXml->Concat(*label) ?or StringXml.Concat(label) or
whatever...
There must be an answer.
I thank u in advance
Sincerely,
bor_kev
First of all, i want to use the new managed class syntax and STL.NET
under Microsoft Visual (C++) Studio 2005 Beta.
I read in a Microsoft
article(http://msdn.microsoft.com/VISUALC/default.aspx?pull=/library/en-us/dnvs05/html/stl-netprimer.asp)
that i am suposed to include :
#include <cli/vector>
#include <algorithm>
in order to use properly STL.NET. However, everytime i include
#include <cli/vector> the compilator says : fatal error C1083
cannot open include file 'cli/vector' no such file or directory.So, i
can't use vectors, what i don't understand.
Secondly, i don't really get the purpose of the new managed class
syntax purpose. Before it was _gc class Myclass and now it's ref
class Myclass . Before we could write String * ptr and now it's
String ^ ptr.
Recently,i read an article from microsoft in their web site concerning
the new managed class syntax :
this is what i read :
"C++/CLI introduces a new category of type, the handle, which is used
to signify the use of automatic garbage collection. Handles borrow
the syntax of pointers, but use the carat (^) in place of the
asterisk (*). The keyword gcnew is used to create these garbage
collected objects, and returns a handle:
MyRefClass ^ c = gcnew MyRefClass();
"
they talk about handle.
in another article from Microsoft on the same topic. here is what i
read:
(it was an example about how to use the STL.NET new syntax)
"vector<String^> ^svec = gcnew vector<String^>;
svec->push_back("Pooh"); svec->push_back("Piglet");
svec->push_back("Eeyore"); svec->push_back("Rabbit");
// generic algorithm: sort
sort( svec->begin(), svec->end() );
Console::WriteLine( "Collection holds {0} elements: ",
svec->size() );"
My question is : if svec is a handle why don't we write:
svec.push_back("Pooh") instead of : svec->push_back("Pooh").
Actually, if they write it like that (svec->push_back("Pooh")) svec
is a pointer and not a handle. So, another question would be what's
the use for them to introduce the ^ sign if it works exactly the same
as the * sign?
Actually, i a m confused :
In my program, i cannot declare String label but String ^label(it's
mandatory). I have another String ^StringXML;
when i want to append them should i write stringXml->Concat(label)
?
or StringXml->Concat(*label) ?or StringXml.Concat(label) or
whatever...
There must be an answer.
I thank u in advance
Sincerely,
bor_kev