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-10-27 02:24:47 +00:00
|
|
|
#ifndef SPROUT_DETAIL_CONTAINER_COMPLATE_HPP
|
|
|
|
#define SPROUT_DETAIL_CONTAINER_COMPLATE_HPP
|
|
|
|
|
|
|
|
#include <type_traits>
|
|
|
|
#include <sprout/config.hpp>
|
2012-03-31 07:24:13 +00:00
|
|
|
#include <sprout/container/traits.hpp>
|
|
|
|
#include <sprout/container/functions.hpp>
|
2011-10-27 02:24:47 +00:00
|
|
|
#include <sprout/iterator/operation.hpp>
|
2013-11-20 13:04:11 +00:00
|
|
|
#include <sprout/algorithm/fixed/results.hpp>
|
2011-10-27 02:24:47 +00:00
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
namespace detail {
|
|
|
|
template<typename Result, typename... Args>
|
2012-04-04 13:23:41 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
2012-03-31 07:24:13 +00:00
|
|
|
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
2013-11-20 13:04:11 +00:00
|
|
|
typename sprout::fixed::results::algorithm<Result>::type
|
2012-10-05 15:58:56 +00:00
|
|
|
>::type
|
|
|
|
container_complate_2(Result const& result, Args const&... args) {
|
2012-03-31 07:24:13 +00:00
|
|
|
return sprout::remake<Result>(result, sprout::size(result), args...);
|
2011-10-27 02:24:47 +00:00
|
|
|
}
|
|
|
|
template<typename Result, typename... Args>
|
2012-04-04 13:23:41 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
2012-03-31 07:24:13 +00:00
|
|
|
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
2013-11-20 13:04:11 +00:00
|
|
|
typename sprout::fixed::results::algorithm<Result>::type
|
2012-10-05 15:58:56 +00:00
|
|
|
>::type
|
|
|
|
container_complate_2(Result const& result, Args const&... args) {
|
2014-04-14 06:20:50 +00:00
|
|
|
return sprout::detail::container_complate_2(result, args..., *sprout::next(sprout::internal_begin(result), sizeof...(Args)));
|
2011-10-27 02:24:47 +00:00
|
|
|
}
|
|
|
|
template<typename Result, typename... Args>
|
2012-04-04 13:23:41 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
2012-03-31 07:24:13 +00:00
|
|
|
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
2013-11-20 13:04:11 +00:00
|
|
|
typename sprout::fixed::results::algorithm<Result>::type
|
2012-10-05 15:58:56 +00:00
|
|
|
>::type
|
|
|
|
container_complate_1(
|
2011-10-27 02:24:47 +00:00
|
|
|
Result const& result,
|
2013-07-22 13:00:09 +00:00
|
|
|
typename sprout::container_traits<Result>::difference_type,
|
2011-10-27 02:24:47 +00:00
|
|
|
Args const&... args
|
|
|
|
)
|
|
|
|
{
|
2012-03-31 07:24:13 +00:00
|
|
|
return sprout::remake<Result>(result, sprout::size(result), args...);
|
2011-10-27 02:24:47 +00:00
|
|
|
}
|
|
|
|
template<typename Result, typename... Args>
|
2012-04-04 13:23:41 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
2012-03-31 07:24:13 +00:00
|
|
|
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
2013-11-20 13:04:11 +00:00
|
|
|
typename sprout::fixed::results::algorithm<Result>::type
|
2012-10-05 15:58:56 +00:00
|
|
|
>::type
|
|
|
|
container_complate_1(
|
2011-10-27 02:24:47 +00:00
|
|
|
Result const& result,
|
2012-03-31 07:24:13 +00:00
|
|
|
typename sprout::container_traits<Result>::difference_type remain,
|
2011-10-27 02:24:47 +00:00
|
|
|
Args const&... args
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return remain != 0
|
2014-04-14 06:20:50 +00:00
|
|
|
? sprout::detail::container_complate_1(result, remain - 1, *sprout::next(sprout::internal_begin(result), remain - 1), args...)
|
|
|
|
: sprout::detail::container_complate_2(result, args...)
|
2011-10-27 02:24:47 +00:00
|
|
|
;
|
|
|
|
}
|
|
|
|
template<typename Result, typename... Args>
|
2012-04-04 13:23:41 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
2012-03-31 07:24:13 +00:00
|
|
|
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
2013-11-20 13:04:11 +00:00
|
|
|
typename sprout::fixed::results::algorithm<Result>::type
|
2012-10-05 15:58:56 +00:00
|
|
|
>::type
|
|
|
|
container_complate(Result const& result, Args const&... args) {
|
2012-03-31 07:24:13 +00:00
|
|
|
return sprout::remake<Result>(result, sprout::size(result), args...);
|
2011-10-27 02:24:47 +00:00
|
|
|
}
|
|
|
|
template<typename Result, typename... Args>
|
2012-04-04 13:23:41 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
2012-03-31 07:24:13 +00:00
|
|
|
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
2013-11-20 13:04:11 +00:00
|
|
|
typename sprout::fixed::results::algorithm<Result>::type
|
2012-10-05 15:58:56 +00:00
|
|
|
>::type
|
|
|
|
container_complate(Result const& result, Args const&... args) {
|
2014-04-14 06:20:50 +00:00
|
|
|
return sprout::detail::container_complate_1(result, sprout::internal_begin_offset(result), args...);
|
2011-10-27 02:24:47 +00:00
|
|
|
}
|
|
|
|
} // namespace detail
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_DETAIL_CONTAINER_COMPLATE_HPP
|