1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00
Sprout/sprout/tuple/operation/pop_front.hpp

54 lines
1.7 KiB
C++
Raw Normal View History

2013-08-08 09:54:33 +00:00
/*=============================================================================
Copyright (c) 2011-2017 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)
=============================================================================*/
2012-07-18 12:44:31 +00:00
#ifndef SPROUT_TUPLE_OPERATION_POP_FRONT_HPP
#define SPROUT_TUPLE_OPERATION_POP_FRONT_HPP
#include <sprout/config.hpp>
2013-04-06 04:06:51 +00:00
#include <sprout/index_tuple/metafunction.hpp>
2012-07-18 12:44:31 +00:00
#include <sprout/tuple/tuple.hpp>
#include <sprout/tuple/functions.hpp>
#include <sprout/type/operation/pop_front.hpp>
namespace sprout {
namespace tuples {
namespace results {
2012-07-18 12:44:31 +00:00
//
// pop_front
//
template<typename Tuple>
struct pop_front
: public sprout::types::pop_front<Tuple>
{};
} // namespace results
2012-07-18 12:44:31 +00:00
namespace detail {
template<typename Result, typename Tuple, sprout::index_t... Indexes>
2012-10-06 04:53:07 +00:00
inline SPROUT_CONSTEXPR Result
pop_front_impl(Tuple const& t, sprout::index_tuple<Indexes...>) {
2012-07-18 12:44:31 +00:00
return sprout::tuples::remake<Result>(
t,
sprout::tuples::get<Indexes>(t)...
);
}
} // namespace detail
//
// pop_front
//
template<typename Tuple>
inline SPROUT_CONSTEXPR typename sprout::tuples::results::pop_front<Tuple>::type
2012-10-06 04:53:07 +00:00
pop_front(Tuple const& t) {
return sprout::tuples::detail::pop_front_impl<typename sprout::tuples::results::pop_front<Tuple>::type>(
2012-07-18 12:44:31 +00:00
t,
sprout::index_range<1, sprout::tuples::tuple_size<Tuple>::value>::make()
);
}
} // namespace tuples
} // namespace sprout
#endif // #ifndef SPROUT_TUPLE_OPERATION_POP_FRONT_HPP