Switched the callback parameter to a template parameter and use std::enable_if to select the correct implementation