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:

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)
{
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 |