Results 1 to 8 of 8

Thread: Pass or change TYPE in other unit, possible?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Thank you for reply.

    Well in my map editor i need to compress map as fast as possible (there is specific algorithm used), in C++ i use std::map, now i have been looking at my archive of different things i have downloaded from the internet and found one zip with some stlpascal. Probably from here: https://code.google.com/p/stlpascal/

    I decided to try if could make the gmap.pas to work with my map block record (struct), because D7 doesnt support generics.
    I successfully modified it to my record (struct) and added comparison functions like: greaterthan, lessthan, equal. They are needed because stl std::map also needs them for specific things. And also did some other small modifications to make it compile in D7.

    It works and its very fast, faster than FPC fgl. And i mean a lot faster, even that stlpascal is very fast on FPC. Dunno why the original fgl included in FPC is so slow.

    I did test with biggest map i found, it had ~14000 blocks and original fgl code just stopped responding and i had to stop the process by myself.
    Now with stlpascal its instant. Just like with C++ std::map. Same with my D7 version.

    So i was thinking about maybe i could make it kinda "generic" for D7.
    And if i succeed i thought i would share it.

    That's why i asked how i could do such thing.

    In FPC all that works because it supports generics and i can use anything, but in D7 i have to manually specify type i want to use.
    But i dont feel like i want to switch to FP completely atm just because of generics..

    Tried to use pointers and typecasting but failed.
    I still dont know much about them..
    Last edited by hwnd; 16-12-2013 at 01:32 AM.

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
  •