2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2016-02-25 09:48:28 +00:00
|
|
|
Copyright (c) 2011-2016 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)
|
|
|
|
=============================================================================*/
|
2011-09-01 02:48:32 +00:00
|
|
|
#ifndef SPROUT_DETAIL_PARAM_AT_HPP
|
|
|
|
#define SPROUT_DETAIL_PARAM_AT_HPP
|
|
|
|
|
|
|
|
#include <type_traits>
|
|
|
|
#include <sprout/config.hpp>
|
2014-04-30 07:30:26 +00:00
|
|
|
#include <sprout/workaround/std/cstddef.hpp>
|
2011-09-01 02:48:32 +00:00
|
|
|
|
|
|
|
namespace sprout {
|
2012-04-14 15:48:31 +00:00
|
|
|
namespace detail {
|
|
|
|
template<typename R, typename T, typename... Values>
|
|
|
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
|
|
|
sizeof...(Values) == 0,
|
|
|
|
R
|
2012-10-05 15:58:56 +00:00
|
|
|
>::type
|
2013-07-22 13:00:09 +00:00
|
|
|
param_at(std::size_t, T const& v, Values const&...) {
|
2012-04-14 15:48:31 +00:00
|
|
|
return v;
|
|
|
|
}
|
|
|
|
template<typename R, typename T, typename... Values>
|
|
|
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
|
|
|
sizeof...(Values) != 0,
|
|
|
|
R
|
2012-10-05 15:58:56 +00:00
|
|
|
>::type
|
|
|
|
param_at(std::size_t n, T const& v, Values const&... values) {
|
2012-04-14 15:48:31 +00:00
|
|
|
return n == 0 ? v : sprout::detail::param_at<R>(n - 1, values...);
|
|
|
|
}
|
2012-04-23 09:37:14 +00:00
|
|
|
|
|
|
|
template<typename R, typename T, typename... Values>
|
|
|
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
|
|
|
sizeof...(Values) == 0,
|
|
|
|
R
|
2012-10-05 15:58:56 +00:00
|
|
|
>::type
|
2013-07-22 13:00:09 +00:00
|
|
|
param_seq_at(std::size_t, std::size_t m, T const& v, Values const&...) {
|
2012-04-23 09:37:14 +00:00
|
|
|
return v[m];
|
|
|
|
}
|
|
|
|
template<typename R, typename T, typename... Values>
|
|
|
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
|
|
|
sizeof...(Values) != 0,
|
|
|
|
R
|
2012-10-05 15:58:56 +00:00
|
|
|
>::type
|
|
|
|
param_seq_at(std::size_t n, std::size_t m, T const& v, Values const&... values) {
|
2012-04-23 09:37:14 +00:00
|
|
|
return n == 0 ? v[m] : sprout::detail::param_seq_at<R>(n - 1, m, values...);
|
|
|
|
}
|
2012-04-14 15:48:31 +00:00
|
|
|
} // namespace detail
|
2011-09-01 02:48:32 +00:00
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_DETAIL_PARAM_AT_HPP
|