]> git.lyx.org Git - lyx.git/blob - src/support/LAssert.h
in addition to the changes mentioned in ChangeLog, there is the usual batch of whites...
[lyx.git] / src / support / LAssert.h
1 // -*- C++ -*-
2 #ifndef LASSERT_H
3 #define LASSERT_H
4
5 //namespace LyX {
6
7 #define HAVE_TEMPLATE
8 #ifdef HAVE_TEMPLATE
9 //template<class X, class A> inline void Assert(A assertion)
10 template<class A> inline void Assert(A assertion)
11 {
12         //if (!assertion) throw X();
13         if (!assertion) {
14                 abort();
15         }
16 }
17
18 #ifdef HAVE_PARTIAL_SPECIALIZATION
19 // Not too sure if this is the correct way to specialize
20 template<class A> inline void Assert(A * ptr)
21 {
22         if (!ptr) {
23                 abort();
24         }
25 }
26 #endif
27
28 //template<class A, class E> inline void Assert(A assertion, E except)
29 //{
30 //      if (!assertion) except;
31 //}
32
33 #else
34
35 inline void lyx_assert(...)
36 {
37         // nothing
38 }
39
40 #endif
41 #endif
42
43 //} // end of namespace LyX