C++ generic search framework