used decltype and underlying_type to improve Range code