use static_cast to avoid type comparsion.