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

60 lines
1.6 KiB
C++
Raw Permalink Normal View History

2018-05-29 10:30:30 +00:00
/*=============================================================================
Copyright (c) 2011-2019 Bolero MURAKAMI
2018-05-29 10:30:30 +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)
=============================================================================*/
#ifndef SPROUT_UTILITY_SWALLOW_HPP
#define SPROUT_UTILITY_SWALLOW_HPP
#include <initializer_list>
#include <sprout/config.hpp>
namespace sprout {
//
2018-05-29 13:57:25 +00:00
// swallow_t
2018-05-29 10:30:30 +00:00
// swallow
//
2018-05-29 13:57:25 +00:00
// example:
// swallow({(void)pack, 0}...);
//
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
2018-05-29 14:09:43 +00:00
// template<typename T>
// 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;
// }
2018-05-29 13:57:25 +00:00
//
// 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
2018-05-29 10:30:30 +00:00
} // namespace sprout
#endif // #ifndef SPROUT_UTILITY_SWALLOW_HPP