spot  0.9.2
casts.hh
Go to the documentation of this file.
1 // Copyright (C) 2011 Laboratoire de Recherche et Développement
2 // de l'Epita (LRDE).
3 //
4 // This file is part of Spot, a model checking library.
5 //
6 // Spot is free software; you can redistribute it and/or modify it
7 // under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // Spot is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 // License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with Spot; see the file COPYING. If not, write to the Free
18 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 // 02111-1307, USA.
20 
21 #ifndef SPOT_MISC_CASTS_HH
22 # define SPOT_MISC_CASTS_HH
23 
24 
25 // We usually write code like
26 // subclass* i = down_cast<subclass*>(m);
27 // assert(i);
28 // ... use i ...
29 // When NDEBUG is set, the down_cast is a fast static_cast
30 // and the assert has no effect.
31 // Otherwise, the down_cast is a dynamic_cast and may return 0
32 // on error, which the assert catches.
33 
34 #if NDEBUG
35 # define down_cast static_cast
36 #else
37 # define down_cast dynamic_cast
38 #endif
39 
40 #endif // SPOT_MISC_CASTS_HH

Please comment this page and report errors about it on the RefDocComments page.
Generated on Mon Jul 2 2012 17:35:47 for spot by doxygen 1.8.1.1