diff --git a/sprout/tuple/tuple/tuple_decl.hpp b/sprout/tuple/tuple/tuple_decl.hpp index 59194d49..3c0d458e 100644 --- a/sprout/tuple/tuple/tuple_decl.hpp +++ b/sprout/tuple/tuple/tuple_decl.hpp @@ -297,7 +297,7 @@ namespace sprout { SPROUT_CXX14_CONSTEXPR void assign_impl(Tuple&& t, sprout::index_tuple) { typedef typename std::decay::type type; - sprout::swallow({(base_type::template get(*this) = sprout::move(type::template get(SPROUT_FORWARD(Tuple, t))), 0)...}); + sprout::swallow({((base_type::template get(*this) = sprout::move(type::template get(SPROUT_FORWARD(Tuple, t)))), 0)...}); } template SPROUT_CONSTEXPR std::tuple diff --git a/sprout/utility/swallow.hpp b/sprout/utility/swallow.hpp index 0546b240..83ce2137 100644 --- a/sprout/utility/swallow.hpp +++ b/sprout/utility/swallow.hpp @@ -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 + inline SPROUT_CXX14_CONSTEXPR void + operator()(std::initializer_list) const SPROUT_NOEXCEPT {} + }; + namespace { + SPROUT_STATIC_CONSTEXPR sprout::swallow_t swallow = {}; + } // anonymous-namespace template - inline SPROUT_CXX14_CONSTEXPR void - swallow(std::initializer_list) SPROUT_NOEXCEPT {} + inline SPROUT_CONSTEXPR sprout::swallow_t + operator,(sprout::swallow_t, T&&) SPROUT_NOEXCEPT { + return sprout::swallow; + } + template + inline SPROUT_CONSTEXPR sprout::swallow_t + operator,(T&&, sprout::swallow_t) SPROUT_NOEXCEPT { + return sprout::swallow; + } + + // + // unused_t + // unused + // + struct unused_t { + public: + template + 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