It is nice to be able to blog about software. For instance, a few years ago I wrote an article about web development using C++ . I still get a comment or two about it almost every week, despite the fact that not a single line of code has been written for the project, unfortunately. However, if I ever took the initiative and started working on it, I would, no doubt, write some interesting progress reports here as well. As things go, it would be very neat to show off some code in the process. By using the Geshi source code highligher/formatter, it is much easier with Drupal nowadays. Just install the module, install the library and off you go!

Don't forget to enable/disable additional languages in the settings of the module.

Here is a nice example from the open source C++ library boost, taken from here :

class image;

class animation
{
public:

    void advance(int ms);
    bool inactive() const;
    void render(image & target) const;
};

std::vector<animation> anims;

template<class C, class P> void erase_if(C & c, P pred)
{
    c.erase(std::remove_if(c.begin(), c.end(), pred), c.end());
}

void update(int ms)
{
    std::for_each(anims.begin(), anims.end(), boost::bind(&animation::advance, _1, ms));
    erase_if(anims, boost::mem_fn(&animation::inactive));
}

void render(image & target)
{
    std::for_each(anims.begin(), anims.end(), boost::bind(&animation::render, _1, boost::ref(target)));
}
Tags: computers
Categories: None |

0 comments have been posted.

Your email: we will send you a confirmation link to this address to confirm your identity and to prevent robot posting
Get in touch
»...«
Join notification list

Join the email list to get notified about new posts and other updates

Follow updates

Join our social networks and RSS feed to keep up to date with latest news and publications