Compilation of Generic Regular Path Expressions Using C++ Class Templates