Patched for GNU C++ compatibility