Changed typeof to decltype to prevent compilation errors