SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
static_assert.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
2 // vim:tabstop=4:shiftwidth=4:expandtab:
3 #ifdef _MSC_VER
4 #include <windows_config.h>
5 #else
6 #include <config.h>
7 #endif
8 #ifdef CHECK_MEMORY_LEAKS
9 /*
10  * Copyright (C) 2004-2008 Wu Yongwei <adah at users dot sourceforge dot net>
11  *
12  * This software is provided 'as-is', without any express or implied
13  * warranty. In no event will the authors be held liable for any
14  * damages arising from the use of this software.
15  *
16  * Permission is granted to anyone to use this software for any purpose,
17  * including commercial applications, and to alter it and redistribute
18  * it freely, subject to the following restrictions:
19  *
20  * 1. The origin of this software must not be misrepresented; you must
21  * not claim that you wrote the original software. If you use this
22  * software in a product, an acknowledgement in the product
23  * documentation would be appreciated but is not required.
24  * 2. Altered source versions must be plainly marked as such, and must
25  * not be misrepresented as being the original software.
26  * 3. This notice may not be removed or altered from any source
27  * distribution.
28  *
29  * This file is part of Stones of Nvwa:
30  * http://sourceforge.net/projects/nvwa
31  *
32  */
33 
44 #ifndef STATIC_ASSERT
45 
46 template <bool> struct __nvwa_compile_time_error;
47 template <> struct __nvwa_compile_time_error<true> {};
48 
49 #define STATIC_ASSERT(_Expr, _Msg) \
50  { \
51  __nvwa_compile_time_error<((_Expr) != 0)> ERROR_##_Msg; \
52  (void)ERROR_##_Msg; \
53  }
54 
55 #endif // STATIC_ASSERT
56 
57 
58 #endif