static_assert.h Source File

Back to the index.

static_assert.h
Go to the documentation of this file.
1 /*
2  * Modified for GXemul:
3  *
4  * 1. Better Doxygen comment for struct __nvwa_compile_time_error.
5  */
6 
7 // -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
8 // vim:tabstop=4:shiftwidth=4:expandtab:
9 
10 /*
11  * Copyright (C) 2004-2005 Wu Yongwei <adah at users dot sourceforge dot net>
12  *
13  * This software is provided 'as-is', without any express or implied
14  * warranty. In no event will the authors be held liable for any
15  * damages arising from the use of this software.
16  *
17  * Permission is granted to anyone to use this software for any purpose,
18  * including commercial applications, and to alter it and redistribute
19  * it freely, subject to the following restrictions:
20  *
21  * 1. The origin of this software must not be misrepresented; you must
22  * not claim that you wrote the original software. If you use this
23  * software in a product, an acknowledgment in the product
24  * documentation would be appreciated but is not required.
25  * 2. Altered source versions must be plainly marked as such, and must
26  * not be misrepresented as being the original software.
27  * 3. This notice may not be removed or altered from any source
28  * distribution.
29  *
30  * This file is part of Stones of Nvwa:
31  * http://sourceforge.net/projects/nvwa
32  *
33  */
34 
35 /**
36  * @file static_assert.h
37  *
38  * Template class to check validity duing compile time (adapted from Loki).
39  *
40  * @version 1.2, 2005/11/22
41  * @author Wu Yongwei
42  *
43  */
44 
45 #ifndef STATIC_ASSERT
46 
47 template <bool> struct __nvwa_compile_time_error;
48 
49 /**
50  * \brief Part of Wu Yongwei's new/delete debug
51  * memory leak detector.
52  */
53 template <> struct __nvwa_compile_time_error<true> {};
54 
55 #define STATIC_ASSERT(_Expr, _Msg) \
56  { \
57  __nvwa_compile_time_error<((_Expr) != 0)> ERROR_##_Msg; \
58  (void)ERROR_##_Msg; \
59  }
60 
61 #endif // STATIC_ASSERT
__nvwa_compile_time_error
Definition: static_assert.h:47

Generated on Tue Mar 24 2020 14:04:48 for GXemul by doxygen 1.8.17