mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-07-12 12:06:34 +02:00
Somewhat more C friendly. Uses templates...
[SVN r12554]
This commit is contained in:
@ -10,21 +10,22 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
// This example demonstrates the usage of preprocessor lists for generating C++ code.
|
||||
/* This example demonstrates the usage of preprocessor lists for generating C++ code. */
|
||||
|
||||
#include <boost/preprocessor/list/for_each.hpp>
|
||||
#include <boost/preprocessor/tuple/to_list.hpp>
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
|
||||
// List of integral types. (Strictly speaking, wchar_t should be on the list.)
|
||||
/* List of integral types. (Strictly speaking, wchar_t should be on the list.) */
|
||||
#define INTEGRAL_TYPES\
|
||||
BOOST_PP_TUPLE_TO_LIST(9,(char, signed char, unsigned char, short, unsigned short, int, unsigned, long, unsigned long))
|
||||
|
||||
// Template for testing whether a type is an integral type.
|
||||
/* Template for testing whether a type is an integral type. */
|
||||
template<class T> struct is_integral {enum {value = false};};
|
||||
|
||||
// Macro for defining a specialization of is_integral<> template.
|
||||
// NOTE: CV is invoked so that it is possible to pass empty cv-qualifiers.
|
||||
/* Macro for defining a specialization of is_integral<> template.
|
||||
* NOTE: CV is invoked so that it is possible to pass empty cv-qualifiers.
|
||||
*/
|
||||
#define IS_INTEGRAL_SPECIALIZATION(_,CV,T)\
|
||||
template<> struct is_integral<CV() T> {enum {value = true};};
|
||||
|
||||
|
Reference in New Issue
Block a user