Mercurial > code
changeset 645:2968cc4edd4c
to_int: use trailing return syntax
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 01 Aug 2018 14:06:59 +0200 |
parents | 0a947aec477c |
children | cba9782e10a7 |
files | cpp/to_int/to_int.hpp |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/cpp/to_int/to_int.hpp Wed Aug 01 14:06:11 2018 +0200 +++ b/cpp/to_int/to_int.hpp Wed Aug 01 14:06:59 2018 +0200 @@ -39,9 +39,9 @@ * \return the value or std::none if not convertible */ template <typename T = int> -std::optional<T> to_int(const std::string& str, - T min = std::numeric_limits<T>::min(), - T max = std::numeric_limits<T>::max()) noexcept +auto to_int(const std::string& str, + T min = std::numeric_limits<T>::min(), + T max = std::numeric_limits<T>::max()) noexcept -> std::optional<T> { static_assert(std::is_signed<T>::value, "must be signed"); @@ -64,9 +64,9 @@ * \return the value or std::none if not convertible */ template <typename T = unsigned> -std::optional<T> to_uint(const std::string& str, - T min = std::numeric_limits<T>::min(), - T max = std::numeric_limits<T>::max()) noexcept +auto to_uint(const std::string& str, + T min = std::numeric_limits<T>::min(), + T max = std::numeric_limits<T>::max()) noexcept -> std::optional<T> { static_assert(std::is_unsigned<T>::value, "must be unsigned");