mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
add tuple assignment for pair
This commit is contained in:
parent
ae9578ce37
commit
87ed3d5548
11 changed files with 262 additions and 26 deletions
49
sprout/static_warning.hpp
Normal file
49
sprout/static_warning.hpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2014 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_STATIC_WARNING_HPP
|
||||
#define SPROUT_STATIC_WARNING_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// static_warning
|
||||
//
|
||||
template<bool C>
|
||||
struct static_warning;
|
||||
template<>
|
||||
struct static_warning<true> {
|
||||
template<typename Message>
|
||||
static void warn() {}
|
||||
};
|
||||
template <>
|
||||
struct static_warning<false> {
|
||||
template<typename Message>
|
||||
static void warn() {
|
||||
Message static_warning_failed;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
//
|
||||
// SPROUT_STATIC_WARNING
|
||||
//
|
||||
#define SPROUT_STATIC_WARNING_IMPL_2(cond, msg, line) \
|
||||
struct sprout_static_warning_line_ ## line { \
|
||||
struct msg {}; \
|
||||
sprout_static_warning_line_ ## line() { \
|
||||
::sprout::static_warning<(cond)>:: \
|
||||
warn<void***** (msg::*****)()>(); \
|
||||
} \
|
||||
}
|
||||
#define SPROUT_STATIC_WARNING_IMPL(cond, msg) \
|
||||
SPROUT_STATIC_WARNING_IMPL_2(cond, msg, __LINE__)
|
||||
#define SPROUT_STATIC_WARNING(cond) \
|
||||
SPROUT_STATIC_WARNING_IMPL(cond, static_warning_failed)
|
||||
|
||||
#endif // #ifndef SPROUT_STATIC_WARNING_HPP
|
Loading…
Add table
Add a link
Reference in a new issue