mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
fix coding-stype
This commit is contained in:
parent
2012838899
commit
df3023db30
196 changed files with 2510 additions and 3945 deletions
|
@ -11,12 +11,8 @@ namespace sprout {
|
|||
// count_n
|
||||
//
|
||||
template<typename InputIterator, typename Size, typename T>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type count_n(
|
||||
InputIterator first,
|
||||
Size n,
|
||||
T const& value
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
count_n(InputIterator first, Size n, T const& value) {
|
||||
return n == 0 ? 0
|
||||
: (*first == value ? 1 : 0) + sprout::detail::count_n(sprout::next(first), n - 1, value)
|
||||
;
|
||||
|
|
|
@ -11,12 +11,8 @@ namespace sprout {
|
|||
// count_n_if
|
||||
//
|
||||
template<typename InputIterator, typename Size, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type count_n_if(
|
||||
InputIterator first,
|
||||
Size n,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
count_n_if(InputIterator first, Size n, Predicate pred) {
|
||||
return n == 0 ? 0
|
||||
: (pred(*first) ? 1 : 0) + sprout::detail::count_n_if(sprout::next(first), n - 1, pred)
|
||||
;
|
||||
|
|
|
@ -8,17 +8,15 @@
|
|||
namespace sprout {
|
||||
namespace detail {
|
||||
template<typename InputIterator>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type overlap_count_impl(
|
||||
InputIterator first,
|
||||
InputIterator last,
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
overlap_count_impl(
|
||||
InputIterator first, InputIterator last,
|
||||
typename std::iterator_traits<InputIterator>::value_type const& value,
|
||||
typename std::iterator_traits<InputIterator>::difference_type current = 0
|
||||
)
|
||||
{
|
||||
return first == last
|
||||
? 0
|
||||
: *first == value
|
||||
? 1 + sprout::detail::overlap_count_impl(sprout::next(first), last, value)
|
||||
return first == last ? 0
|
||||
: *first == value ? 1 + sprout::detail::overlap_count_impl(sprout::next(first), last, value)
|
||||
: sprout::detail::overlap_count_impl(sprout::next(first), last, *first)
|
||||
;
|
||||
}
|
||||
|
@ -26,29 +24,22 @@ namespace sprout {
|
|||
// overlap_count
|
||||
//
|
||||
template<typename InputIterator>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type overlap_count(
|
||||
InputIterator first,
|
||||
InputIterator last
|
||||
)
|
||||
{
|
||||
return first == last
|
||||
? 0
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
overlap_count(InputIterator first, InputIterator last) {
|
||||
return first == last ? 0
|
||||
: sprout::detail::overlap_count_impl(sprout::next(first), last, *first)
|
||||
;
|
||||
}
|
||||
|
||||
template<typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type overlap_count_impl(
|
||||
InputIterator first,
|
||||
InputIterator last,
|
||||
Predicate pred,
|
||||
typename std::iterator_traits<InputIterator>::value_type const& value
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
overlap_count_impl(
|
||||
InputIterator first, InputIterator last,
|
||||
Predicate pred, typename std::iterator_traits<InputIterator>::value_type const& value
|
||||
)
|
||||
{
|
||||
return first == last
|
||||
? 0
|
||||
: pred(*first, value)
|
||||
? 1 + sprout::detail::overlap_count_impl(sprout::next(first), last, pred, value)
|
||||
return first == last ? 0
|
||||
: pred(*first, value) ? 1 + sprout::detail::overlap_count_impl(sprout::next(first), last, pred, value)
|
||||
: sprout::detail::overlap_count_impl(sprout::next(first), last, pred, *first)
|
||||
;
|
||||
}
|
||||
|
@ -56,14 +47,9 @@ namespace sprout {
|
|||
// overlap_count
|
||||
//
|
||||
template<typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type overlap_count(
|
||||
InputIterator first,
|
||||
InputIterator last,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return first == last
|
||||
? 0
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
overlap_count(InputIterator first, InputIterator last, Predicate pred) {
|
||||
return first == last ? 0
|
||||
: sprout::detail::overlap_count_impl(sprout::next(first), last, pred, *first)
|
||||
;
|
||||
}
|
||||
|
|
|
@ -11,11 +11,10 @@ namespace sprout {
|
|||
// set_overlap_count
|
||||
//
|
||||
template<typename InputIterator1, typename InputIterator2, typename Compare>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator1>::difference_type set_overlap_count(
|
||||
InputIterator1 first1,
|
||||
InputIterator1 last1,
|
||||
InputIterator2 first2,
|
||||
InputIterator2 last2,
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator1>::difference_type
|
||||
set_overlap_count(
|
||||
InputIterator1 first1, InputIterator1 last1,
|
||||
InputIterator2 first2, InputIterator2 last2,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
|
@ -32,11 +31,10 @@ namespace sprout {
|
|||
// set_overlap_count
|
||||
//
|
||||
template<typename InputIterator1, typename InputIterator2>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator1>::difference_type set_overlap_count(
|
||||
InputIterator1 first1,
|
||||
InputIterator1 last1,
|
||||
InputIterator2 first2,
|
||||
InputIterator2 last2
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator1>::difference_type
|
||||
set_overlap_count(
|
||||
InputIterator1 first1, InputIterator1 last1,
|
||||
InputIterator2 first2, InputIterator2 last2
|
||||
)
|
||||
{
|
||||
return first1 != last1 && first2 != last2
|
||||
|
|
|
@ -9,21 +9,24 @@
|
|||
namespace sprout {
|
||||
namespace detail {
|
||||
template<typename Elem, typename IntType>
|
||||
inline SPROUT_CONSTEXPR Elem int_to_char(IntType val, int base){
|
||||
inline SPROUT_CONSTEXPR Elem
|
||||
int_to_char(IntType val, int base) {
|
||||
return val >= 0 && val < 10 ? static_cast<Elem>('0') + val
|
||||
: val >= 10 && val < static_cast<IntType>(base) ? static_cast<Elem>('a') + (val - 10)
|
||||
: throw std::invalid_argument("value out of bounds")
|
||||
;
|
||||
}
|
||||
template<typename Elem, typename IntType>
|
||||
inline SPROUT_CONSTEXPR Elem int_to_char(IntType val){
|
||||
inline SPROUT_CONSTEXPR Elem
|
||||
int_to_char(IntType val) {
|
||||
return val >= 0 && val < 10 ? static_cast<Elem>('0') + val
|
||||
: throw std::invalid_argument("value out of bounds")
|
||||
;
|
||||
}
|
||||
|
||||
template<typename IntType, typename Elem>
|
||||
inline SPROUT_CONSTEXPR IntType char_to_int(Elem c, int base){
|
||||
inline SPROUT_CONSTEXPR IntType
|
||||
char_to_int(Elem c, int base) {
|
||||
return sprout::ascii::isdigit(c) && c - static_cast<Elem>('0') < base ? c - static_cast<Elem>('0')
|
||||
: sprout::ascii::islower(c) && c - static_cast<Elem>('a') + 10 < base ? c - static_cast<Elem>('a') + 10
|
||||
: sprout::ascii::isupper(c) && c - static_cast<Elem>('A') + 10 < base ? c - static_cast<Elem>('A') + 10
|
||||
|
@ -31,7 +34,8 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename IntType, typename Elem>
|
||||
inline SPROUT_CONSTEXPR IntType char_to_int(Elem c){
|
||||
inline SPROUT_CONSTEXPR IntType
|
||||
char_to_int(Elem c) {
|
||||
return sprout::ascii::isdigit(c) ? c - static_cast<Elem>('0')
|
||||
: static_cast<IntType>(-1)
|
||||
;
|
||||
|
|
|
@ -14,29 +14,24 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type container_complate_2(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
>::type
|
||||
container_complate_2(Result const& result, Args const&... args) {
|
||||
return sprout::remake<Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type container_complate_2(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
>::type
|
||||
container_complate_2(Result const& result, Args const&... args) {
|
||||
return container_complate_2(result, args..., *sprout::next(sprout::internal_begin(result), sizeof...(Args)));
|
||||
}
|
||||
template<typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type container_complate_1(
|
||||
>::type
|
||||
container_complate_1(
|
||||
Result const& result,
|
||||
typename sprout::container_traits<Result>::difference_type remain,
|
||||
Args const&... args
|
||||
|
@ -48,7 +43,8 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type container_complate_1(
|
||||
>::type
|
||||
container_complate_1(
|
||||
Result const& result,
|
||||
typename sprout::container_traits<Result>::difference_type remain,
|
||||
Args const&... args
|
||||
|
@ -63,22 +59,16 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type container_complate(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
>::type
|
||||
container_complate(Result const& result, Args const&... args) {
|
||||
return sprout::remake<Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type container_complate(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
>::type
|
||||
container_complate(Result const& result, Args const&... args) {
|
||||
return container_complate_1(result, sprout::internal_begin_offset(result), args...);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -14,29 +14,24 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type container_complate_backward_2(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
>::type
|
||||
container_complate_backward_2(Result const& result, Args const&... args) {
|
||||
return sprout::remake<Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type container_complate_backward_2(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
>::type
|
||||
container_complate_backward_2(Result const& result, Args const&... args) {
|
||||
return container_complate_backward_2(result, *sprout::prev(sprout::internal_end(result), sizeof...(Args) + 1), args...);
|
||||
}
|
||||
template<typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type container_complate_backward_1(
|
||||
>::type
|
||||
container_complate_backward_1(
|
||||
Result const& result,
|
||||
typename sprout::container_traits<Result>::difference_type remain,
|
||||
Args const&... args
|
||||
|
@ -48,7 +43,8 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type container_complate_backward_1(
|
||||
>::type
|
||||
container_complate_backward_1(
|
||||
Result const& result,
|
||||
typename sprout::container_traits<Result>::difference_type remain,
|
||||
Args const&... args
|
||||
|
@ -63,22 +59,16 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type container_complate_backward(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
>::type
|
||||
container_complate_backward(Result const& result, Args const&... args) {
|
||||
return sprout::remake<Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type container_complate_backward(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
>::type
|
||||
container_complate_backward(Result const& result, Args const&... args) {
|
||||
return container_complate_backward_1(result, sprout::internal_end_offset_backward(result), args...);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -15,8 +15,12 @@ namespace sprout {
|
|||
|
||||
template<result_type n>
|
||||
struct choose_initial_n {
|
||||
SPROUT_STATIC_CONSTEXPR bool c = (sprout::detail::static_log2_impl::argument_type(1) << n << n) != 0;
|
||||
SPROUT_STATIC_CONSTEXPR sprout::detail::static_log2_impl::result_type value = !c * n + choose_initial_n<2 * c * n>::value;
|
||||
SPROUT_STATIC_CONSTEXPR bool c
|
||||
= (sprout::detail::static_log2_impl::argument_type(1) << n << n) != 0
|
||||
;
|
||||
SPROUT_STATIC_CONSTEXPR sprout::detail::static_log2_impl::result_type value
|
||||
= !c * n + choose_initial_n<2 * c * n>::value
|
||||
;
|
||||
};
|
||||
template<>
|
||||
struct choose_initial_n<0> {
|
||||
|
@ -24,7 +28,9 @@ namespace sprout {
|
|||
};
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR sprout::detail::static_log2_impl::result_type n_zero = 16;
|
||||
SPROUT_STATIC_CONSTEXPR sprout::detail::static_log2_impl::result_type initial_n = sprout::detail::static_log2_impl::choose_initial_n<n_zero>::value;
|
||||
SPROUT_STATIC_CONSTEXPR sprout::detail::static_log2_impl::result_type initial_n
|
||||
= sprout::detail::static_log2_impl::choose_initial_n<n_zero>::value
|
||||
;
|
||||
|
||||
template<
|
||||
sprout::detail::static_log2_impl::argument_type x,
|
||||
|
@ -32,7 +38,9 @@ namespace sprout {
|
|||
>
|
||||
struct static_log2_impl {
|
||||
SPROUT_STATIC_CONSTEXPR bool c = (x >> n) > 0;
|
||||
SPROUT_STATIC_CONSTEXPR sprout::detail::static_log2_impl::result_type value = c * n + (static_log2_impl<(x >> c * n), n / 2>::value);
|
||||
SPROUT_STATIC_CONSTEXPR sprout::detail::static_log2_impl::result_type value
|
||||
= c * n + (static_log2_impl<(x >> c * n), n / 2>::value)
|
||||
;
|
||||
};
|
||||
template<>
|
||||
struct static_log2_impl<1, 0> {
|
||||
|
@ -42,7 +50,9 @@ namespace sprout {
|
|||
|
||||
template<sprout::detail::static_log2_argument_type x>
|
||||
struct static_log2 {
|
||||
SPROUT_STATIC_CONSTEXPR sprout::detail::static_log2_result_type value = sprout::detail::static_log2_impl::static_log2_impl<x>::value;
|
||||
SPROUT_STATIC_CONSTEXPR sprout::detail::static_log2_result_type value
|
||||
= sprout::detail::static_log2_impl::static_log2_impl<x>::value
|
||||
;
|
||||
};
|
||||
template<>
|
||||
struct static_log2<0> {};
|
||||
|
|
|
@ -27,7 +27,10 @@ namespace sprout {
|
|||
: FloatType(1)
|
||||
;
|
||||
}
|
||||
template<typename FloatType, typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler>
|
||||
template<
|
||||
typename FloatType,
|
||||
typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR FloatType
|
||||
float_pow10(int exponent) {
|
||||
return exponent < 0
|
||||
|
@ -53,7 +56,10 @@ namespace sprout {
|
|||
: 0
|
||||
;
|
||||
}
|
||||
template<typename FloatType, typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler>
|
||||
template<
|
||||
typename FloatType,
|
||||
typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR int
|
||||
float_exponent10(FloatType val) {
|
||||
return val < 0
|
||||
|
@ -69,7 +75,10 @@ namespace sprout {
|
|||
//
|
||||
// float_digits
|
||||
//
|
||||
template<typename FloatType, typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler>
|
||||
template<
|
||||
typename FloatType,
|
||||
typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR int
|
||||
float_digits_impl(FloatType val) {
|
||||
return val < 1 ? 0
|
||||
|
@ -88,7 +97,10 @@ namespace sprout {
|
|||
//
|
||||
// float_digit_at
|
||||
//
|
||||
template<typename FloatType, typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler>
|
||||
template<
|
||||
typename FloatType,
|
||||
typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR int
|
||||
float_digit_of_impl(FloatType val) {
|
||||
return static_cast<int>((val - sprout::floor(val)) * 10);
|
||||
|
@ -102,7 +114,10 @@ namespace sprout {
|
|||
//
|
||||
// float_round_at
|
||||
//
|
||||
template<typename FloatType, typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler>
|
||||
template<
|
||||
typename FloatType,
|
||||
typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR FloatType
|
||||
float_round_impl(FloatType val, FloatType p10) {
|
||||
return sprout::round(val * p10) / p10;
|
||||
|
|
|
@ -10,7 +10,10 @@ namespace sprout {
|
|||
//
|
||||
// int_pow
|
||||
//
|
||||
template<typename IntType, int Base = 10, typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler>
|
||||
template<
|
||||
typename IntType, int Base = 10,
|
||||
typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR IntType
|
||||
int_pow(int exponent) {
|
||||
return exponent ? Base * sprout::detail::int_pow<IntType, Base>(exponent - 1)
|
||||
|
@ -28,7 +31,10 @@ namespace sprout {
|
|||
: 0
|
||||
;
|
||||
}
|
||||
template<int Base = 10, typename IntType, typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler>
|
||||
template<
|
||||
int Base = 10, typename IntType,
|
||||
typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR int
|
||||
int_digits(IntType val) {
|
||||
return val ? 1 + sprout::detail::int_digits_impl<Base>(val / Base)
|
||||
|
@ -39,7 +45,10 @@ namespace sprout {
|
|||
//
|
||||
// int_digit_at
|
||||
//
|
||||
template<int Base = 10, typename IntType, typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler>
|
||||
template<
|
||||
int Base = 10, typename IntType,
|
||||
typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR int
|
||||
int_digit_at(IntType val, int digits) {
|
||||
return val < 0 ? -((val / sprout::detail::int_pow<IntType, Base>(digits)) % Base)
|
||||
|
|
|
@ -11,24 +11,16 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sizeof...(Values) == 0,
|
||||
R
|
||||
>::type param_at(
|
||||
std::size_t n,
|
||||
T const& v,
|
||||
Values const&... values
|
||||
)
|
||||
{
|
||||
>::type
|
||||
param_at(std::size_t n, T const& v, Values const&... values) {
|
||||
return v;
|
||||
}
|
||||
template<typename R, typename T, typename... Values>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sizeof...(Values) != 0,
|
||||
R
|
||||
>::type param_at(
|
||||
std::size_t n,
|
||||
T const& v,
|
||||
Values const&... values
|
||||
)
|
||||
{
|
||||
>::type
|
||||
param_at(std::size_t n, T const& v, Values const&... values) {
|
||||
return n == 0 ? v : sprout::detail::param_at<R>(n - 1, values...);
|
||||
}
|
||||
|
||||
|
@ -36,26 +28,16 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sizeof...(Values) == 0,
|
||||
R
|
||||
>::type param_seq_at(
|
||||
std::size_t n,
|
||||
std::size_t m,
|
||||
T const& v,
|
||||
Values const&... values
|
||||
)
|
||||
{
|
||||
>::type
|
||||
param_seq_at(std::size_t n, std::size_t m, T const& v, Values const&... values) {
|
||||
return v[m];
|
||||
}
|
||||
template<typename R, typename T, typename... Values>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sizeof...(Values) != 0,
|
||||
R
|
||||
>::type param_seq_at(
|
||||
std::size_t n,
|
||||
std::size_t m,
|
||||
T const& v,
|
||||
Values const&... values
|
||||
)
|
||||
{
|
||||
>::type
|
||||
param_seq_at(std::size_t n, std::size_t m, T const& v, Values const&... values) {
|
||||
return n == 0 ? v[m] : sprout::detail::param_seq_at<R>(n - 1, m, values...);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue