use std::function for call back
Merge pull request #4796 from minggo/deprecated-function

use std::function for call back