C++ and Generic Programming for Rapid Development of Monte Carlo Simulations