]> git.lyx.org Git - lyx.git/blob - src/support/LAssert.h
fix double space editing, small change to make Path more foolproof, dont use reserve...
[lyx.git] / src / support / LAssert.h
1 // -*- C++ -*-
2 #ifndef LASSERT_H
3 #define LASSERT_H
4
5 //namespace LyX {
6
7 #ifdef ENABLE_ASSERTIONS
8
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         Assert<void const *>(ptr);
23 }
24 template<> inline void Assert(void const * ptr)
25 {
26         if (!ptr) {
27                 abort();
28         }
29 }
30 #endif /* HAVE_PARTIAL_SPECIALIZATION  */ 
31
32 //template<class A, class E> inline void Assert(A assertion, E except)
33 //{
34 //      if (!assertion) except;
35 //}
36
37 #else
38
39 template<class A> inline void Assert(A /*assertion*/) {}
40
41 #endif /* ENABLE_ASSERTIONS */
42
43
44 //} // end of namespace LyX
45
46
47 #endif /* LASSERT_H */
48