Page 9 of 9 FirstFirst ... 789
Results 81 to 84 of 84

Thread: C/C++ vs Pascal

  1. #81
    Yes, for this project i needed only unique items to be added to std::map.
    http://www.sgi.com/tech/stl/Map.html

    It takes a custom sort routine and thanks to this i get only unique items.
    XE TDictionary is also fast enough, but it isn't able to get me same results as std:map.
    Probably because it doesn't handle collisions so well or something..

    I don't know. I even tried Decal and other std:map like things for XE and none of them were able to produce same results.

    Thas why i asked if it's possible to pass him some my own sort routine. So it handles collisions better and more precicely or something like that.


    Atm im just passing my data to DLL from Delphi and DLL uses std::map to make the processing of data.
    Works fine, but i wish i could do it without DLL's. Too bad, that Delphi is not able to link C++ .obj files, specially with STL code in them.



    Quote Originally Posted by Lifepower View Post
    TDictionary uses hash table for storing key/value parameters. I don't know how or why would you need to sort hashed entries unless there are collisions. There is also ToArray function, which returns TArray, the last one does support custom sorting routine.

    P.S. In my experience with TDictionary and XE 3, it is surprisingly fast, even with Unicode strings. I would definitely recommend it.

  2. #82
    I just stumbled across fpc version of map, called TFPGMap. Something like:
    Code:
    TMyMap = specialize TFPGMap <TObject, TObject>;
    It's hard to find any documentation about it though, last post in this message-chain seems relevant:
    http://web.archiveorange.com/archive...12vEIenhSBOh3g
    I'm also unsure what version of FPC is needed.

  3. #83
    I found this for D7:
    http://www.vanwal.nl/rbtree/

    But i didn't try it properly.

    Also found this for FP 2.7.1
    http://www.lazarus.freepascal.org/in...?topic=17902.0

    FPC 2.7.1 is needed to compile it. The older versions will not compile this one.

    Also this:
    http://code.google.com/p/stlpascal/

    Will try it later. Maybe i will have to port my editor to FreePascal / Lazarus to use this neat stuff. Dunno.


    Also i don't understand, why is FP 2.7.1 only available with Lazarus 1.1 (which btw, just crashes like crazy for me, i can't even use it) but not also as individual download?
    Last edited by hwnd; 13-09-2012 at 08:53 AM.

  4. #84
    2.7.1 is propably not considered stable yet. What i read quickly about TFPGMap too, is that there is no documentation yet because they're not even sure if they'll keep the syntax like that. It is the SVN version of freepascal, which i actually use along with SVN of Lazarus. Getting them compiled and running might be a little tricky though, but propably worth the effort.

    If you want to compile fpc from source code, you need to do that with previous earlier stable release of FPC. For FPC 2.7.1 you propably need to download FPC 2.6.0 (or 2.6.1?) and compile SVN with that. There can be a bit fiddling with fpc.cfg configs, system PATH-variables and so on. I don't like to do that often... It's easier to update SVN Lazarus, assuming those fpc.cfg and PATH's are set right to point the SVN version FPC.

Page 9 of 9 FirstFirst ... 789

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •