C++ to VB6 again 
Author Message
 C++ to VB6 again

Hello again,

can anybody please tell me what this would resolved to in VB6?
------------------
typedef pair<int, string> Token;
typedef vector<Token> SomeToken;
typedef vector<SomeToken> SomeOtherToken;
------------------

Would...
------------------
Public Type pair
        First as Integer
        Second as String
End Type

Public SomeToken() as pair
Public SomeOtherToken() as pair
------------------
... be correct?

Thank you for the help again,
Reiner



Sun, 12 Feb 2012 21:17:01 GMT  
 C++ to VB6 again


Quote:
> Hello again,

> can anybody please tell me what this would resolved to in VB6?
> ------------------
> typedef pair<int, string> Token;
> typedef vector<Token> SomeToken;
> typedef vector<SomeToken> SomeOtherToken;
> ------------------

> Would...
> ------------------
> Public Type pair
> First as Integer
> Second as String
> End Type

> Public SomeToken() as pair
> Public SomeOtherToken() as pair
> ------------------
> ... be correct?

> Thank you for the help again,
> Reiner

In general yes.

But it depends on how you intend to use these items later on. For example,
in C++ a pair is an object, which allows it to be used in various contexts
such as a return from a function, or as a public member in a class. UDTs in
VB are a tad more limited.

You may be better off (though at the expense of some over-head) to define a
'pair' as a VB class.

Also if you are going to be expanding and shrinking the Token arrays, as
well as performing muiltiple inserts and deletes , you may find the VB
Collection a more useful container.

-ralph



Sun, 12 Feb 2012 21:41:57 GMT  
 C++ to VB6 again
Alright, I will use collections later on.
Thanks a lot again!

Reiner



Sun, 12 Feb 2012 21:53:02 GMT  
 C++ to VB6 again

Quote:
> Hello again,

> can anybody please tell me what this would resolved to in VB6?
> ------------------
> typedef pair<int, string> Token;
> typedef vector<Token> SomeToken;
> typedef vector<SomeToken> SomeOtherToken;
> ------------------

> Would...
> ------------------
> Public Type pair
> First as Integer
> Second as String
> End Type

> Public SomeToken() as pair
> Public SomeOtherToken() as pair
> ------------------
> ... be correct?

I think SomeOtherToken should be an array of an array. Example:

Public Type pair
First as Integer
Second as String
End Type

Public Type TSomeToken
    SomeToken() as pair
End Type

Public SomeOtherToken() as TSomeToken

More info about "typedef":

http://en.wikipedia.org/wiki/Typedef

If you don't mind me asking, what this C++ project does? Perhaps there is a
VB6 sample somewhere that does the same thing.



Sun, 12 Feb 2012 23:48:59 GMT  
 C++ to VB6 again
Ah, thanks!


Mon, 13 Feb 2012 04:02:41 GMT  
 C++ to VB6 again
If this for a parser type of application, check this VB6 based solution:

http://en.wikipedia.org/wiki/GOLD_(parser)



Mon, 13 Feb 2012 04:16:34 GMT  
 C++ to VB6 again


Quote:


> > Hello again,

> > can anybody please tell me what this would resolved to in VB6?
> > ------------------
> > typedef pair<int, string> Token;
> > typedef vector<Token> SomeToken;
> > typedef vector<SomeToken> SomeOtherToken;
> > ------------------

> > Would...
> > ------------------
> > Public Type pair
> > First as Integer
> > Second as String
> > End Type

> > Public SomeToken() as pair
> > Public SomeOtherToken() as pair
> > ------------------
> > ... be correct?

> I think SomeOtherToken should be an array of an array. Example:

> Public Type pair
> First as Integer
> Second as String
> End Type

> Public Type TSomeToken
>     SomeToken() as pair
> End Type

> Public SomeOtherToken() as TSomeToken

> More info about "typedef":

> http://en.wikipedia.org/wiki/Typedef

Just to be picky - With its common usage in C/C++ when both defining and
renaming structs within the same construct tends to blur the distinction;
C/C++'s 'typedef' keyword for defining another name for a 'type' has nothing
to do with VB's use of the term Type for defining structures.

-ralph



Mon, 13 Feb 2012 05:40:07 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. C++ again: Equivalent for ostream

2. AGAIN: VB6 Invalid Line...............

3. VB6: RICHED32.DLL compatibilityproblems, Microsoft DID IT AGAIN !!!

4. VB6 Reporting Again

5. CR8/VB6: Never asked for the parameters again?

6. VBA on again off again

7. Randomize and srand VB6/C++

8. VB6 and Visual C++ 6 automation

9. CS-RCS with VB6

10. VB6 and C++ questions

11. VB6 to C++ converter software

12. Converting C++ Datatypes to VB6

 

 
Powered by phpBB® Forum Software