2014-03-01 01:35:24 +00:00
|
|
|
/*=============================================================================
|
2015-01-10 10:13:57 +00:00
|
|
|
Copyright (c) 2011-2015 Bolero MURAKAMI
|
2014-03-01 01:35:24 +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_STATIC_ASSERT_HPP
|
|
|
|
#define SPROUT_STATIC_ASSERT_HPP
|
|
|
|
|
|
|
|
#include <sprout/config.hpp>
|
2014-07-03 14:41:40 +00:00
|
|
|
#include <sprout/preprocessor/config.hpp>
|
2014-03-01 01:35:24 +00:00
|
|
|
#include <sprout/preprocessor/stringize.hpp>
|
2014-08-13 10:31:52 +00:00
|
|
|
#include <sprout/preprocessor/cat.hpp>
|
2014-07-03 14:41:40 +00:00
|
|
|
#include <sprout/preprocessor/variadic/size.hpp>
|
2014-03-01 01:35:24 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// SPROUT_STATIC_ASSERT_MSG
|
|
|
|
//
|
|
|
|
#define SPROUT_STATIC_ASSERT_MSG(COND, MESSAGE) \
|
|
|
|
static_assert(COND, MESSAGE)
|
2014-07-03 14:41:40 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// SPROUT_STATIC_ASSERT
|
|
|
|
//
|
|
|
|
#define SPROUT_STATIC_ASSERT_1(COND) \
|
2014-03-01 01:35:24 +00:00
|
|
|
SPROUT_STATIC_ASSERT_MSG(COND, #COND)
|
2014-07-03 14:41:40 +00:00
|
|
|
#if SPROUT_PP_VARIADICS
|
|
|
|
# define SPROUT_STATIC_ASSERT_2(COND, MESSAGE) \
|
|
|
|
SPROUT_STATIC_ASSERT_MSG(COND, MESSAGE)
|
|
|
|
# define SPROUT_STATIC_ASSERT(...) \
|
|
|
|
SPROUT_PP_CAT(SPROUT_STATIC_ASSERT_, SPROUT_PP_VARIADIC_SIZE(__VA_ARGS__))(__VA_ARGS__)
|
|
|
|
#else
|
2014-08-16 08:35:36 +00:00
|
|
|
# define SPROUT_STATIC_ASSERT(COND) \
|
|
|
|
SPROUT_STATIC_ASSERT_1(COND)
|
2014-07-03 14:41:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// SPROUT_STATIC_ASSERT_PREPROCESSED
|
|
|
|
//
|
2014-03-01 01:35:24 +00:00
|
|
|
#define SPROUT_STATIC_ASSERT_PREPROCESSED(COND) \
|
2014-10-24 04:48:36 +00:00
|
|
|
SPROUT_STATIC_ASSERT_MSG(COND, #COND " \n[[preprocessed]] " SPROUT_PP_STRINGIZE(COND))
|
2014-03-01 01:35:24 +00:00
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_STATIC_ASSERT_HPP
|