No message
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@40 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
5ca0b883b1
commit
b5d2cd3d11
23 changed files with 742 additions and 1184 deletions
|
@ -1,26 +1,4 @@
|
|||
head 1.1;
|
||||
access;
|
||||
symbols;
|
||||
locks; strict;
|
||||
comment @ * @;
|
||||
|
||||
|
||||
1.1
|
||||
date 2002.07.16.22.42.05; author tslettebo; state Exp;
|
||||
branches;
|
||||
next ;
|
||||
|
||||
|
||||
desc
|
||||
@@
|
||||
|
||||
|
||||
1.1
|
||||
log
|
||||
@Initial commit
|
||||
@
|
||||
text
|
||||
@////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The Loki Library
|
||||
// Copyright (c) 2001 by Andrei Alexandrescu
|
||||
// This code accompanies the book:
|
||||
|
@ -35,7 +13,7 @@ text
|
|||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Last update: June 20, 2001
|
||||
// Last update: August 9, 2002
|
||||
|
||||
#ifndef STATIC_CHECK_INC_
|
||||
#define STATIC_CHECK_INC_
|
||||
|
@ -59,17 +37,24 @@ namespace Loki
|
|||
// If expr is zero, id will appear in a compile-time error message.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define STATIC_CHECK(expr, msg) \
|
||||
{ Loki::CompileTimeError<((expr) != 0)> ERROR_##msg; (void)ERROR_##msg; }
|
||||
|
||||
template<bool>
|
||||
struct CompileTimeChecker
|
||||
{
|
||||
CompileTimeChecker(...);
|
||||
};
|
||||
template<> struct CompileTimeChecker<false> {};
|
||||
#define STATIC_CHECK(expr, msg)\
|
||||
{\
|
||||
class ERROR_##msg {}; \
|
||||
(void)sizeof(CompileTimeChecker<(expr)>(ERROR_##msg()));\
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Change log:
|
||||
// March 20, 2001: add extra parens to STATIC_CHECK - it looked like a fun
|
||||
// definition
|
||||
// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!!
|
||||
// July 16, 2002: Ported by Terje Slettebø to BCC 5.6
|
||||
// definition
|
||||
// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!!
|
||||
// July 16, 2002: Ported by Terje Slettebø and Pavel Vozenilek to BCC 5.6
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // STATIC_CHECK_INC_
|
||||
@
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue