Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TeeJay (2309)

TeeJay
  (email not shown publicly)
http://www.aarontrevena.co.uk/

Working in Truro
Graduate with BSc (Hons) in Computer Systems and Networks
pm : london.pm, bath.pm, devoncornwall.pm
lug : Devon & Cornwall LUG
CPAN : TEEJAY [cpan.org]
irc : TeeJay
skype : hashbangperl
livejournal : hashbangperl [livejournal.com]
flickr :hashbangperl [flickr.com]

Journal of TeeJay (2309)

Wednesday June 09, 2004
09:53 AM

C++ hilberts curve class

[ #19161 ]
On the train to guildford yesterday I managed to write a class to implement Hilberts Space Filling curve, porting it from the Perl module I have already done -- actually I just wanted a handy copy of the algorithm on which to base it as the C++ Class is pretty different.

Most of the time was spent getting used to debugging C++ and spotting silly mistakes rather than understanding OO C++.

Then I foolishly thought I might have time to do a demo using QT. No such look - all kinds of very strange errors, essentially I couldn't get anything to compile. GTK was much easier (both to compile and to understand).

I will probably just look at doing a demo with the GD library instead.

Oddly - the C++ will probably have less LoC than the perl version (excluding comments and pod) - some of that because its a Second System (and so quicker/easier to design), and some is because OOP in C++ can be more concise than perl, the C++ code is a bit clearer than the perl as it relies more on using class attributes to keep state than the equivilent code which uses more data structures (partly because data structures are much easier to deal with in Perl than C++, partly because the prototypes and earlier versions were procedural rather than OO).

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I have just discussed this subject on the Copenhagen Perl Mongers mailinglist - and I would very much like to see you Perl and C++ versions if there are publically available?
    • ok

      have a look at my C++ [droogs.org] and the perl

      the perl code is more mature, but also organic while the C++ is a rewrite, so it is better done.

      I think I could get the perl to be better, based on the C++ class, then the LoC would be marginally less than the C++ but the difference would be a lot smaller than I expected. I could probably optimise the C++ for LoC as well so its looking pretty even.

      The key part is the constructor and the up,down, etc methods - this is the core of the class and you can see how the C

      --

      @JAPH = qw(Hacker Perl Another Just);
      print reverse @JAPH;