From 2fbc75f4394e1b5ca7e4975da0d0029de97c0d5f Mon Sep 17 00:00:00 2001 From: Maximilien Colange Date: Thu, 24 Nov 2016 16:24:29 +0100 Subject: [PATCH] New macro to downcast shared pointers. * spot/misc/casts.hh: Add a macro down_pointer_cast. --- spot/misc/casts.hh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spot/misc/casts.hh b/spot/misc/casts.hh index 49c441843..a4050893a 100644 --- a/spot/misc/casts.hh +++ b/spot/misc/casts.hh @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2011, 2015 Laboratoire de Recherche et Développement +// Copyright (C) 2011, 2015-2016 Laboratoire de Recherche et Développement // de l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -29,7 +29,13 @@ // on error, which the assert catches. #if NDEBUG -# define down_cast static_cast +# define down_cast static_cast #else # define down_cast dynamic_cast #endif + +#if NDEBUG +# define down_pointer_cast std::static_pointer_cast +#else +# define down_pointer_cast std::dynamic_pointer_cast +#endif