mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
add sprout::swallow
This commit is contained in:
parent
582e50e4a7
commit
10e239f933
4 changed files with 166 additions and 48 deletions
|
@ -18,7 +18,7 @@
|
|||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/utility/move.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
#include <sprout/utility/eat.hpp>
|
||||
#include <sprout/utility/swallow.hpp>
|
||||
#include <sprout/utility/pack.hpp>
|
||||
#include <sprout/utility/pair/pair_fwd.hpp>
|
||||
#include <sprout/type_traits/integral_constant.hpp>
|
||||
|
@ -286,7 +286,7 @@ namespace sprout {
|
|||
template<sprout::index_t... Indexes>
|
||||
SPROUT_CXX14_CONSTEXPR void
|
||||
swap_impl(tuple& other, sprout::index_tuple<Indexes...>) {
|
||||
sprout::eat((sprout::swap(base_type::template get<Indexes>(*this), base_type::template get<Indexes>(other)), 0)...);
|
||||
sprout::swallow({(sprout::swap(base_type::template get<Indexes>(*this), base_type::template get<Indexes>(other)), 0)...});
|
||||
}
|
||||
template<typename Tuple>
|
||||
SPROUT_CXX14_CONSTEXPR void
|
||||
|
@ -297,7 +297,7 @@ namespace sprout {
|
|||
SPROUT_CXX14_CONSTEXPR void
|
||||
assign_impl(Tuple&& t, sprout::index_tuple<Indexes...>) {
|
||||
typedef typename std::decay<Tuple>::type type;
|
||||
sprout::eat((sprout::eat(base_type::template get<Indexes>(*this) = sprout::move(type::template get<Indexes>(SPROUT_FORWARD(Tuple, t)))), 0)...);
|
||||
sprout::swallow({(base_type::template get<Indexes>(*this) = sprout::move(type::template get<Indexes>(SPROUT_FORWARD(Tuple, t))), 0)...});
|
||||
}
|
||||
template<sprout::index_t... Indexes>
|
||||
SPROUT_CONSTEXPR std::tuple<Types...>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/compare_pointees.hpp>
|
||||
#include <sprout/utility/swallow.hpp>
|
||||
#include <sprout/utility/eat.hpp>
|
||||
#include <sprout/utility/ignore_unused.hpp>
|
||||
#include <sprout/utility/limited.hpp>
|
||||
|
|
23
sprout/utility/swallow.hpp
Normal file
23
sprout/utility/swallow.hpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 Bolero MURAKAMI
|
||||
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)
|
||||
=============================================================================*/
|
||||
#ifndef SPROUT_UTILITY_SWALLOW_HPP
|
||||
#define SPROUT_UTILITY_SWALLOW_HPP
|
||||
|
||||
#include <initializer_list>
|
||||
#include <sprout/config.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// swallow
|
||||
//
|
||||
template<typename T>
|
||||
inline SPROUT_CXX14_CONSTEXPR void
|
||||
swallow(std::initializer_list<T>) SPROUT_NOEXCEPT {}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_UTILITY_SWALLOW_HPP
|
Loading…
Add table
Add a link
Reference in a new issue