2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2018-12-30 08:25:21 +00:00
|
|
|
Copyright (c) 2011-2018 Bolero MURAKAMI
|
2013-08-08 09:54:33 +00:00
|
|
|
https://github.com/bolero-MURAKAMI/Sprout
|
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
=============================================================================*/
|
2013-07-07 10:10:25 +00:00
|
|
|
#ifndef SPROUT_DETAIL_DIGITS_TO_INT_HPP
|
|
|
|
#define SPROUT_DETAIL_DIGITS_TO_INT_HPP
|
|
|
|
|
|
|
|
#include <sprout/config.hpp>
|
2013-11-22 12:11:08 +00:00
|
|
|
#include <sprout/type_traits/integral_constant.hpp>
|
2013-07-07 10:10:25 +00:00
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
namespace detail {
|
|
|
|
template<typename IntType, char... Chars>
|
|
|
|
struct digits_to_int;
|
|
|
|
template<typename IntType, char C>
|
|
|
|
struct digits_to_int<IntType, C>
|
2013-11-22 12:11:08 +00:00
|
|
|
: public sprout::integral_constant<IntType, IntType(C - 48)>
|
2013-07-07 10:10:25 +00:00
|
|
|
{};
|
|
|
|
template<typename IntType, char Head, char... Tail>
|
|
|
|
struct digits_to_int<IntType, Head, Tail...>
|
2013-11-22 12:11:08 +00:00
|
|
|
: public sprout::integral_constant<IntType, 10 * IntType(Head - 48) + sprout::detail::digits_to_int<IntType, Tail...>::value>
|
2013-07-07 10:10:25 +00:00
|
|
|
{};
|
|
|
|
} // namespace detail
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_DETAIL_DIGITS_TO_INT_HPP
|