[Gambas-user] Data Structures like C++

tobi tobiasboege01 at ...1601...
Mon May 21 22:05:14 CEST 2012


On Mon, 21 May 2012, Demosthenes Koptsis wrote:
> Στις 21/5/2012 22:56, ο/η tobi έγραψε:
> > On Mon, 21 May 2012, Demosthenes Koptsis wrote:
> >> Basic languages have simple data structures like vars and arrays but
> >> other languages
> >> like c++ with the help of pointers can have advanced data structures
> >> like containers etc...
> >>
> >> see a full list here
> >> http://en.wikipedia.org/wiki/List_of_data_structures
> >>
> >> i wonder if such data structures can be implemented with gambas with
> >> pointers and if such an action have any mean for real life
> >> applications?
> >>
> >> Is it possible to have such data structures in gambas?
> >> How about some of these to be part of the core libraries?
> >>
> >>
> >>        Abstract data types<http://en.wikipedia.org/wiki/Abstract_data_types>
> >>
> >>    * Container<http://en.wikipedia.org/wiki/Container_%28data_structure%29>
> >>    * Map/Associative array/Dictionary
> >>      <http://en.wikipedia.org/wiki/Associative_array>
> >>    * Multimap<http://en.wikipedia.org/wiki/Multimap>
> >>    * List<http://en.wikipedia.org/wiki/List_%28abstract_data_type%29>
> >>    * Set<http://en.wikipedia.org/wiki/Set_%28computer_science%29>
> >>    * Multiset
> >>      <http://en.wikipedia.org/wiki/Set_%28computer_science%29#Multiset>
> >>    * Priority queue<http://en.wikipedia.org/wiki/Priority_queue>
> >>    * Queue<http://en.wikipedia.org/wiki/Queue_%28data_structure%29>
> >>    * Deque<http://en.wikipedia.org/wiki/Deque>
> >>    * Stack<http://en.wikipedia.org/wiki/Stack_%28data_structure%29>
> >>    * String<http://en.wikipedia.org/wiki/String_%28computer_science%29>
> >>    * Tree<http://en.wikipedia.org/wiki/Tree_%28computer_science%29>
> >>    * Graph<http://en.wikipedia.org/wiki/Graph_%28data_structure%29>
> >>    * Hash<http://en.wikipedia.org/wiki/Hash_Table>
> >>
> >>
> >> ------------------------------------------------------------------------------
> >> Live Security Virtual Conference
> >> Exclusive live event will cover all the ways today's security and
> >> threat landscape has changed and how IT managers can respond. Discussions
> >> will include endpoint security, mobile security and the latest in malware
> >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> >> _______________________________________________
> >> Gambas-user mailing list
> >> Gambas-user at lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> > When you mean "data structure like [in] C++" you mean those things we can do with gambas Objects?
> >
> > I could make a bunch of the ones listed above from scratch using classes - I tend to detest C++ but
> > I think, the ones above are nothing else? (Maybe gambas lacks templates or something)
> >
> > Regards,
> > Tobi
> >
> > ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> i mean to have a Binary Tree or a List with linked pointers etc ...
> i think most of them could be objects.
> 
> 
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

You don't need "pointers" in a C/C++ manner. In Gambas every "Object" is a reference:

TreeNode.class:
--8<---------------
Property Value As Variant
Property Read Parent As TreeNode
Property Read LeftChild As TreeNode
Property Read RightChild As TreeNode

Public Sub _new()
[...]
End

Public Sub CreateChildren()
[...]
End

[...]
--8<---------------




More information about the User mailing list