spot  1.2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
casts.hh
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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 #ifndef SPOT_MISC_CASTS_HH
20 # define SPOT_MISC_CASTS_HH
21 
22 
23 // We usually write code like
24 // subclass* i = down_cast<subclass*>(m);
25 // assert(i);
26 // ... use i ...
27 // When NDEBUG is set, the down_cast is a fast static_cast
28 // and the assert has no effect.
29 // Otherwise, the down_cast is a dynamic_cast and may return 0
30 // on error, which the assert catches.
31 
32 #if NDEBUG
33 # define down_cast static_cast
34 #else
35 # define down_cast dynamic_cast
36 #endif
37 
38 #endif // SPOT_MISC_CASTS_HH

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Thu May 15 2014 11:04:11 for spot by doxygen 1.8.4