mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-11-14 10:39:05 +00:00
fix swallow
This commit is contained in:
parent
10e239f933
commit
91b37d8f7f
2 changed files with 41 additions and 3 deletions
|
@ -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::swallow({(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...>
|
||||
|
|
|
@ -13,11 +13,49 @@
|
|||
|
||||
namespace sprout {
|
||||
//
|
||||
// swallow_t
|
||||
// swallow
|
||||
//
|
||||
// example:
|
||||
// swallow({(void)pack, 0}...);
|
||||
// ((void)pack, ..., swallow); // right fold, since C++17
|
||||
// (swallow, ..., (void)pack); // left fold, since C++17
|
||||
//
|
||||
struct swallow_t {
|
||||
public:
|
||||
template<typename T>
|
||||
inline SPROUT_CXX14_CONSTEXPR void
|
||||
operator()(std::initializer_list<T>) const SPROUT_NOEXCEPT {}
|
||||
};
|
||||
namespace {
|
||||
SPROUT_STATIC_CONSTEXPR sprout::swallow_t swallow = {};
|
||||
} // anonymous-namespace
|
||||
template<typename T>
|
||||
inline SPROUT_CXX14_CONSTEXPR void
|
||||
swallow(std::initializer_list<T>) SPROUT_NOEXCEPT {}
|
||||
inline SPROUT_CONSTEXPR sprout::swallow_t
|
||||
operator,(sprout::swallow_t, T&&) SPROUT_NOEXCEPT {
|
||||
return sprout::swallow;
|
||||
}
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR sprout::swallow_t
|
||||
operator,(T&&, sprout::swallow_t) SPROUT_NOEXCEPT {
|
||||
return sprout::swallow;
|
||||
}
|
||||
|
||||
//
|
||||
// unused_t
|
||||
// unused
|
||||
//
|
||||
struct unused_t {
|
||||
public:
|
||||
template<typename... Args>
|
||||
SPROUT_CONSTEXPR sprout::unused_t const&
|
||||
operator()(Args&&...) const SPROUT_NOEXCEPT {
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
namespace {
|
||||
SPROUT_STATIC_CONSTEXPR sprout::unused_t unused = {};
|
||||
} // anonymous-namespace
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_UTILITY_SWALLOW_HPP
|
||||
|
|
Loading…
Reference in a new issue